diff options
Diffstat (limited to 'teleirc/matterbridge/vendor/go.mau.fi')
148 files changed, 50726 insertions, 0 deletions
diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/LICENSE b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/LICENSE new file mode 100644 index 0000000..eecbf2c --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + libsignal-protocol-go + Copyright (C) 2017 RadicalApp LLC + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + libsignal-protocol-go Copyright (C) 2017 RadicalApp LLC + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/cipher/Cbc.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/cipher/Cbc.go new file mode 100644 index 0000000..6a6db5d --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/cipher/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 cipher + +/* +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 DecryptCbc(iv, key, 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 EncryptCbc(iv, key, 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/teleirc/matterbridge/vendor/go.mau.fi/libsignal/cipher/Cipher.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/cipher/Cipher.go new file mode 100644 index 0000000..edfb428 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/cipher/Cipher.go @@ -0,0 +1,105 @@ +// Package cipher is a package for common encrypt/decrypt of symmetric key messages. +package cipher + +import ( + "bytes" + "crypto/aes" + "crypto/cipher" + "errors" +) + +// Decrypt will use the given key, iv, and ciphertext and return +// the plaintext bytes. +func Decrypt(iv, key, ciphertext []byte) ([]byte, error) { + block, err := aes.NewCipher(key) + if err != nil { + return nil, err + } + if len(ciphertext) < aes.BlockSize { + return nil, errors.New("ciphertext too short") + } + cbc := cipher.NewCBCDecrypter(block, iv) + cbc.CryptBlocks(ciphertext, ciphertext) + + unpaddedText, err := pkcs7Unpad(ciphertext, aes.BlockSize) + if err != nil { + return nil, err + } + + return unpaddedText, nil +} + +// Encrypt will use the given iv, key, and plaintext bytes +// and return ciphertext bytes. +func Encrypt(iv, key, plaintext []byte) ([]byte, error) { + block, err := aes.NewCipher(key) + if err != nil { + return nil, err + } + paddedText, err := pkcs7Pad(plaintext, block.BlockSize()) + if err != nil { + return nil, err + } + ciphertext := make([]byte, len(paddedText)) + mode := cipher.NewCBCEncrypter(block, iv) + mode.CryptBlocks(ciphertext, paddedText) + + return ciphertext, nil +} + +// PKCS7 padding. + +// PKCS7 errors. +var ( + // ErrInvalidBlockSize indicates hash blocksize <= 0. + ErrInvalidBlockSize = errors.New("invalid blocksize") + + // ErrInvalidPKCS7Data indicates bad input to PKCS7 pad or unpad. + ErrInvalidPKCS7Data = errors.New("invalid PKCS7 data (empty or not padded)") + + // ErrInvalidPKCS7Padding indicates PKCS7 unpad fails to bad input. + ErrInvalidPKCS7Padding = errors.New("invalid padding on input") +) + +// pkcs7Pad right-pads the given byte slice with 1 to n bytes, where +// n is the block size. The size of the result is x times n, where x +// is at least 1. +func pkcs7Pad(b []byte, blocksize int) ([]byte, error) { + if blocksize <= 0 { + return nil, ErrInvalidBlockSize + } + if b == nil || len(b) == 0 { + return nil, ErrInvalidPKCS7Data + } + n := blocksize - (len(b) % blocksize) + pb := make([]byte, len(b)+n) + copy(pb, b) + copy(pb[len(b):], bytes.Repeat([]byte{byte(n)}, n)) + return pb, nil +} + +// pkcs7Unpad validates and unpads data from the given bytes slice. +// The returned value will be 1 to n bytes smaller depending on the +// amount of padding, where n is the block size. +func pkcs7Unpad(b []byte, blocksize int) ([]byte, error) { + if blocksize <= 0 { + return nil, ErrInvalidBlockSize + } + if b == nil || len(b) == 0 { + return nil, ErrInvalidPKCS7Data + } + if len(b)%blocksize != 0 { + return nil, ErrInvalidPKCS7Padding + } + c := b[len(b)-1] + n := int(c) + if n == 0 || n > len(b) { + return nil, ErrInvalidPKCS7Padding + } + for i := 0; i < n; i++ { + if b[len(b)-n+i] != c { + return nil, ErrInvalidPKCS7Padding + } + } + return b[:len(b)-n], nil +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ecc/Curve.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ecc/Curve.go new file mode 100644 index 0000000..f93cc39 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ecc/Curve.go @@ -0,0 +1,109 @@ +package ecc + +import ( + "crypto/rand" + "errors" + "fmt" + "io" + + "golang.org/x/crypto/curve25519" + + "go.mau.fi/libsignal/logger" +) + +// DjbType is the Diffie-Hellman curve type (curve25519) created by D. J. Bernstein. +const DjbType = 0x05 + +var ErrBadKeyType = errors.New("bad key type") + +// DecodePoint will take the given bytes and offset and return an ECPublicKeyable object. +// This is used to check the byte at the given offset in the byte array for a special +// "type" byte that will determine the key type. Currently only DJB EC keys are supported. +func DecodePoint(bytes []byte, offset int) (ECPublicKeyable, error) { + keyType := bytes[offset] & 0xFF + + switch keyType { + case DjbType: + keyBytes := [32]byte{} + copy(keyBytes[:], bytes[offset+1:]) + return NewDjbECPublicKey(keyBytes), nil + default: + return nil, fmt.Errorf("%w %d", ErrBadKeyType, keyType) + } +} + +func CreateKeyPair(privateKey []byte) *ECKeyPair { + var private, public [32]byte + copy(private[:], privateKey) + + private[0] &= 248 + private[31] &= 127 + private[31] |= 64 + + curve25519.ScalarBaseMult(&public, &private) + + // Put data into our keypair struct + djbECPub := NewDjbECPublicKey(public) + djbECPriv := NewDjbECPrivateKey(private) + keypair := NewECKeyPair(djbECPub, djbECPriv) + + logger.Debug("Returning keypair: ", keypair) + return keypair +} + +// GenerateKeyPair returns an EC Key Pair. +func GenerateKeyPair() (*ECKeyPair, error) { + // logger.Debug("Generating EC Key Pair...") + // Get cryptographically secure random numbers. + random := rand.Reader + + // Create a byte array for our public and private keys. + var private, public [32]byte + + // Generate some random data + _, err := io.ReadFull(random, private[:]) + if err != nil { + return nil, err + } + + // Documented at: http://cr.yp.to/ecdh.html + private[0] &= 248 + private[31] &= 127 + private[31] |= 64 + + curve25519.ScalarBaseMult(&public, &private) + + // Put data into our keypair struct + djbECPub := NewDjbECPublicKey(public) + djbECPriv := NewDjbECPrivateKey(private) + keypair := NewECKeyPair(djbECPub, djbECPriv) + + // logger.Debug("Returning keypair: ", keypair) + + return keypair, nil +} + +// VerifySignature verifies that the message was signed with the given key. +func VerifySignature(signingKey ECPublicKeyable, message []byte, signature [64]byte) bool { + logger.Debug("Verifying signature of bytes: ", message) + publicKey := signingKey.PublicKey() + valid := verify(publicKey, message, &signature) + logger.Debug("Signature valid: ", valid) + return valid +} + +// CalculateSignature signs a message with the given private key. +func CalculateSignature(signingKey ECPrivateKeyable, message []byte) [64]byte { + logger.Debug("Signing bytes with signing key") + // Get cryptographically secure random numbers. + var random [64]byte + r := rand.Reader + io.ReadFull(r, random[:]) + + // Get the private key. + privateKey := signingKey.Serialize() + + // Sign the message. + signature := sign(&privateKey, message, random) + return *signature +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ecc/DjbECPublicKey.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ecc/DjbECPublicKey.go new file mode 100644 index 0000000..11757fb --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ecc/DjbECPublicKey.go @@ -0,0 +1,29 @@ +package ecc + +// NewDjbECPublicKey creates a new Curve25519 public key with the given bytes. +func NewDjbECPublicKey(publicKey [32]byte) *DjbECPublicKey { + key := DjbECPublicKey{ + publicKey: publicKey, + } + return &key +} + +// DjbECPublicKey implements the ECPublicKey interface and uses Curve25519. +type DjbECPublicKey struct { + publicKey [32]byte +} + +// PublicKey returns the EC public key as a byte array. +func (d *DjbECPublicKey) PublicKey() [32]byte { + return d.publicKey +} + +// Serialize returns the public key prepended by the DjbType value. +func (d *DjbECPublicKey) Serialize() []byte { + return append([]byte{DjbType}, d.publicKey[:]...) +} + +// Type returns the DjbType value. +func (d *DjbECPublicKey) Type() int { + return DjbType +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ecc/DkbECPrivateKey.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ecc/DkbECPrivateKey.go new file mode 100644 index 0000000..055692c --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ecc/DkbECPrivateKey.go @@ -0,0 +1,29 @@ +package ecc + +// NewDjbECPrivateKey returns a new EC private key with the given bytes. +func NewDjbECPrivateKey(key [32]byte) *DjbECPrivateKey { + private := DjbECPrivateKey{ + privateKey: key, + } + return &private +} + +// DjbECPrivateKey implements the ECPrivateKey interface and uses Curve25519. +type DjbECPrivateKey struct { + privateKey [32]byte +} + +// PrivateKey returns the private key as a byte-array. +func (d *DjbECPrivateKey) PrivateKey() [32]byte { + return d.privateKey +} + +// Serialize returns the private key as a byte-array. +func (d *DjbECPrivateKey) Serialize() [32]byte { + return d.privateKey +} + +// Type returns the EC type value. +func (d *DjbECPrivateKey) Type() int { + return DjbType +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ecc/Doc.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ecc/Doc.go new file mode 100644 index 0000000..06e2cac --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ecc/Doc.go @@ -0,0 +1,3 @@ +// Package ecc provides a way to generate, sign, and use Elliptic-Curve +// X25519 Cryptography keys. +package ecc diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ecc/ECKeyPair.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ecc/ECKeyPair.go new file mode 100644 index 0000000..1110344 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ecc/ECKeyPair.go @@ -0,0 +1,27 @@ +package ecc + +// NewECKeyPair returns a new elliptic curve keypair given the specified public and private keys. +func NewECKeyPair(publicKey ECPublicKeyable, privateKey ECPrivateKeyable) *ECKeyPair { + keypair := ECKeyPair{ + publicKey: publicKey, + privateKey: privateKey, + } + + return &keypair +} + +// ECKeyPair is a combination of both public and private elliptic curve keys. +type ECKeyPair struct { + publicKey ECPublicKeyable + privateKey ECPrivateKeyable +} + +// PublicKey returns the public key from the key pair. +func (e *ECKeyPair) PublicKey() ECPublicKeyable { + return e.publicKey +} + +// PrivateKey returns the private key from the key pair. +func (e *ECKeyPair) PrivateKey() ECPrivateKeyable { + return e.privateKey +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ecc/ECPrivateKey.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ecc/ECPrivateKey.go new file mode 100644 index 0000000..be3ddae --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ecc/ECPrivateKey.go @@ -0,0 +1,7 @@ +package ecc + +// ECPrivateKeyable is an interface for all elliptic curve private keys. +type ECPrivateKeyable interface { + Serialize() [32]byte + Type() int +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ecc/ECPublicKey.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ecc/ECPublicKey.go new file mode 100644 index 0000000..9b71f05 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ecc/ECPublicKey.go @@ -0,0 +1,11 @@ +package ecc + +// KeySize is the size of EC keys (32) with the EC type byte prepended to it. +const KeySize int = 33 + +// ECPublicKeyable is an interface for all elliptic curve public keys. +type ECPublicKeyable interface { + Serialize() []byte + Type() int + PublicKey() [32]byte +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ecc/SignCurve25519.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ecc/SignCurve25519.go new file mode 100644 index 0000000..a9bd7b4 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ecc/SignCurve25519.go @@ -0,0 +1,97 @@ +package ecc + +// Package curve25519sign implements a signature scheme based on Curve25519 keys. +// See https://moderncrypto.org/mail-archive/curves/2014/000205.html for details. + +import ( + "crypto/ed25519" + "crypto/sha512" + + "filippo.io/edwards25519" + "filippo.io/edwards25519/field" +) + +// sign signs the message with privateKey and returns a signature as a byte slice. +func sign(privateKey *[32]byte, message []byte, random [64]byte) *[64]byte { + + // Calculate Ed25519 public key from Curve25519 private key + var A edwards25519.Point + privateKeyScalar, _ := edwards25519.NewScalar().SetBytesWithClamping(privateKey[:]) + A.ScalarBaseMult(privateKeyScalar) + publicKey := *(*[32]byte)(A.Bytes()) + + // Calculate r + diversifier := [32]byte{ + 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF} + + var r [64]byte + hash := sha512.New() + hash.Write(diversifier[:]) + hash.Write(privateKey[:]) + hash.Write(message) + hash.Write(random[:]) + hash.Sum(r[:0]) + + // Calculate R + var rReduced *edwards25519.Scalar + rReduced, _ = edwards25519.NewScalar().SetUniformBytes(r[:]) + var R edwards25519.Point + R.ScalarBaseMult(rReduced) + + var encodedR [32]byte + encodedR = *(*[32]byte)(R.Bytes()) + + // Calculate S = r + SHA2-512(R || A_ed || msg) * a (mod L) + var hramDigest [64]byte + hash.Reset() + hash.Write(encodedR[:]) + hash.Write(publicKey[:]) + hash.Write(message) + hash.Sum(hramDigest[:0]) + hramDigestReduced, _ := edwards25519.NewScalar().SetUniformBytes(hramDigest[:]) + + sScalar := edwards25519.NewScalar().MultiplyAdd(hramDigestReduced, privateKeyScalar, rReduced) + s := *(*[32]byte)(sScalar.Bytes()) + + signature := new([64]byte) + copy(signature[:], encodedR[:]) + copy(signature[32:], s[:]) + signature[63] |= publicKey[31] & 0x80 + + return signature +} + +// verify checks whether the message has a valid signature. +func verify(publicKey [32]byte, message []byte, signature *[64]byte) bool { + + publicKey[31] &= 0x7F + + /* Convert the Curve25519 public key into an Ed25519 public key. In + particular, convert Curve25519's "montgomery" x-coordinate into an + Ed25519 "edwards" y-coordinate: + + ed_y = (mont_x - 1) / (mont_x + 1) + + NOTE: mont_x=-1 is converted to ed_y=0 since fe_invert is mod-exp + + Then move the sign bit into the pubkey from the signature. + */ + + var edY, one, montX, montXMinusOne, montXPlusOne field.Element + _, _ = montX.SetBytes(publicKey[:]) + _ = one.One() + montXMinusOne.Subtract(&montX, &one) + montXPlusOne.Add(&montX, &one) + montXPlusOne.Invert(&montXPlusOne) + edY.Multiply(&montXMinusOne, &montXPlusOne) + + A_ed := *(*[32]byte)(edY.Bytes()) + + A_ed[31] |= signature[63] & 0x80 + signature[63] &= 0x7F + + return ed25519.Verify(A_ed[:], message, signature[:]) +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/groups/GroupCipher.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/groups/GroupCipher.go new file mode 100644 index 0000000..b821f3c --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/groups/GroupCipher.go @@ -0,0 +1,141 @@ +package groups + +import ( + "fmt" + + "go.mau.fi/libsignal/cipher" + "go.mau.fi/libsignal/ecc" + "go.mau.fi/libsignal/groups/ratchet" + "go.mau.fi/libsignal/groups/state/record" + "go.mau.fi/libsignal/groups/state/store" + "go.mau.fi/libsignal/protocol" + "go.mau.fi/libsignal/signalerror" +) + +// NewGroupCipher will return a new group message cipher that can be used for +// encrypt/decrypt operations. +func NewGroupCipher(builder *SessionBuilder, senderKeyID *protocol.SenderKeyName, + senderKeyStore store.SenderKey) *GroupCipher { + + return &GroupCipher{ + senderKeyID: senderKeyID, + senderKeyStore: senderKeyStore, + sessionBuilder: builder, + } +} + +// GroupCipher is the main entry point for group encrypt/decrypt operations. +// Once a session has been established, this can be used for +// all encrypt/decrypt operations within that session. +type GroupCipher struct { + senderKeyID *protocol.SenderKeyName + senderKeyStore store.SenderKey + sessionBuilder *SessionBuilder +} + +// Encrypt will take the given message in bytes and return encrypted bytes. +func (c *GroupCipher) Encrypt(plaintext []byte) (protocol.GroupCiphertextMessage, error) { + // Load the sender key based on id from our store. + keyRecord := c.senderKeyStore.LoadSenderKey(c.senderKeyID) + senderKeyState, err := keyRecord.SenderKeyState() + if err != nil { + return nil, err + } + + // Get the message key from the senderkey state. + senderKey, err := senderKeyState.SenderChainKey().SenderMessageKey() + if err != nil { + return nil, err + } + + // Encrypt the plaintext. + ciphertext, err := cipher.EncryptCbc(senderKey.Iv(), senderKey.CipherKey(), plaintext) + if err != nil { + return nil, err + } + + senderKeyMessage := protocol.NewSenderKeyMessage( + senderKeyState.KeyID(), + senderKey.Iteration(), + ciphertext, + senderKeyState.SigningKey().PrivateKey(), + c.sessionBuilder.serializer.SenderKeyMessage, + ) + + senderKeyState.SetSenderChainKey(senderKeyState.SenderChainKey().Next()) + c.senderKeyStore.StoreSenderKey(c.senderKeyID, keyRecord) + + return senderKeyMessage, nil +} + +// Decrypt decrypts the given message using an existing session that +// is stored in the senderKey store. +func (c *GroupCipher) Decrypt(senderKeyMessage *protocol.SenderKeyMessage) ([]byte, error) { + keyRecord := c.senderKeyStore.LoadSenderKey(c.senderKeyID) + + if keyRecord.IsEmpty() { + return nil, fmt.Errorf("%w for %s in %s", signalerror.ErrNoSenderKeyForUser, c.senderKeyID.Sender().String(), c.senderKeyID.GroupID()) + } + + // Get the senderkey state by id. + senderKeyState, err := keyRecord.GetSenderKeyStateByID(senderKeyMessage.KeyID()) + if err != nil { + return nil, err + } + + // Verify the signature of the senderkey message. + verified := c.verifySignature(senderKeyState.SigningKey().PublicKey(), senderKeyMessage) + if !verified { + return nil, signalerror.ErrSenderKeyStateVerificationFailed + } + + senderKey, err := c.getSenderKey(senderKeyState, senderKeyMessage.Iteration()) + if err != nil { + return nil, err + } + + // Decrypt the message ciphertext. + plaintext, err := cipher.DecryptCbc(senderKey.Iv(), senderKey.CipherKey(), senderKeyMessage.Ciphertext()) + if err != nil { + return nil, err + } + + // Store the sender key by id. + c.senderKeyStore.StoreSenderKey(c.senderKeyID, keyRecord) + + return plaintext, nil +} + +// verifySignature will verify the signature of the senderkey message with +// the given public key. +func (c *GroupCipher) verifySignature(signingPubKey ecc.ECPublicKeyable, + senderKeyMessage *protocol.SenderKeyMessage) bool { + + return ecc.VerifySignature(signingPubKey, senderKeyMessage.Serialize(), senderKeyMessage.Signature()) +} + +func (c *GroupCipher) getSenderKey(senderKeyState *record.SenderKeyState, iteration uint32) (*ratchet.SenderMessageKey, error) { + senderChainKey := senderKeyState.SenderChainKey() + if senderChainKey.Iteration() > iteration { + if senderKeyState.HasSenderMessageKey(iteration) { + return senderKeyState.RemoveSenderMessageKey(iteration), nil + } + return nil, fmt.Errorf("%w (current: %d, received: %d)", signalerror.ErrOldCounter, senderChainKey.Iteration(), iteration) + } + + if iteration-senderChainKey.Iteration() > 2000 { + return nil, signalerror.ErrTooFarIntoFuture + } + + for senderChainKey.Iteration() < iteration { + senderMessageKey, err := senderChainKey.SenderMessageKey() + if err != nil { + return nil, err + } + senderKeyState.AddSenderMessageKey(senderMessageKey) + senderChainKey = senderChainKey.Next() + } + + senderKeyState.SetSenderChainKey(senderChainKey.Next()) + return senderChainKey.SenderMessageKey() +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/groups/GroupSessionBuilder.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/groups/GroupSessionBuilder.go new file mode 100644 index 0000000..2a5569b --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/groups/GroupSessionBuilder.go @@ -0,0 +1,84 @@ +// Package groups is responsible for setting up group SenderKey encrypted sessions. +// Once a session has been established, GroupCipher can be used to encrypt/decrypt +// messages in that session. +// +// The built sessions are unidirectional: they can be used either for sending or +// for receiving, but not both. Sessions are constructed per (groupId + senderId + +// deviceId) tuple. Remote logical users are identified by their senderId, and each +// logical recipientId can have multiple physical devices. +package groups + +import ( + "go.mau.fi/libsignal/groups/state/record" + "go.mau.fi/libsignal/groups/state/store" + "go.mau.fi/libsignal/protocol" + "go.mau.fi/libsignal/serialize" + "go.mau.fi/libsignal/util/keyhelper" +) + +// NewGroupSessionBuilder will return a new group session builder. +func NewGroupSessionBuilder(senderKeyStore store.SenderKey, + serializer *serialize.Serializer) *SessionBuilder { + + return &SessionBuilder{ + senderKeyStore: senderKeyStore, + serializer: serializer, + } +} + +// SessionBuilder is a structure for building group sessions. +type SessionBuilder struct { + senderKeyStore store.SenderKey + serializer *serialize.Serializer +} + +// Process will process an incoming group message and set up the corresponding +// session for it. +func (b *SessionBuilder) Process(senderKeyName *protocol.SenderKeyName, + msg *protocol.SenderKeyDistributionMessage) { + + senderKeyRecord := b.senderKeyStore.LoadSenderKey(senderKeyName) + if senderKeyRecord == nil { + senderKeyRecord = record.NewSenderKey(b.serializer.SenderKeyRecord, b.serializer.SenderKeyState) + } + senderKeyRecord.AddSenderKeyState(msg.ID(), msg.Iteration(), msg.ChainKey(), msg.SignatureKey()) + b.senderKeyStore.StoreSenderKey(senderKeyName, senderKeyRecord) +} + +// Create will create a new group session for the given name. +func (b *SessionBuilder) Create(senderKeyName *protocol.SenderKeyName) (*protocol.SenderKeyDistributionMessage, error) { + // Load the senderkey by name + senderKeyRecord := b.senderKeyStore.LoadSenderKey(senderKeyName) + + // If the record is empty, generate new keys. + if senderKeyRecord == nil || senderKeyRecord.IsEmpty() { + senderKeyRecord = record.NewSenderKey(b.serializer.SenderKeyRecord, b.serializer.SenderKeyState) + signingKey, err := keyhelper.GenerateSenderSigningKey() + if err != nil { + return nil, err + } + senderKeyRecord.SetSenderKeyState( + keyhelper.GenerateSenderKeyID(), 0, + keyhelper.GenerateSenderKey(), + signingKey, + ) + b.senderKeyStore.StoreSenderKey(senderKeyName, senderKeyRecord) + } + + // Get the senderkey state. + state, err := senderKeyRecord.SenderKeyState() + if err != nil { + return nil, err + } + + // Create the group message to return. + senderKeyDistributionMessage := protocol.NewSenderKeyDistributionMessage( + state.KeyID(), + state.SenderChainKey().Iteration(), + state.SenderChainKey().Seed(), + state.SigningKey().PublicKey(), + b.serializer.SenderKeyDistributionMessage, + ) + + return senderKeyDistributionMessage, nil +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/groups/ratchet/Doc.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/groups/ratchet/Doc.go new file mode 100644 index 0000000..6d37446 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/groups/ratchet/Doc.go @@ -0,0 +1,3 @@ +// Package ratchet provides the methods necessary to establish a ratchet +// session for group messaging. +package ratchet diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/groups/ratchet/SenderChainKey.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/groups/ratchet/SenderChainKey.go new file mode 100644 index 0000000..a953014 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/groups/ratchet/SenderChainKey.go @@ -0,0 +1,68 @@ +package ratchet + +import ( + "crypto/hmac" + "crypto/sha256" +) + +var messageKeySeed = []byte{0x01} +var chainKeySeed = []byte{0x02} + +// NewSenderChainKey will return a new SenderChainKey. +func NewSenderChainKey(iteration uint32, chainKey []byte) *SenderChainKey { + return &SenderChainKey{ + iteration: iteration, + chainKey: chainKey, + } +} + +// NewSenderChainKeyFromStruct will return a new chain key object from the +// given serializeable structure. +func NewSenderChainKeyFromStruct(structure *SenderChainKeyStructure) *SenderChainKey { + return &SenderChainKey{ + iteration: structure.Iteration, + chainKey: structure.ChainKey, + } +} + +// NewStructFromSenderChainKeys returns a serializeable structure of chain keys. +func NewStructFromSenderChainKey(key *SenderChainKey) *SenderChainKeyStructure { + return &SenderChainKeyStructure{ + Iteration: key.iteration, + ChainKey: key.chainKey, + } +} + +// SenderChainKeyStructure is a serializeable structure of SenderChainKeys. +type SenderChainKeyStructure struct { + Iteration uint32 + ChainKey []byte +} + +type SenderChainKey struct { + iteration uint32 + chainKey []byte +} + +func (k *SenderChainKey) Iteration() uint32 { + return k.iteration +} + +func (k *SenderChainKey) SenderMessageKey() (*SenderMessageKey, error) { + return NewSenderMessageKey(k.iteration, k.getDerivative(messageKeySeed, k.chainKey)) +} + +func (k *SenderChainKey) Next() *SenderChainKey { + return NewSenderChainKey(k.iteration+1, k.getDerivative(chainKeySeed, k.chainKey)) +} + +func (k *SenderChainKey) Seed() []byte { + return k.chainKey +} + +func (k *SenderChainKey) getDerivative(seed []byte, key []byte) []byte { + mac := hmac.New(sha256.New, key[:]) + mac.Write(seed) + + return mac.Sum(nil) +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/groups/ratchet/SenderMessageKey.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/groups/ratchet/SenderMessageKey.go new file mode 100644 index 0000000..724059f --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/groups/ratchet/SenderMessageKey.go @@ -0,0 +1,89 @@ +package ratchet + +import ( + "go.mau.fi/libsignal/kdf" + "go.mau.fi/libsignal/util/bytehelper" +) + +// KdfInfo is optional bytes to include in deriving secrets with KDF. +const KdfInfo string = "WhisperGroup" + +// NewSenderMessageKey will return a new sender message key using the given +// iteration and seed. +func NewSenderMessageKey(iteration uint32, seed []byte) (*SenderMessageKey, error) { + derivative, err := kdf.DeriveSecrets(seed, nil, []byte(KdfInfo), 48) + if err != nil { + return nil, err + } + + // Split our derived secrets into 2 parts + parts := bytehelper.Split(derivative, 16, 32) + + // Build the message key. + senderKeyMessage := &SenderMessageKey{ + iteration: iteration, + seed: seed, + iv: parts[0], + cipherKey: parts[1], + } + + return senderKeyMessage, nil +} + +// NewSenderMessageKeyFromStruct will return a new message key object from the +// given serializeable structure. +func NewSenderMessageKeyFromStruct(structure *SenderMessageKeyStructure) *SenderMessageKey { + return &SenderMessageKey{ + iteration: structure.Iteration, + iv: structure.IV, + cipherKey: structure.CipherKey, + seed: structure.Seed, + } +} + +// NewStructFromSenderMessageKey returns a serializeable structure of message keys. +func NewStructFromSenderMessageKey(key *SenderMessageKey) *SenderMessageKeyStructure { + return &SenderMessageKeyStructure{ + CipherKey: key.cipherKey, + Iteration: key.iteration, + IV: key.iv, + Seed: key.seed, + } +} + +// SenderMessageKeyStructure is a serializeable structure of SenderMessageKeys. +type SenderMessageKeyStructure struct { + Iteration uint32 + IV []byte + CipherKey []byte + Seed []byte +} + +// SenderMessageKey is a structure for sender message keys used in group +// messaging. +type SenderMessageKey struct { + iteration uint32 + iv []byte + cipherKey []byte + seed []byte +} + +// Iteration will return the sender message key's iteration. +func (k *SenderMessageKey) Iteration() uint32 { + return k.iteration +} + +// Iv will return the sender message key's initialization vector. +func (k *SenderMessageKey) Iv() []byte { + return k.iv +} + +// CipherKey will return the key in bytes. +func (k *SenderMessageKey) CipherKey() []byte { + return k.cipherKey +} + +// Seed will return the sender message key's seed. +func (k *SenderMessageKey) Seed() []byte { + return k.seed +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/groups/state/record/Doc.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/groups/state/record/Doc.go new file mode 100644 index 0000000..5a7d730 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/groups/state/record/Doc.go @@ -0,0 +1,2 @@ +// Package record provides the state and record of a group session. +package record diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/groups/state/record/SenderKeyRecord.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/groups/state/record/SenderKeyRecord.go new file mode 100644 index 0000000..64d5906 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/groups/state/record/SenderKeyRecord.go @@ -0,0 +1,149 @@ +package record + +import ( + "fmt" + + "go.mau.fi/libsignal/ecc" + "go.mau.fi/libsignal/signalerror" +) + +const maxStates = 5 + +// SenderKeySerializer is an interface for serializing and deserializing +// SenderKey objects into bytes. An implementation of this interface should be +// used to encode/decode the object into JSON, Protobuffers, etc. +type SenderKeySerializer interface { + Serialize(preKey *SenderKeyStructure) []byte + Deserialize(serialized []byte) (*SenderKeyStructure, error) +} + +// NewSenderKeyFromBytes will return a prekey record from the given bytes using the given serializer. +func NewSenderKeyFromBytes(serialized []byte, serializer SenderKeySerializer, + stateSerializer SenderKeyStateSerializer) (*SenderKey, error) { + + // Use the given serializer to decode the senderkey record + senderKeyStructure, err := serializer.Deserialize(serialized) + if err != nil { + return nil, err + } + + return NewSenderKeyFromStruct(senderKeyStructure, serializer, stateSerializer) +} + +// NewSenderKeyFromStruct returns a SenderKey record using the given serializable structure. +func NewSenderKeyFromStruct(structure *SenderKeyStructure, serializer SenderKeySerializer, + stateSerializer SenderKeyStateSerializer) (*SenderKey, error) { + + // Build our sender key states from structure. + senderKeyStates := make([]*SenderKeyState, len(structure.SenderKeyStates)) + for i := range structure.SenderKeyStates { + var err error + senderKeyStates[i], err = NewSenderKeyStateFromStructure(structure.SenderKeyStates[i], stateSerializer) + if err != nil { + return nil, err + } + } + + // Build and return our session. + senderKey := &SenderKey{ + senderKeyStates: senderKeyStates, + serializer: serializer, + } + + return senderKey, nil + +} + +// NewSenderKey record returns a new sender key record that can +// be stored in a SenderKeyStore. +func NewSenderKey(serializer SenderKeySerializer, + stateSerializer SenderKeyStateSerializer) *SenderKey { + + return &SenderKey{ + senderKeyStates: []*SenderKeyState{}, + serializer: serializer, + stateSerializer: stateSerializer, + } +} + +// SenderKeyStructure is a structure for serializing SenderKey records. +type SenderKeyStructure struct { + SenderKeyStates []*SenderKeyStateStructure +} + +// SenderKey record is a structure for storing pre keys inside +// a SenderKeyStore. +type SenderKey struct { + senderKeyStates []*SenderKeyState + serializer SenderKeySerializer + stateSerializer SenderKeyStateSerializer +} + +// SenderKeyState will return the first sender key state in the record's +// list of sender key states. +func (k *SenderKey) SenderKeyState() (*SenderKeyState, error) { + if len(k.senderKeyStates) > 0 { + return k.senderKeyStates[0], nil + } + return nil, signalerror.ErrNoSenderKeyStatesInRecord +} + +// GetSenderKeyStateByID will return the sender key state with the given +// key id. +func (k *SenderKey) GetSenderKeyStateByID(keyID uint32) (*SenderKeyState, error) { + for i := 0; i < len(k.senderKeyStates); i++ { + if k.senderKeyStates[i].KeyID() == keyID { + return k.senderKeyStates[i], nil + } + } + + return nil, fmt.Errorf("%w %d", signalerror.ErrNoSenderKeyStateForID, keyID) +} + +// IsEmpty will return false if there is more than one state in this +// senderkey record. +func (k *SenderKey) IsEmpty() bool { + return len(k.senderKeyStates) == 0 +} + +// AddSenderKeyState will add a new state to this senderkey record with the given +// id, iteration, chainkey, and signature key. +func (k *SenderKey) AddSenderKeyState(id uint32, iteration uint32, + chainKey []byte, signatureKey ecc.ECPublicKeyable) { + + newState := NewSenderKeyStateFromPublicKey(id, iteration, chainKey, signatureKey, k.stateSerializer) + k.senderKeyStates = append([]*SenderKeyState{newState}, k.senderKeyStates...) + + if len(k.senderKeyStates) > maxStates { + k.senderKeyStates = k.senderKeyStates[:len(k.senderKeyStates)-1] + } +} + +// SetSenderKeyState will replace the current senderkey states with the given +// senderkey state. +func (k *SenderKey) SetSenderKeyState(id uint32, iteration uint32, + chainKey []byte, signatureKey *ecc.ECKeyPair) { + + newState := NewSenderKeyState(id, iteration, chainKey, signatureKey, k.stateSerializer) + k.senderKeyStates = make([]*SenderKeyState, 0, maxStates/2) + k.senderKeyStates = append(k.senderKeyStates, newState) +} + +// Serialize will return the record as serialized bytes so it can be +// persistently stored. +func (k *SenderKey) Serialize() []byte { + return k.serializer.Serialize(k.Structure()) +} + +// Structure will return a simple serializable record structure. +// This is used for serialization to persistently +// store a session record. +func (k *SenderKey) Structure() *SenderKeyStructure { + senderKeyStates := make([]*SenderKeyStateStructure, len(k.senderKeyStates)) + for i := range k.senderKeyStates { + senderKeyStates[i] = k.senderKeyStates[i].structure() + } + return &SenderKeyStructure{ + SenderKeyStates: senderKeyStates, + } +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/groups/state/record/SenderKeyState.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/groups/state/record/SenderKeyState.go new file mode 100644 index 0000000..e3187c3 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/groups/state/record/SenderKeyState.go @@ -0,0 +1,186 @@ +package record + +import ( + "go.mau.fi/libsignal/ecc" + "go.mau.fi/libsignal/groups/ratchet" + "go.mau.fi/libsignal/util/bytehelper" +) + +const maxMessageKeys = 2000 + +// SenderKeyStateSerializer is an interface for serializing and deserializing +// a Signal State into bytes. An implementation of this interface should be +// used to encode/decode the object into JSON, Protobuffers, etc. +type SenderKeyStateSerializer interface { + Serialize(state *SenderKeyStateStructure) []byte + Deserialize(serialized []byte) (*SenderKeyStateStructure, error) +} + +// NewSenderKeyStateFromBytes will return a Signal State from the given +// bytes using the given serializer. +func NewSenderKeyStateFromBytes(serialized []byte, serializer SenderKeyStateSerializer) (*SenderKeyState, error) { + // Use the given serializer to decode the signal message. + stateStructure, err := serializer.Deserialize(serialized) + if err != nil { + return nil, err + } + + return NewSenderKeyStateFromStructure(stateStructure, serializer) +} + +// NewSenderKeyState returns a new SenderKeyState. +func NewSenderKeyState(keyID uint32, iteration uint32, chainKey []byte, + signatureKey *ecc.ECKeyPair, serializer SenderKeyStateSerializer) *SenderKeyState { + + return &SenderKeyState{ + keys: make([]*ratchet.SenderMessageKey, 0, maxMessageKeys/2), + keyID: keyID, + senderChainKey: ratchet.NewSenderChainKey(iteration, chainKey), + signingKeyPair: signatureKey, + serializer: serializer, + } +} + +// NewSenderKeyStateFromPublicKey returns a new SenderKeyState with the given publicKey. +func NewSenderKeyStateFromPublicKey(keyID uint32, iteration uint32, chainKey []byte, + signatureKey ecc.ECPublicKeyable, serializer SenderKeyStateSerializer) *SenderKeyState { + + keyPair := ecc.NewECKeyPair(signatureKey, nil) + + return &SenderKeyState{ + keys: make([]*ratchet.SenderMessageKey, 0, maxMessageKeys/2), + keyID: keyID, + senderChainKey: ratchet.NewSenderChainKey(iteration, chainKey), + signingKeyPair: keyPair, + serializer: serializer, + } +} + +// NewSenderKeyStateFromStructure will return a new session state with the +// given state structure. This structure is given back from an +// implementation of the sender key state serializer. +func NewSenderKeyStateFromStructure(structure *SenderKeyStateStructure, + serializer SenderKeyStateSerializer) (*SenderKeyState, error) { + + // Convert our ecc keys from bytes into object form. + signingKeyPublic, err := ecc.DecodePoint(structure.SigningKeyPublic, 0) + if err != nil { + return nil, err + } + signingKeyPrivate := ecc.NewDjbECPrivateKey(bytehelper.SliceToArray(structure.SigningKeyPrivate)) + + // Build our sender message keys from structure + senderMessageKeys := make([]*ratchet.SenderMessageKey, len(structure.Keys)) + for i := range structure.Keys { + senderMessageKeys[i] = ratchet.NewSenderMessageKeyFromStruct(structure.Keys[i]) + } + + // Build our state object. + state := &SenderKeyState{ + keys: senderMessageKeys, + keyID: structure.KeyID, + senderChainKey: ratchet.NewSenderChainKeyFromStruct(structure.SenderChainKey), + signingKeyPair: ecc.NewECKeyPair(signingKeyPublic, signingKeyPrivate), + serializer: serializer, + } + + return state, nil +} + +// SenderKeyStateStructure is a serializeable structure of SenderKeyState. +type SenderKeyStateStructure struct { + Keys []*ratchet.SenderMessageKeyStructure + KeyID uint32 + SenderChainKey *ratchet.SenderChainKeyStructure + SigningKeyPrivate []byte + SigningKeyPublic []byte +} + +// SenderKeyState is a structure for maintaining a senderkey session state. +type SenderKeyState struct { + keys []*ratchet.SenderMessageKey + keyID uint32 + senderChainKey *ratchet.SenderChainKey + signingKeyPair *ecc.ECKeyPair + serializer SenderKeyStateSerializer +} + +// SigningKey returns the signing key pair of the sender key state. +func (k *SenderKeyState) SigningKey() *ecc.ECKeyPair { + return k.signingKeyPair +} + +// SenderChainKey returns the sender chain key of the state. +func (k *SenderKeyState) SenderChainKey() *ratchet.SenderChainKey { + return k.senderChainKey +} + +// KeyID returns the state's key id. +func (k *SenderKeyState) KeyID() uint32 { + return k.keyID +} + +// HasSenderMessageKey will return true if the state has a key with the +// given iteration. +func (k *SenderKeyState) HasSenderMessageKey(iteration uint32) bool { + for i := 0; i < len(k.keys); i++ { + if k.keys[i].Iteration() == iteration { + return true + } + } + return false +} + +// AddSenderMessageKey will add the given sender message key to the state. +func (k *SenderKeyState) AddSenderMessageKey(senderMsgKey *ratchet.SenderMessageKey) { + k.keys = append(k.keys, senderMsgKey) + + if len(k.keys) > maxMessageKeys { + k.keys = k.keys[1:] + } +} + +// SetSenderChainKey will set the state's sender chain key with the given key. +func (k *SenderKeyState) SetSenderChainKey(senderChainKey *ratchet.SenderChainKey) { + k.senderChainKey = senderChainKey +} + +// RemoveSenderMessageKey will remove the key in this state with the given iteration number. +func (k *SenderKeyState) RemoveSenderMessageKey(iteration uint32) *ratchet.SenderMessageKey { + for i := 0; i < len(k.keys); i++ { + if k.keys[i].Iteration() == iteration { + removed := k.keys[i] + k.keys = append(k.keys[0:i], k.keys[i+1:]...) + return removed + } + } + + return nil +} + +// Serialize will return the state as bytes using the given serializer. +func (k *SenderKeyState) Serialize() []byte { + return k.serializer.Serialize(k.structure()) +} + +// structure will return a serializable structure of the +// the given state so it can be persistently stored. +func (k *SenderKeyState) structure() *SenderKeyStateStructure { + // Convert our sender message keys into a serializeable structure + keys := make([]*ratchet.SenderMessageKeyStructure, len(k.keys)) + for i := range k.keys { + keys[i] = ratchet.NewStructFromSenderMessageKey(k.keys[i]) + } + + // Build and return our state structure. + s := &SenderKeyStateStructure{ + Keys: keys, + KeyID: k.keyID, + SenderChainKey: ratchet.NewStructFromSenderChainKey(k.senderChainKey), + SigningKeyPublic: k.signingKeyPair.PublicKey().Serialize(), + } + if k.signingKeyPair.PrivateKey() != nil { + s.SigningKeyPrivate = bytehelper.ArrayToSlice(k.signingKeyPair.PrivateKey().Serialize()) + } + return s +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/groups/state/store/Doc.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/groups/state/store/Doc.go new file mode 100644 index 0000000..8a23b44 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/groups/state/store/Doc.go @@ -0,0 +1,3 @@ +// Package store provides the storage interfaces for storing group sender +// key records. +package store diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/groups/state/store/SenderKeyStore.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/groups/state/store/SenderKeyStore.go new file mode 100644 index 0000000..a068df7 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/groups/state/store/SenderKeyStore.go @@ -0,0 +1,11 @@ +package store + +import ( + "go.mau.fi/libsignal/groups/state/record" + "go.mau.fi/libsignal/protocol" +) + +type SenderKey interface { + StoreSenderKey(senderKeyName *protocol.SenderKeyName, keyRecord *record.SenderKey) + LoadSenderKey(senderKeyName *protocol.SenderKeyName) *record.SenderKey +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/kdf/HKDF.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/kdf/HKDF.go new file mode 100644 index 0000000..168b18a --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/kdf/HKDF.go @@ -0,0 +1,47 @@ +// Package kdf provides a key derivation function to calculate key output +// and negotiate shared secrets for curve X25519 keys. +package kdf + +import ( + "crypto/sha256" + "io" + + "golang.org/x/crypto/curve25519" + "golang.org/x/crypto/hkdf" +) + +// HKDF is a hashed key derivation function type that can be used to derive keys. +type HKDF func(inputKeyMaterial, salt, info []byte, outputLength int) ([]byte, error) + +// DeriveSecrets derives the requested number of bytes using HKDF with the given +// input, salt, and info. +func DeriveSecrets(inputKeyMaterial, salt, info []byte, outputLength int) ([]byte, error) { + kdf := hkdf.New(sha256.New, inputKeyMaterial, salt, info) + + secrets := make([]byte, outputLength) + length, err := io.ReadFull(kdf, secrets) + if err != nil { + return nil, err + } + if length != outputLength { + return nil, err + } + + return secrets, nil +} + +// CalculateSharedSecret uses DH Curve25519 to find a shared secret. The result of this function +// should be used in `DeriveSecrets` to output the Root and Chain keys. +func CalculateSharedSecret(theirKey, ourKey [32]byte) [32]byte { + var sharedSecret [32]byte + curve25519.ScalarMult(&sharedSecret, &ourKey, &theirKey) + + return sharedSecret +} + +// KeyMaterial is a structure for representing a cipherkey, mac, and iv +type KeyMaterial struct { + CipherKey []byte + MacKey []byte + IV []byte +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/keys/chain/ChainKey.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/keys/chain/ChainKey.go new file mode 100644 index 0000000..0a5125d --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/keys/chain/ChainKey.go @@ -0,0 +1,127 @@ +// Package chain provides chain keys used in double ratchet sessions. +package chain + +import ( + "crypto/hmac" + "crypto/sha256" + "go.mau.fi/libsignal/kdf" + "go.mau.fi/libsignal/keys/message" +) + +var messageKeySeed = []byte{0x01} +var chainKeySeed = []byte{0x02} + +// NewKey returns a new chain key with the given kdf, key, and index +func NewKey(kdf kdf.HKDF, key []byte, index uint32) *Key { + chainKey := Key{ + kdf: kdf, + key: key, + index: index, + } + + return &chainKey +} + +// NewKeyFromStruct will return a chain key built from the given structure. +func NewKeyFromStruct(structure *KeyStructure, kdf kdf.HKDF) *Key { + return NewKey( + kdf, + structure.Key, + structure.Index, + ) +} + +// NewStructFromKey will return a chain key structure for serialization. +func NewStructFromKey(key *Key) *KeyStructure { + return &KeyStructure{ + Key: key.key, + Index: key.index, + } +} + +// KeyStructure is a serializeable structure for chain keys. +type KeyStructure struct { + Key []byte + Index uint32 +} + +// Key is used for generating message keys. This key "ratchets" every time a +// message key is generated. Every time the chain key ratchets forward, its index +// increases by one. +type Key struct { + kdf kdf.HKDF + key []byte + index uint32 // Index's maximum size: 4,294,967,295 +} + +// Current returns the current ChainKey struct. +func (c *Key) Current() *Key { + return c +} + +// Key returns the ChainKey's key material. +func (c *Key) Key() []byte { + return c.key +} + +// SetKey will set the ChainKey's key material. +func (c *Key) SetKey(key []byte) { + c.key = key +} + +// Index returns how many times the ChainKey has been "ratcheted" forward. +func (c *Key) Index() uint32 { + return c.index +} + +// SetIndex sets how many times the ChainKey has been "ratcheted" forward. +func (c *Key) SetIndex(index uint32) { + c.index = index +} + +// NextKey uses the key derivation function to generate a new ChainKey. +func (c *Key) NextKey() *Key { + nextKey := c.BaseMaterial(chainKeySeed) + return NewKey(c.kdf, nextKey, c.index+1) +} + +// MessageKeys returns message keys, which includes the cipherkey, mac, iv, and index. +func (c *Key) MessageKeys() *message.Keys { + inputKeyMaterial := c.BaseMaterial(messageKeySeed) + keyMaterialBytes, _ := c.kdf(inputKeyMaterial, nil, []byte(message.KdfSalt), message.DerivedSecretsSize) + keyMaterial := newKeyMaterial(keyMaterialBytes) + + // Use the key material returned from the key derivation function for our cipherkey, mac, and iv. + messageKeys := message.NewKeys( + keyMaterial.CipherKey, // Use the first 32 bytes of the key material for the CipherKey + keyMaterial.MacKey, // Use bytes 32-64 of the key material for the MacKey + keyMaterial.IV, // Use the last 16 bytes for the IV. + c.Index(), // Attach the chain key's index to the message keys. + ) + + return messageKeys +} + +// BaseMaterial uses hmac to derive the base material used in the key derivation function for a new key. +func (c *Key) BaseMaterial(seed []byte) []byte { + mac := hmac.New(sha256.New, c.key[:]) + mac.Write(seed) + + return mac.Sum(nil) +} + +// NewKeyMaterial takes an 80-byte slice derived from a key derivation function and splits +// it into the cipherkey, mac, and iv. +func newKeyMaterial(keyMaterialBytes []byte) *kdf.KeyMaterial { + cipherKey := keyMaterialBytes[:32] // Use the first 32 bytes of the key material for the CipherKey + macKey := keyMaterialBytes[32:64] // Use bytes 32-64 of the key material for the MacKey + iv := keyMaterialBytes[64:80] // Use the last 16 bytes for the IV. + + keyMaterial := kdf.KeyMaterial{ + CipherKey: cipherKey, + MacKey: macKey, + IV: iv, + } + + return &keyMaterial +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/keys/identity/IdentityKey.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/keys/identity/IdentityKey.go new file mode 100644 index 0000000..127dbe1 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/keys/identity/IdentityKey.go @@ -0,0 +1,47 @@ +// Package identity provides identity keys used for verifying the identity +// of a signal user. +package identity + +import ( + "encoding/hex" + "go.mau.fi/libsignal/ecc" +) + +// NewKey generates a new IdentityKey from an ECPublicKey +func NewKey(publicKey ecc.ECPublicKeyable) *Key { + identityKey := Key{ + publicKey: publicKey, + } + + return &identityKey +} + +// NewKeyFromBytes generates a new IdentityKey from public key bytes +func NewKeyFromBytes(publicKey [32]byte, offset int) Key { + identityKey := Key{ + publicKey: ecc.NewDjbECPublicKey(publicKey), + } + + return identityKey +} + +// Key is a structure for representing an identity key. This same structure can +// be used for verifying recipient's identity key or storing our own identity key. +type Key struct { + publicKey ecc.ECPublicKeyable +} + +// Fingerprint gets the string fingerprint representation of the public key. +func (k *Key) Fingerprint() string { + return hex.EncodeToString(k.publicKey.Serialize()) +} + +// PublicKey returns the EC Public key of the identity key +func (k *Key) PublicKey() ecc.ECPublicKeyable { + return k.publicKey +} + +// Serialize returns the serialized version of the key +func (k *Key) Serialize() []byte { + return k.publicKey.Serialize() +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/keys/identity/IdentityKeyPair.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/keys/identity/IdentityKeyPair.go new file mode 100644 index 0000000..1d40111 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/keys/identity/IdentityKeyPair.go @@ -0,0 +1,39 @@ +package identity + +import ( + "go.mau.fi/libsignal/ecc" +) + +// NewKeyPair returns a new identity key with the given public and private keys. +func NewKeyPair(publicKey *Key, privateKey ecc.ECPrivateKeyable) *KeyPair { + keyPair := KeyPair{ + publicKey: publicKey, + privateKey: privateKey, + } + + return &keyPair +} + +// NewKeyPairFromBytes returns a new identity key from the given serialized bytes. +//func NewKeyPairFromBytes(serialized []byte) KeyPair { +//} + +// KeyPair is a holder for public and private identity key pair. +type KeyPair struct { + publicKey *Key + privateKey ecc.ECPrivateKeyable +} + +// PublicKey returns the identity key's public key. +func (k *KeyPair) PublicKey() *Key { + return k.publicKey +} + +// PrivateKey returns the identity key's private key. +func (k *KeyPair) PrivateKey() ecc.ECPrivateKeyable { + return k.privateKey +} + +// Serialize returns a byte array that represents the keypair. +//func (k *KeyPair) Serialize() []byte { +//} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/keys/message/MessageKey.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/keys/message/MessageKey.go new file mode 100644 index 0000000..4eadffb --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/keys/message/MessageKey.go @@ -0,0 +1,91 @@ +// Package message provides a structure for message keys, which are symmetric +// keys used for the encryption/decryption of Signal messages. +package message + +// DerivedSecretsSize is the size of the derived secrets for message keys. +const DerivedSecretsSize = 80 + +// CipherKeyLength is the length of the actual cipher key used for messages. +const CipherKeyLength = 32 + +// MacKeyLength is the length of the message authentication code in bytes. +const MacKeyLength = 32 + +// IVLength is the length of the initialization vector in bytes. +const IVLength = 16 + +// KdfSalt is used as the Salt for message keys to derive secrets using a Key Derivation Function +const KdfSalt string = "WhisperMessageKeys" + +// NewKeys returns a new message keys structure with the given cipherKey, mac, iv, and index. +func NewKeys(cipherKey, macKey, iv []byte, index uint32) *Keys { + messageKeys := Keys{ + cipherKey: cipherKey, + macKey: macKey, + iv: iv, + index: index, + } + + return &messageKeys +} + +// NewKeysFromStruct will return a new message keys object from the +// given serializeable structure. +func NewKeysFromStruct(structure *KeysStructure) *Keys { + return NewKeys( + structure.CipherKey, + structure.MacKey, + structure.IV, + structure.Index, + ) +} + +// NewStructFromKeys returns a serializeable structure of message keys. +func NewStructFromKeys(keys *Keys) *KeysStructure { + return &KeysStructure{ + CipherKey: keys.cipherKey, + MacKey: keys.macKey, + IV: keys.iv, + Index: keys.index, + } +} + +// KeysStructure is a serializeable structure of message keys. +type KeysStructure struct { + CipherKey []byte + MacKey []byte + IV []byte + Index uint32 +} + +// Keys is a structure to hold all the keys for a single MessageKey, including the +// cipherKey, mac, iv, and index of the chain key. MessageKeys are used to +// encrypt individual messages. +type Keys struct { + cipherKey []byte + macKey []byte + iv []byte + index uint32 +} + +// CipherKey is the key used to produce ciphertext. +func (k *Keys) CipherKey() []byte { + return k.cipherKey +} + +// MacKey returns the message's message authentication code. +func (k *Keys) MacKey() []byte { + return k.macKey +} + +// Iv returns the message keys' initialization vector. The IV is a fixed-size input +// to a cryptographic primitive. +func (k *Keys) Iv() []byte { + return k.iv +} + +// Index returns the number of times the chain key has been put through a key derivation +// function to generate this message key. +func (k *Keys) Index() uint32 { + return k.index +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/keys/prekey/PreKeyBundle.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/keys/prekey/PreKeyBundle.go new file mode 100644 index 0000000..0447167 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/keys/prekey/PreKeyBundle.go @@ -0,0 +1,86 @@ +// Package prekey provides prekey bundle structures for calculating +// a new Signal session with a user asyncronously. +package prekey + +import ( + "go.mau.fi/libsignal/ecc" + "go.mau.fi/libsignal/keys/identity" + "go.mau.fi/libsignal/util/optional" +) + +// NewBundle returns a Bundle structure that contains a remote PreKey +// and collection of associated items. +func NewBundle(registrationID, deviceID uint32, preKeyID *optional.Uint32, signedPreKeyID uint32, + preKeyPublic, signedPreKeyPublic ecc.ECPublicKeyable, signedPreKeySig [64]byte, + identityKey *identity.Key) *Bundle { + + bundle := Bundle{ + registrationID: registrationID, + deviceID: deviceID, + preKeyID: preKeyID, + preKeyPublic: preKeyPublic, + signedPreKeyID: signedPreKeyID, + signedPreKeyPublic: signedPreKeyPublic, + signedPreKeySignature: signedPreKeySig, + identityKey: identityKey, + } + + return &bundle +} + +// Bundle is a structure that contains a remote PreKey and collection +// of associated items. +type Bundle struct { + registrationID uint32 + deviceID uint32 + preKeyID *optional.Uint32 + preKeyPublic ecc.ECPublicKeyable + signedPreKeyID uint32 + signedPreKeyPublic ecc.ECPublicKeyable + signedPreKeySignature [64]byte + identityKey *identity.Key +} + +// DeviceID returns the device ID this PreKey belongs to. +func (b *Bundle) DeviceID() uint32 { + return b.deviceID +} + +// PreKeyID returns the unique key ID for this PreKey. +func (b *Bundle) PreKeyID() *optional.Uint32 { + return b.preKeyID +} + +// PreKey returns the public key for this PreKey. +func (b *Bundle) PreKey() ecc.ECPublicKeyable { + return b.preKeyPublic +} + +// SignedPreKeyID returns the unique key ID for this +// signed PreKey. +func (b *Bundle) SignedPreKeyID() uint32 { + return b.signedPreKeyID +} + +// SignedPreKey returns the signed PreKey for this +// PreKeyBundle. +func (b *Bundle) SignedPreKey() ecc.ECPublicKeyable { + return b.signedPreKeyPublic +} + +// SignedPreKeySignature returns the signature over the +// signed PreKey. +func (b *Bundle) SignedPreKeySignature() [64]byte { + return b.signedPreKeySignature +} + +// IdentityKey returns the Identity Key of this PreKey's owner. +func (b *Bundle) IdentityKey() *identity.Key { + return b.identityKey +} + +// RegistrationID returns the registration ID associated with +// this PreKey. +func (b *Bundle) RegistrationID() uint32 { + return b.registrationID +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/keys/root/RootKey.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/keys/root/RootKey.go new file mode 100644 index 0000000..e925bc7 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/keys/root/RootKey.go @@ -0,0 +1,66 @@ +// Package root provides root keys which are used to derive new chain and +// root keys in a ratcheting session. +package root + +import ( + "go.mau.fi/libsignal/ecc" + "go.mau.fi/libsignal/kdf" + "go.mau.fi/libsignal/keys/chain" + "go.mau.fi/libsignal/keys/session" +) + +// DerivedSecretsSize is the size of the derived secrets for root keys. +const DerivedSecretsSize = 64 + +// KdfInfo is used as the info for message keys to derive secrets using a Key Derivation Function +const KdfInfo string = "WhisperRatchet" + +// NewKey returns a new RootKey given the key derivation function and bytes. +func NewKey(kdf kdf.HKDF, key []byte) *Key { + rootKey := Key{ + kdf: kdf, + key: key, + } + + return &rootKey +} + +// Key is a structure for RootKeys, which are used to derive a new set of chain and root +// keys for every round trip of messages. +type Key struct { + kdf kdf.HKDF + key []byte +} + +// Bytes returns the RootKey in bytes. +func (k *Key) Bytes() []byte { + return k.key +} + +// CreateChain creates a new RootKey and ChainKey from the recipient's ratchet key and our private key. +func (k *Key) CreateChain(theirRatchetKey ecc.ECPublicKeyable, ourRatchetKey *ecc.ECKeyPair) (*session.KeyPair, error) { + theirPublicKey := theirRatchetKey.PublicKey() + ourPrivateKey := ourRatchetKey.PrivateKey().Serialize() + + // Use our key derivation function to calculate a shared secret. + sharedSecret := kdf.CalculateSharedSecret(theirPublicKey, ourPrivateKey) + derivedSecretBytes, err := kdf.DeriveSecrets(sharedSecret[:], k.key, []byte(KdfInfo), DerivedSecretsSize) + if err != nil { + return nil, err + } + + // Split the derived secret bytes in half, using one half for the root key and the second for the chain key. + derivedSecrets := session.NewDerivedSecrets(derivedSecretBytes) + + // Create new root and chain key structures from the derived secrets. + rootKey := NewKey(k.kdf, derivedSecrets.RootKey()) + chainKey := chain.NewKey(k.kdf, derivedSecrets.ChainKey(), 0) + + // Create a session keypair with the generated root and chain keys. + keyPair := session.NewKeyPair( + rootKey, + chainKey, + ) + + return keyPair, nil +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/keys/session/DerivedSecrets.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/keys/session/DerivedSecrets.go new file mode 100644 index 0000000..6d73cb4 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/keys/session/DerivedSecrets.go @@ -0,0 +1,29 @@ +package session + +// NewDerivedSecrets returns a new RootKey/ChainKey pair from 64 bytes of key material +// generated by the key derivation function. +func NewDerivedSecrets(keyMaterial []byte) *DerivedSecrets { + secrets := DerivedSecrets{ + keyMaterial[:32], + keyMaterial[32:], + } + + return &secrets +} + +// DerivedSecrets is a structure for holding the derived secrets for the +// Root and Chain keys for a session. +type DerivedSecrets struct { + rootKey []byte + chainKey []byte +} + +// RootKey returns the RootKey bytes. +func (d *DerivedSecrets) RootKey() []byte { + return d.rootKey +} + +// ChainKey returns the ChainKey bytes. +func (d *DerivedSecrets) ChainKey() []byte { + return d.chainKey +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/keys/session/Pair.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/keys/session/Pair.go new file mode 100644 index 0000000..f6387ba --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/keys/session/Pair.go @@ -0,0 +1,43 @@ +// Package session provides a simple structure for session keys, which is +// a pair of root and chain keys for a session. +package session + +import ( + "go.mau.fi/libsignal/ecc" + "go.mau.fi/libsignal/keys/chain" + "go.mau.fi/libsignal/keys/message" +) + +// RootKeyable is an interface for all root key implementations that are part of +// a session keypair. +type RootKeyable interface { + Bytes() []byte + CreateChain(theirRatchetKey ecc.ECPublicKeyable, ourRatchetKey *ecc.ECKeyPair) (*KeyPair, error) +} + +// ChainKeyable is an interface for all chain key implementations that are part of +// a session keypair. +type ChainKeyable interface { + Key() []byte + Index() uint32 + NextKey() *chain.Key + MessageKeys() *message.Keys + Current() *chain.Key +} + +// NewKeyPair returns a new session key pair that holds a root and chain key. +func NewKeyPair(rootKey RootKeyable, chainKey ChainKeyable) *KeyPair { + keyPair := KeyPair{ + RootKey: rootKey, + ChainKey: chainKey, + } + + return &keyPair +} + +// KeyPair is a session key pair that holds a single root and chain key pair. These +// keys are ratcheted after every message sent and every message round trip. +type KeyPair struct { + RootKey RootKeyable + ChainKey ChainKeyable +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/logger/DefaultLogger.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/logger/DefaultLogger.go new file mode 100644 index 0000000..62515bf --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/logger/DefaultLogger.go @@ -0,0 +1,85 @@ +package logger + +import ( + "fmt" + "strings" + "time" +) + +// DefaultLogger is used if no logger has been set up. +type defaultLogger struct { + namespaces []string +} + +// log simply logs the given message to stdout if the message +// caller is allowed to log. +func (d *defaultLogger) log(level, caller, msg string) { + if !d.shouldLog(caller) { + // return + } + t := time.Now() + fmt.Println( + "["+level+"]", + t.Format(time.RFC3339), + caller, + "â–¶ ", + msg, + ) +} + +// shouldLog determines whether or not the given caller should +// be allowed to log messages. +func (d *defaultLogger) shouldLog(caller string) bool { + shouldLog := false + d.ensureNamespaces() + for _, namespace := range d.namespaces { + if namespace == "all" { + shouldLog = true + } + if strings.Contains(caller, namespace) { + shouldLog = true + } + } + + return shouldLog +} + +// ensureNamespaces checks to see if our list of loggable namespaces +// has been initialized or not. If not, it defaults to log all. +func (d *defaultLogger) ensureNamespaces() { + if d.namespaces == nil { + d.namespaces = []string{"all"} + } +} + +// Debug is used to log debug messages. +func (d *defaultLogger) Debug(caller, msg string) { + //d.log("DEBUG", caller, msg) +} + +// Info is used to log info messages. +func (d *defaultLogger) Info(caller, msg string) { + d.log("INFO", caller, msg) +} + +// Warning is used to log warning messages. +func (d *defaultLogger) Warning(caller, msg string) { + d.log("WARNING", caller, msg) +} + +// Error is used to log error messages. +func (d *defaultLogger) Error(caller, msg string) { + d.log("ERROR", caller, msg) +} + +// Configure takes a configuration string separated by commas +// that contains all the callers that should be logged. This +// allows granular logging of different go files. +// +// Example: +// logger.Configure("RootKey.go,Curve.go") +// logger.Configure("all") +// +func (d *defaultLogger) Configure(settings string) { + d.namespaces = strings.Split(settings, ",") +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/logger/Logger.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/logger/Logger.go new file mode 100644 index 0000000..653320b --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/logger/Logger.go @@ -0,0 +1,89 @@ +// Package logger provides optional debug logging of the Signal library. +package logger + +import ( + "fmt" + "runtime" + "strconv" + "strings" +) + +// Logger is a shared loggable interface that this library will use for all log messages. +var Logger Loggable + +// Loggable is an interface for logging. +type Loggable interface { + Debug(caller, message string) + Info(caller, message string) + Warning(caller, message string) + Error(caller, message string) + Configure(settings string) +} + +// Setup will configure the shared logger to use the provided logger. +func Setup(logger *Loggable) { + Logger = *logger +} + +// ToString converts an arbitrary number of objects to a string for use in a logger. +func toString(a ...interface{}) string { + return fmt.Sprint(a...) +} + +// EnsureLogger will use the default logger if one was not set up. +func ensureLogger() { + if Logger == nil { + // fmt.Println("Error: No logger was configured. Use `logger.Setup` to configure a logger.") + Logger = &defaultLogger{} + } +} + +// GetCaller gets the go file name and line number that the logger was called from. +func getCaller() string { + var file string + _, path, line, _ := runtime.Caller(2) + paths := strings.Split(path, "/") + if len(paths) > 0 { + file = paths[len(paths)-1] + } else { + file = "<unkn>" + } + + return file + ":" + strconv.Itoa(line) +} + +/* + * Go methods used by the library for logging. + */ + +// Debug prints debug level logs. +func Debug(msg ...interface{}) { + ensureLogger() + Logger.Debug(getCaller(), toString(msg...)) +} + +// Info prints info level logs. +func Info(msg ...interface{}) { + ensureLogger() + Logger.Info(getCaller(), toString(msg...)) +} + +// Warning prints warning level logs. +func Warning(msg ...interface{}) { + ensureLogger() + Logger.Warning(getCaller(), toString(msg...)) +} + +// Error prints error level logs. +func Error(msg ...interface{}) { + ensureLogger() + Logger.Error(getCaller(), toString(msg...)) +} + +// Configure allows arbitrary logger configuration settings. The +// default logger uses this method to configure what Go files +// are allowed to log. +func Configure(settings string) { + ensureLogger() + Logger.Configure(settings) +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/protocol/CiphertextMessage.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/protocol/CiphertextMessage.go new file mode 100644 index 0000000..c8bd759 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/protocol/CiphertextMessage.go @@ -0,0 +1,19 @@ +package protocol + +type CiphertextMessage interface { + Serialize() []byte + Type() uint32 +} + +type GroupCiphertextMessage interface { + CiphertextMessage + SignedSerialize() []byte +} + +const UnsupportedVersion = 1 +const CurrentVersion = 3 + +const WHISPER_TYPE = 2 +const PREKEY_TYPE = 3 +const SENDERKEY_TYPE = 4 +const SENDERKEY_DISTRIBUTION_TYPE = 5 diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/protocol/Doc.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/protocol/Doc.go new file mode 100644 index 0000000..3486bdf --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/protocol/Doc.go @@ -0,0 +1,3 @@ +// Package protocol provides address, group, and message structures that +// the Signal protocol uses for sending encrypted messages. +package protocol diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/protocol/PreKeySignalMessage.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/protocol/PreKeySignalMessage.go new file mode 100644 index 0000000..841d9d1 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/protocol/PreKeySignalMessage.go @@ -0,0 +1,152 @@ +package protocol + +import ( + "fmt" + + "go.mau.fi/libsignal/ecc" + "go.mau.fi/libsignal/keys/identity" + "go.mau.fi/libsignal/signalerror" + "go.mau.fi/libsignal/util/optional" +) + +// PreKeySignalMessageSerializer is an interface for serializing and deserializing +// PreKeySignalMessages into bytes. An implementation of this interface should be +// used to encode/decode the object into JSON, Protobuffers, etc. +type PreKeySignalMessageSerializer interface { + Serialize(signalMessage *PreKeySignalMessageStructure) []byte + Deserialize(serialized []byte) (*PreKeySignalMessageStructure, error) +} + +// NewPreKeySignalMessageFromBytes will return a Signal Ciphertext message from the given +// bytes using the given serializer. +func NewPreKeySignalMessageFromBytes(serialized []byte, serializer PreKeySignalMessageSerializer, + msgSerializer SignalMessageSerializer) (*PreKeySignalMessage, error) { + // Use the given serializer to decode the signal message. + signalMessageStructure, err := serializer.Deserialize(serialized) + if err != nil { + return nil, err + } + + return NewPreKeySignalMessageFromStruct(signalMessageStructure, serializer, msgSerializer) +} + +// NewPreKeySignalMessageFromStruct will return a new PreKeySignalMessage from the given +// PreKeySignalMessageStructure. +func NewPreKeySignalMessageFromStruct(structure *PreKeySignalMessageStructure, + serializer PreKeySignalMessageSerializer, msgSerializer SignalMessageSerializer) (*PreKeySignalMessage, error) { + + // Throw an error if the given message structure is an unsupported version. + if structure.Version <= UnsupportedVersion { + return nil, fmt.Errorf("%w %d (prekey message)", signalerror.ErrOldMessageVersion, structure.Version) + } + + // Throw an error if the given message structure is a future version. + if structure.Version > CurrentVersion { + return nil, fmt.Errorf("%w %d (prekey message)", signalerror.ErrUnknownMessageVersion, structure.Version) + } + + // Throw an error if the structure is missing critical fields. + if structure.BaseKey == nil || structure.IdentityKey == nil || structure.Message == nil { + return nil, fmt.Errorf("%w (prekey message)", signalerror.ErrIncompleteMessage) + } + + // Create the signal message object from the structure. + preKeyWhisperMessage := &PreKeySignalMessage{structure: *structure, serializer: serializer} + + // Generate the base ECC key from bytes. + var err error + preKeyWhisperMessage.baseKey, err = ecc.DecodePoint(structure.BaseKey, 0) + if err != nil { + return nil, err + } + + // Generate the identity key from bytes + var identityKey ecc.ECPublicKeyable + identityKey, err = ecc.DecodePoint(structure.IdentityKey, 0) + if err != nil { + return nil, err + } + preKeyWhisperMessage.identityKey = identity.NewKey(identityKey) + + // Generate the SignalMessage object from bytes. + preKeyWhisperMessage.message, err = NewSignalMessageFromBytes(structure.Message, msgSerializer) + if err != nil { + return nil, err + } + + return preKeyWhisperMessage, nil +} + +// NewPreKeySignalMessage will return a new PreKeySignalMessage object. +func NewPreKeySignalMessage(version int, registrationID uint32, preKeyID *optional.Uint32, signedPreKeyID uint32, + baseKey ecc.ECPublicKeyable, identityKey *identity.Key, message *SignalMessage, serializer PreKeySignalMessageSerializer, + msgSerializer SignalMessageSerializer) (*PreKeySignalMessage, error) { + structure := &PreKeySignalMessageStructure{ + Version: version, + RegistrationID: registrationID, + PreKeyID: preKeyID, + SignedPreKeyID: signedPreKeyID, + BaseKey: baseKey.Serialize(), + IdentityKey: identityKey.PublicKey().Serialize(), + Message: message.Serialize(), + } + return NewPreKeySignalMessageFromStruct(structure, serializer, msgSerializer) +} + +// PreKeySignalMessageStructure is a serializable structure for +// PreKeySignalMessages. +type PreKeySignalMessageStructure struct { + RegistrationID uint32 + PreKeyID *optional.Uint32 + SignedPreKeyID uint32 + BaseKey []byte + IdentityKey []byte + Message []byte + Version int +} + +// PreKeySignalMessage is an encrypted Signal message that is designed +// to be used when building a session with someone for the first time. +type PreKeySignalMessage struct { + structure PreKeySignalMessageStructure + baseKey ecc.ECPublicKeyable + identityKey *identity.Key + message *SignalMessage + serializer PreKeySignalMessageSerializer +} + +func (p *PreKeySignalMessage) MessageVersion() int { + return p.structure.Version +} + +func (p *PreKeySignalMessage) IdentityKey() *identity.Key { + return p.identityKey +} + +func (p *PreKeySignalMessage) RegistrationID() uint32 { + return p.structure.RegistrationID +} + +func (p *PreKeySignalMessage) PreKeyID() *optional.Uint32 { + return p.structure.PreKeyID +} + +func (p *PreKeySignalMessage) SignedPreKeyID() uint32 { + return p.structure.SignedPreKeyID +} + +func (p *PreKeySignalMessage) BaseKey() ecc.ECPublicKeyable { + return p.baseKey +} + +func (p *PreKeySignalMessage) WhisperMessage() *SignalMessage { + return p.message +} + +func (p *PreKeySignalMessage) Serialize() []byte { + return p.serializer.Serialize(&p.structure) +} + +func (p *PreKeySignalMessage) Type() uint32 { + return PREKEY_TYPE +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/protocol/SenderKeyDistributionMessage.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/protocol/SenderKeyDistributionMessage.go new file mode 100644 index 0000000..55adced --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/protocol/SenderKeyDistributionMessage.go @@ -0,0 +1,147 @@ +package protocol + +import ( + "fmt" + + "go.mau.fi/libsignal/ecc" + "go.mau.fi/libsignal/signalerror" +) + +// SenderKeyDistributionMessageSerializer is an interface for serializing and deserializing +// SenderKeyDistributionMessages into bytes. An implementation of this interface should be +// used to encode/decode the object into JSON, Protobuffers, etc. +type SenderKeyDistributionMessageSerializer interface { + Serialize(signalMessage *SenderKeyDistributionMessageStructure) []byte + Deserialize(serialized []byte) (*SenderKeyDistributionMessageStructure, error) +} + +// NewSenderKeyDistributionMessageFromBytes will return a Signal Ciphertext message from the given +// bytes using the given serializer. +func NewSenderKeyDistributionMessageFromBytes(serialized []byte, + serializer SenderKeyDistributionMessageSerializer) (*SenderKeyDistributionMessage, error) { + + // Use the given serializer to decode the signal message. + signalMessageStructure, err := serializer.Deserialize(serialized) + if err != nil { + return nil, err + } + + return NewSenderKeyDistributionMessageFromStruct(signalMessageStructure, serializer) +} + +// NewSenderKeyDistributionMessageFromStruct returns a Signal Ciphertext message from the +// given serializable structure. +func NewSenderKeyDistributionMessageFromStruct(structure *SenderKeyDistributionMessageStructure, + serializer SenderKeyDistributionMessageSerializer) (*SenderKeyDistributionMessage, error) { + + // Throw an error if the given message structure is an unsupported version. + if structure.Version <= UnsupportedVersion { + return nil, fmt.Errorf("%w %d (sender key distribution)", signalerror.ErrOldMessageVersion, structure.Version) + } + + // Throw an error if the given message structure is a future version. + if structure.Version > CurrentVersion { + return nil, fmt.Errorf("%w %d (sender key distribution)", signalerror.ErrUnknownMessageVersion, structure.Version) + } + + // Throw an error if the structure is missing critical fields. + if structure.SigningKey == nil || structure.ChainKey == nil { + return nil, fmt.Errorf("%w (sender key distribution)", signalerror.ErrIncompleteMessage) + } + + // Get the signing key object from bytes. + signingKey, err := ecc.DecodePoint(structure.SigningKey, 0) + if err != nil { + return nil, err + } + + // Create the signal message object from the structure. + message := &SenderKeyDistributionMessage{ + id: structure.ID, + iteration: structure.Iteration, + chainKey: structure.ChainKey, + version: structure.Version, + signatureKey: signingKey, + serializer: serializer, + } + + // Generate the ECC key from bytes. + message.signatureKey, err = ecc.DecodePoint(structure.SigningKey, 0) + if err != nil { + return nil, err + } + + return message, nil +} + +// NewSenderKeyDistributionMessage returns a Signal Ciphertext message. +func NewSenderKeyDistributionMessage(id uint32, iteration uint32, + chainKey []byte, signatureKey ecc.ECPublicKeyable, + serializer SenderKeyDistributionMessageSerializer) *SenderKeyDistributionMessage { + + return &SenderKeyDistributionMessage{ + id: id, + iteration: iteration, + chainKey: chainKey, + signatureKey: signatureKey, + serializer: serializer, + } +} + +// SenderKeyDistributionMessageStructure is a serializeable structure for senderkey +// distribution messages. +type SenderKeyDistributionMessageStructure struct { + ID uint32 + Iteration uint32 + ChainKey []byte + SigningKey []byte + Version uint32 +} + +// SenderKeyDistributionMessage is a structure for senderkey distribution messages. +type SenderKeyDistributionMessage struct { + id uint32 + iteration uint32 + chainKey []byte + version uint32 + signatureKey ecc.ECPublicKeyable + serializer SenderKeyDistributionMessageSerializer +} + +// ID will return the message's id. +func (p *SenderKeyDistributionMessage) ID() uint32 { + return p.id +} + +// Iteration will return the message's iteration. +func (p *SenderKeyDistributionMessage) Iteration() uint32 { + return p.iteration +} + +// ChainKey will return the message's chain key in bytes. +func (p *SenderKeyDistributionMessage) ChainKey() []byte { + return p.chainKey +} + +// SignatureKey will return the message's signature public key +func (p *SenderKeyDistributionMessage) SignatureKey() ecc.ECPublicKeyable { + return p.signatureKey +} + +// Serialize will use the given serializer and return the message as +// bytes. +func (p *SenderKeyDistributionMessage) Serialize() []byte { + structure := &SenderKeyDistributionMessageStructure{ + ID: p.id, + Iteration: p.iteration, + ChainKey: p.chainKey, + SigningKey: p.signatureKey.Serialize(), + Version: CurrentVersion, + } + return p.serializer.Serialize(structure) +} + +// Type will return the message's type. +func (p *SenderKeyDistributionMessage) Type() uint32 { + return SENDERKEY_DISTRIBUTION_TYPE +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/protocol/SenderKeyMessage.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/protocol/SenderKeyMessage.go new file mode 100644 index 0000000..cd69cea --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/protocol/SenderKeyMessage.go @@ -0,0 +1,168 @@ +package protocol + +import ( + "fmt" + + "go.mau.fi/libsignal/ecc" + "go.mau.fi/libsignal/signalerror" + "go.mau.fi/libsignal/util/bytehelper" +) + +// SenderKeyMessageSerializer is an interface for serializing and deserializing +// SenderKeyMessages into bytes. An implementation of this interface should be +// used to encode/decode the object into JSON, Protobuffers, etc. +type SenderKeyMessageSerializer interface { + Serialize(signalMessage *SenderKeyMessageStructure) []byte + Deserialize(serialized []byte) (*SenderKeyMessageStructure, error) +} + +// NewSenderKeyMessageFromBytes will return a Signal Ciphertext message from the given +// bytes using the given serializer. +func NewSenderKeyMessageFromBytes(serialized []byte, + serializer SenderKeyMessageSerializer) (*SenderKeyMessage, error) { + + // Use the given serializer to decode the signal message. + senderKeyMessageStructure, err := serializer.Deserialize(serialized) + if err != nil { + return nil, err + } + + return NewSenderKeyMessageFromStruct(senderKeyMessageStructure, serializer) +} + +// NewSenderKeyMessageFromStruct returns a Signal Ciphertext message from the +// given serializable structure. +func NewSenderKeyMessageFromStruct(structure *SenderKeyMessageStructure, + serializer SenderKeyMessageSerializer) (*SenderKeyMessage, error) { + + // Throw an error if the given message structure is an unsupported version. + if structure.Version <= UnsupportedVersion { + return nil, fmt.Errorf("%w %d (sender key message)", signalerror.ErrOldMessageVersion, structure.Version) + } + + // Throw an error if the given message structure is a future version. + if structure.Version > CurrentVersion { + return nil, fmt.Errorf("%w %d (sender key message)", signalerror.ErrUnknownMessageVersion, structure.Version) + } + + // Throw an error if the structure is missing critical fields. + if structure.CipherText == nil { + return nil, fmt.Errorf("%w (sender key message)", signalerror.ErrIncompleteMessage) + } + + // Create the signal message object from the structure. + whisperMessage := &SenderKeyMessage{ + keyID: structure.ID, + version: structure.Version, + iteration: structure.Iteration, + ciphertext: structure.CipherText, + signature: structure.Signature, + serializer: serializer, + } + + return whisperMessage, nil +} + +// NewSenderKeyMessage returns a SenderKeyMessage. +func NewSenderKeyMessage(keyID uint32, iteration uint32, ciphertext []byte, + signatureKey ecc.ECPrivateKeyable, serializer SenderKeyMessageSerializer) *SenderKeyMessage { + + // Ensure we have a valid signature key + if signatureKey == nil { + panic("Signature is nil. Unable to sign new senderkey message.") + } + + // Build our SenderKeyMessage. + senderKeyMessage := &SenderKeyMessage{ + keyID: keyID, + iteration: iteration, + ciphertext: ciphertext, + version: CurrentVersion, + serializer: serializer, + } + + // Sign the serialized message and include it in the message. This will be included + // in the signed serialized version of the message. + signature := ecc.CalculateSignature(signatureKey, senderKeyMessage.Serialize()) + senderKeyMessage.signature = bytehelper.ArrayToSlice64(signature) + + return senderKeyMessage +} + +// SenderKeyMessageStructure is a serializeable structure for SenderKey messages. +type SenderKeyMessageStructure struct { + ID uint32 + Iteration uint32 + CipherText []byte + Version uint32 + Signature []byte +} + +// SenderKeyMessage is a structure for messages using senderkey groups. +type SenderKeyMessage struct { + version uint32 + keyID uint32 + iteration uint32 + ciphertext []byte + signature []byte + serializer SenderKeyMessageSerializer +} + +// KeyID returns the SenderKeyMessage key ID. +func (p *SenderKeyMessage) KeyID() uint32 { + return p.keyID +} + +// Iteration returns the SenderKeyMessage iteration. +func (p *SenderKeyMessage) Iteration() uint32 { + return p.iteration +} + +// Ciphertext returns the SenderKeyMessage encrypted ciphertext. +func (p *SenderKeyMessage) Ciphertext() []byte { + return p.ciphertext +} + +// Version returns the Signal message version of the message. +func (p *SenderKeyMessage) Version() uint32 { + return p.version +} + +// Serialize will use the given serializer to return the message as bytes +// excluding the signature. This should be used for signing and verifying +// message signatures. +func (p *SenderKeyMessage) Serialize() []byte { + structure := &SenderKeyMessageStructure{ + ID: p.keyID, + Iteration: p.iteration, + CipherText: p.ciphertext, + Version: p.version, + } + + return p.serializer.Serialize(structure) +} + +// SignedSerialize will use the given serializer to return the message as +// bytes with the message signature included. This should be used when +// sending the message over the network. +func (p *SenderKeyMessage) SignedSerialize() []byte { + structure := &SenderKeyMessageStructure{ + ID: p.keyID, + Iteration: p.iteration, + CipherText: p.ciphertext, + Version: p.version, + Signature: p.signature, + } + + return p.serializer.Serialize(structure) +} + +// Signature returns the SenderKeyMessage signature +func (p *SenderKeyMessage) Signature() [64]byte { + return bytehelper.SliceToArray64(p.signature) +} + +// Type returns the sender key type. +func (p *SenderKeyMessage) Type() uint32 { + return SENDERKEY_TYPE +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/protocol/SenderKeyName.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/protocol/SenderKeyName.go new file mode 100644 index 0000000..d9b6b68 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/protocol/SenderKeyName.go @@ -0,0 +1,25 @@ +package protocol + +// NewSenderKeyName returns a new SenderKeyName object. +func NewSenderKeyName(groupID string, sender *SignalAddress) *SenderKeyName { + return &SenderKeyName{ + groupID: groupID, + sender: sender, + } +} + +// SenderKeyName is a structure for a group session address. +type SenderKeyName struct { + groupID string + sender *SignalAddress +} + +// GroupID returns the sender key group id +func (n *SenderKeyName) GroupID() string { + return n.groupID +} + +// Sender returns the Signal address of sending user in the group. +func (n *SenderKeyName) Sender() *SignalAddress { + return n.sender +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/protocol/SignalMessage.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/protocol/SignalMessage.go new file mode 100644 index 0000000..fd348a3 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/protocol/SignalMessage.go @@ -0,0 +1,226 @@ +package protocol + +import ( + "crypto/hmac" + "crypto/sha256" + "fmt" + "strconv" + + "go.mau.fi/libsignal/ecc" + "go.mau.fi/libsignal/keys/identity" + "go.mau.fi/libsignal/logger" + "go.mau.fi/libsignal/signalerror" + "go.mau.fi/libsignal/util/bytehelper" +) + +const MacLength int = 8 + +// SignalMessageSerializer is an interface for serializing and deserializing +// SignalMessages into bytes. An implementation of this interface should be +// used to encode/decode the object into JSON, Protobuffers, etc. +type SignalMessageSerializer interface { + Serialize(signalMessage *SignalMessageStructure) []byte + Deserialize(serialized []byte) (*SignalMessageStructure, error) +} + +// NewSignalMessageFromBytes will return a Signal Ciphertext message from the given +// bytes using the given serializer. +func NewSignalMessageFromBytes(serialized []byte, serializer SignalMessageSerializer) (*SignalMessage, error) { + // Use the given serializer to decode the signal message. + signalMessageStructure, err := serializer.Deserialize(serialized) + if err != nil { + return nil, err + } + + return NewSignalMessageFromStruct(signalMessageStructure, serializer) +} + +// NewSignalMessageFromStruct returns a Signal Ciphertext message from the +// given serializable structure. +func NewSignalMessageFromStruct(structure *SignalMessageStructure, serializer SignalMessageSerializer) (*SignalMessage, error) { + // Throw an error if the given message structure is an unsupported version. + if structure.Version <= UnsupportedVersion { + return nil, fmt.Errorf("%w %d (normal message)", signalerror.ErrOldMessageVersion, structure.Version) + } + + // Throw an error if the given message structure is a future version. + if structure.Version > CurrentVersion { + return nil, fmt.Errorf("%w %d (normal message)", signalerror.ErrUnknownMessageVersion, structure.Version) + } + + // Throw an error if the structure is missing critical fields. + if structure.CipherText == nil || structure.RatchetKey == nil { + return nil, fmt.Errorf("%w (normal message)", signalerror.ErrIncompleteMessage) + } + + // Create the signal message object from the structure. + whisperMessage := &SignalMessage{structure: *structure, serializer: serializer} + + // Generate the ECC key from bytes. + var err error + whisperMessage.senderRatchetKey, err = ecc.DecodePoint(structure.RatchetKey, 0) + if err != nil { + return nil, err + } + + return whisperMessage, nil +} + +// NewSignalMessage returns a Signal Ciphertext message. +func NewSignalMessage(messageVersion int, counter, previousCounter uint32, macKey []byte, + senderRatchetKey ecc.ECPublicKeyable, ciphertext []byte, senderIdentityKey, + receiverIdentityKey *identity.Key, serializer SignalMessageSerializer) (*SignalMessage, error) { + + version := []byte(strconv.Itoa(messageVersion)) + // Build the signal message structure with the given data. + structure := &SignalMessageStructure{ + Counter: counter, + PreviousCounter: previousCounter, + RatchetKey: senderRatchetKey.Serialize(), + CipherText: ciphertext, + } + + serialized := append(version, serializer.Serialize(structure)...) + // Get the message authentication code from the serialized structure. + mac, err := getMac( + messageVersion, senderIdentityKey, receiverIdentityKey, + macKey, serialized, + ) + if err != nil { + return nil, err + } + structure.Mac = mac + structure.Version = messageVersion + + // Generate a SignalMessage with the structure. + whisperMessage, err := NewSignalMessageFromStruct(structure, serializer) + if err != nil { + return nil, err + } + + return whisperMessage, nil +} + +// SignalMessageStructure is a serializeable structure of a signal message +// object. +type SignalMessageStructure struct { + RatchetKey []byte + Counter uint32 + PreviousCounter uint32 + CipherText []byte + Version int + Mac []byte +} + +// SignalMessage is a cipher message that contains a message encrypted +// with the Signal protocol. +type SignalMessage struct { + structure SignalMessageStructure + senderRatchetKey ecc.ECPublicKeyable + serializer SignalMessageSerializer +} + +// SenderRatchetKey returns the SignalMessage's sender ratchet key. This +// key is used for ratcheting the chain forward to negotiate a new shared +// secret that cannot be derived from previous chains. +func (s *SignalMessage) SenderRatchetKey() ecc.ECPublicKeyable { + return s.senderRatchetKey +} + +// MessageVersion returns the message version this SignalMessage supports. +func (s *SignalMessage) MessageVersion() int { + return s.structure.Version +} + +// Counter will return the SignalMessage counter. +func (s *SignalMessage) Counter() uint32 { + return s.structure.Counter +} + +// Body will return the SignalMessage's ciphertext in bytes. +func (s *SignalMessage) Body() []byte { + return s.structure.CipherText +} + +// VerifyMac will return an error if the message's message authentication code +// is invalid. This should be used on SignalMessages that have been constructed +// from a sent message. +func (s *SignalMessage) VerifyMac(messageVersion int, senderIdentityKey, + receiverIdentityKey *identity.Key, macKey []byte) error { + + // Create a copy of the message without the mac. We'll use this to calculate + // the message authentication code. + structure := s.structure + signalMessage, err := NewSignalMessageFromStruct(&structure, s.serializer) + if err != nil { + return err + } + signalMessage.structure.Mac = nil + signalMessage.structure.Version = 0 + version := []byte(strconv.Itoa(s.MessageVersion())) + serialized := append(version, signalMessage.Serialize()...) + + // Calculate the message authentication code from the serialized structure. + ourMac, err := getMac( + messageVersion, + senderIdentityKey, + receiverIdentityKey, + macKey, + serialized, + ) + if err != nil { + logger.Error(err) + return err + } + + // Get the message authentication code that was sent to us as part of + // the signal message structure. + theirMac := s.structure.Mac + + logger.Debug("Verifying macs...") + logger.Debug(" Our MAC: ", ourMac) + logger.Debug(" Their MAC: ", theirMac) + + // Return an error if our calculated mac doesn't match the mac sent to us. + if !hmac.Equal(ourMac, theirMac) { + return signalerror.ErrBadMAC + } + + return nil +} + +// Serialize will return the Signal Message as bytes. +func (s *SignalMessage) Serialize() []byte { + return s.serializer.Serialize(&s.structure) +} + +// Structure will return a serializeable structure of the Signal Message. +func (s *SignalMessage) Structure() *SignalMessageStructure { + structure := s.structure + return &structure +} + +// Type will return the type of Signal Message this is. +func (s *SignalMessage) Type() uint32 { + return WHISPER_TYPE +} + +// getMac will calculate the mac using the given message version, identity +// keys, macKey and SignalMessageStructure. The MAC key is a private key held +// by both parties that is concatenated with the message and hashed. +func getMac(messageVersion int, senderIdentityKey, receiverIdentityKey *identity.Key, + macKey, serialized []byte) ([]byte, error) { + + mac := hmac.New(sha256.New, macKey[:]) + + if messageVersion >= 3 { + mac.Write(senderIdentityKey.PublicKey().Serialize()) + mac.Write(receiverIdentityKey.PublicKey().Serialize()) + } + + mac.Write(serialized) + + fullMac := mac.Sum(nil) + + return bytehelper.Trim(fullMac, MacLength), nil +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/protocol/SignalProtocolAddress.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/protocol/SignalProtocolAddress.go new file mode 100644 index 0000000..468a308 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/protocol/SignalProtocolAddress.go @@ -0,0 +1,38 @@ +package protocol + +import ( + "fmt" +) + +const ADDRESS_SEPARATOR = ":" + +// NewSignalAddress returns a new signal address. +func NewSignalAddress(name string, deviceID uint32) *SignalAddress { + addr := SignalAddress{ + name: name, + deviceID: deviceID, + } + + return &addr +} + +// SignalAddress is a combination of a name and a device ID. +type SignalAddress struct { + name string + deviceID uint32 +} + +// Name returns the signal address's name. +func (s *SignalAddress) Name() string { + return s.name +} + +// DeviceID returns the signal address's device ID. +func (s *SignalAddress) DeviceID() uint32 { + return s.deviceID +} + +// String returns a string of both the address name and device id. +func (s *SignalAddress) String() string { + return fmt.Sprintf("%s%s%d", s.name, ADDRESS_SEPARATOR, s.deviceID) +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ratchet/Ratchet.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ratchet/Ratchet.go new file mode 100644 index 0000000..df25beb --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ratchet/Ratchet.go @@ -0,0 +1,197 @@ +// Package ratchet provides the methods necessary to establish a new double +// ratchet session. +package ratchet + +import ( + "encoding/base64" + "encoding/binary" + + "go.mau.fi/libsignal/ecc" + "go.mau.fi/libsignal/kdf" + "go.mau.fi/libsignal/keys/chain" + "go.mau.fi/libsignal/keys/root" + "go.mau.fi/libsignal/keys/session" +) + +var b64 = base64.StdEncoding.EncodeToString + +func genDiscontinuity() [32]byte { + var discontinuity [32]byte + for i := range discontinuity { + discontinuity[i] = 0xFF + } + return discontinuity +} + +// CalculateSenderSession calculates the key agreement for a recipient. This +// should be used when we are trying to send a message to someone for the +// first time. +func CalculateSenderSession(parameters *SenderParameters) (*session.KeyPair, error) { + var secret [32]byte + var publicKey [32]byte + var privateKey [32]byte + masterSecret := []byte{} // Create a master shared secret that is 5 different 32-byte values + discontinuity := genDiscontinuity() + masterSecret = append(masterSecret, discontinuity[:]...) + + // Calculate the agreement using their signed prekey and our identity key. + publicKey = parameters.TheirSignedPreKey().PublicKey() + privateKey = parameters.OurIdentityKey().PrivateKey().Serialize() + secret = kdf.CalculateSharedSecret( + publicKey, + privateKey, + ) + masterSecret = append(masterSecret, secret[:]...) + + // Calculate the agreement using their identity key and our base key. + publicKey = parameters.TheirIdentityKey().PublicKey().PublicKey() + privateKey = parameters.OurBaseKey().PrivateKey().Serialize() + secret = kdf.CalculateSharedSecret( + publicKey, + privateKey, + ) + masterSecret = append(masterSecret, secret[:]...) + + // Calculate the agreement using their signed prekey and our base key. + publicKey = parameters.TheirSignedPreKey().PublicKey() + privateKey = parameters.OurBaseKey().PrivateKey().Serialize() + secret = kdf.CalculateSharedSecret( + publicKey, + privateKey, + ) + masterSecret = append(masterSecret, secret[:]...) + + // If they have a one-time prekey, use it to calculate the shared secret with their + // one time key and our base key. + if parameters.TheirOneTimePreKey() != nil { + publicKey = parameters.TheirOneTimePreKey().PublicKey() + privateKey = parameters.OurBaseKey().PrivateKey().Serialize() + secret = kdf.CalculateSharedSecret( + publicKey, + privateKey, + ) + masterSecret = append(masterSecret, secret[:]...) + + } + + // Derive the root and chain keys based on the master secret. + derivedKeysBytes, err := kdf.DeriveSecrets(masterSecret, nil, []byte("WhisperText"), root.DerivedSecretsSize) + if err != nil { + return nil, err + } + derivedKeys := session.NewDerivedSecrets(derivedKeysBytes) + chainKey := chain.NewKey(kdf.DeriveSecrets, derivedKeys.ChainKey(), 0) + rootKey := root.NewKey(kdf.DeriveSecrets, derivedKeys.RootKey()) + + // Add the root and chain keys to a structure that will hold both keys. + sessionKeys := session.NewKeyPair(rootKey, chainKey) + + return sessionKeys, nil +} + +// CalculateReceiverSession calculates the key agreement for a sender. This should +// be used when we are receiving a message from someone for the first time. +func CalculateReceiverSession(parameters *ReceiverParameters) (*session.KeyPair, error) { + var secret [32]byte + var publicKey [32]byte + var privateKey [32]byte + masterSecret := []byte{} // Create a master shared secret that is 5 different 32-byte values + + discontinuity := genDiscontinuity() + masterSecret = append(masterSecret, discontinuity[:]...) + + // Calculate the agreement using their identity key and our signed pre key. + publicKey = parameters.TheirIdentityKey().PublicKey().PublicKey() + privateKey = parameters.OurSignedPreKey().PrivateKey().Serialize() + secret = kdf.CalculateSharedSecret( + publicKey, + privateKey, + ) + masterSecret = append(masterSecret, secret[:]...) + + // Calculate the agreement using their base key and our identity key. + publicKey = parameters.TheirBaseKey().PublicKey() + privateKey = parameters.OurIdentityKeyPair().PrivateKey().Serialize() + secret = kdf.CalculateSharedSecret( + publicKey, + privateKey, + ) + masterSecret = append(masterSecret, secret[:]...) + + // Calculate the agreement using their base key and our signed prekey. + publicKey = parameters.TheirBaseKey().PublicKey() + privateKey = parameters.OurSignedPreKey().PrivateKey().Serialize() + secret = kdf.CalculateSharedSecret( + publicKey, + privateKey, + ) + masterSecret = append(masterSecret, secret[:]...) + + // If we had a one-time prekey, use it to calculate the shared secret with our + // one time key and their base key. + if parameters.OurOneTimePreKey() != nil { + publicKey = parameters.TheirBaseKey().PublicKey() + privateKey = parameters.OurOneTimePreKey().PrivateKey().Serialize() + secret = kdf.CalculateSharedSecret( + publicKey, + privateKey, + ) + masterSecret = append(masterSecret, secret[:]...) + + } + + // Derive the root and chain keys based on the master secret. + derivedKeysBytes, err := kdf.DeriveSecrets(masterSecret, nil, []byte("WhisperText"), root.DerivedSecretsSize) + if err != nil { + return nil, err + } + derivedKeys := session.NewDerivedSecrets(derivedKeysBytes) + chainKey := chain.NewKey(kdf.DeriveSecrets, derivedKeys.ChainKey(), 0) + rootKey := root.NewKey(kdf.DeriveSecrets, derivedKeys.RootKey()) + + // Add the root and chain keys to a structure that will hold both keys. + sessionKeys := session.NewKeyPair(rootKey, chainKey) + + return sessionKeys, nil +} + +// CalculateSymmetricSession calculates the key agreement between two users. This +// works by both clients exchanging KeyExchange messages to first establish a session. +// This is useful for establishing a session if both users are online. +func CalculateSymmetricSession(parameters *SymmetricParameters) (*session.KeyPair, error) { + // Compare the base public keys so we can deterministically know whether we should + // be setting up a sender or receiver session. If our key converted to an integer is + // less than the other user's, act as a sender. + if isSender(parameters.OurBaseKey.PublicKey(), parameters.TheirBaseKey) { + senderParameters := &SenderParameters{ + ourBaseKey: parameters.OurBaseKey, + ourIdentityKeyPair: parameters.OurIdentityKeyPair, + theirRatchetKey: parameters.TheirRatchetKey, + theirIdentityKey: parameters.TheirIdentityKey, + theirSignedPreKey: parameters.TheirBaseKey, + } + + return CalculateSenderSession(senderParameters) + } + + // If our base public key was larger than the other user's, act as a receiver. + receiverParameters := &ReceiverParameters{ + ourIdentityKeyPair: parameters.OurIdentityKeyPair, + ourRatchetKey: parameters.OurRatchetKey, + ourSignedPreKey: parameters.OurBaseKey, + theirBaseKey: parameters.TheirBaseKey, + theirIdentityKey: parameters.TheirIdentityKey, + } + + return CalculateReceiverSession(receiverParameters) +} + +// isSender is a private method for determining if a symmetric session should +// be calculated as the sender or receiver. It does so by converting the given +// keys into integers and comparing the size of those integers. +func isSender(ourKey, theirKey ecc.ECPublicKeyable) bool { + ourKeyInt := binary.BigEndian.Uint32(ourKey.Serialize()) + theirKeyInt := binary.BigEndian.Uint32(theirKey.Serialize()) + + return ourKeyInt < theirKeyInt +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ratchet/ReceiverParameters.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ratchet/ReceiverParameters.go new file mode 100644 index 0000000..97822d1 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ratchet/ReceiverParameters.go @@ -0,0 +1,106 @@ +package ratchet + +import ( + "go.mau.fi/libsignal/ecc" + "go.mau.fi/libsignal/keys/identity" +) + +// NewReceiverParameters creates a structure with all the keys needed to construct +// a new session when we are receiving a message from a user for the first time. +func NewReceiverParameters(ourIdentityKey *identity.KeyPair, ourSignedPreKey *ecc.ECKeyPair, + ourOneTimePreKey *ecc.ECKeyPair, ourRatchetKey *ecc.ECKeyPair, + theirBaseKey ecc.ECPublicKeyable, theirIdentityKey *identity.Key) *ReceiverParameters { + + receiverParams := ReceiverParameters{ + ourIdentityKeyPair: ourIdentityKey, + ourSignedPreKey: ourSignedPreKey, + ourOneTimePreKey: ourOneTimePreKey, + ourRatchetKey: ourRatchetKey, + theirBaseKey: theirBaseKey, + theirIdentityKey: theirIdentityKey, + } + + return &receiverParams +} + +// NewEmptyReceiverParameters creates an empty structure with the receiver parameters +// needed to create a session. You should use the `set` functions to set all the +// necessary keys needed to build a session. +func NewEmptyReceiverParameters() *ReceiverParameters { + receiverParams := ReceiverParameters{} + + return &receiverParams +} + +// ReceiverParameters describes the session parameters if we are receiving +// a message from someone for the first time. These parameters are used as +// the basis for deriving a shared secret with the sender. +type ReceiverParameters struct { + ourIdentityKeyPair *identity.KeyPair + ourSignedPreKey *ecc.ECKeyPair + ourOneTimePreKey *ecc.ECKeyPair + ourRatchetKey *ecc.ECKeyPair + + theirBaseKey ecc.ECPublicKeyable + theirIdentityKey *identity.Key +} + +// OurIdentityKeyPair returns the identity key of the receiver. +func (r *ReceiverParameters) OurIdentityKeyPair() *identity.KeyPair { + return r.ourIdentityKeyPair +} + +// OurSignedPreKey returns the signed prekey of the receiver. +func (r *ReceiverParameters) OurSignedPreKey() *ecc.ECKeyPair { + return r.ourSignedPreKey +} + +// OurOneTimePreKey returns the one time prekey of the receiver. +func (r *ReceiverParameters) OurOneTimePreKey() *ecc.ECKeyPair { + return r.ourOneTimePreKey +} + +// OurRatchetKey returns the ratchet key of the receiver. +func (r *ReceiverParameters) OurRatchetKey() *ecc.ECKeyPair { + return r.ourRatchetKey +} + +// TheirBaseKey returns the base key of the sender. +func (r *ReceiverParameters) TheirBaseKey() ecc.ECPublicKeyable { + return r.theirBaseKey +} + +// TheirIdentityKey returns the identity key of the sender. +func (r *ReceiverParameters) TheirIdentityKey() *identity.Key { + return r.theirIdentityKey +} + +// SetOurIdentityKeyPair sets the identity key of the receiver. +func (r *ReceiverParameters) SetOurIdentityKeyPair(ourIdentityKey *identity.KeyPair) { + r.ourIdentityKeyPair = ourIdentityKey +} + +// SetOurSignedPreKey sets the signed prekey of the receiver. +func (r *ReceiverParameters) SetOurSignedPreKey(ourSignedPreKey *ecc.ECKeyPair) { + r.ourSignedPreKey = ourSignedPreKey +} + +// SetOurOneTimePreKey sets the one time prekey of the receiver. +func (r *ReceiverParameters) SetOurOneTimePreKey(ourOneTimePreKey *ecc.ECKeyPair) { + r.ourOneTimePreKey = ourOneTimePreKey +} + +// SetOurRatchetKey sets the ratchet key of the receiver. +func (r *ReceiverParameters) SetOurRatchetKey(ourRatchetKey *ecc.ECKeyPair) { + r.ourRatchetKey = ourRatchetKey +} + +// SetTheirBaseKey sets the base key of the sender. +func (r *ReceiverParameters) SetTheirBaseKey(theirBaseKey ecc.ECPublicKeyable) { + r.theirBaseKey = theirBaseKey +} + +// SetTheirIdentityKey sets the identity key of the sender. +func (r *ReceiverParameters) SetTheirIdentityKey(theirIdentityKey *identity.Key) { + r.theirIdentityKey = theirIdentityKey +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ratchet/SenderParameters.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ratchet/SenderParameters.go new file mode 100644 index 0000000..ca97295 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ratchet/SenderParameters.go @@ -0,0 +1,106 @@ +package ratchet + +import ( + "go.mau.fi/libsignal/ecc" + "go.mau.fi/libsignal/keys/identity" +) + +// NewSenderParameters creates a structure with all the keys needed to construct +// a new session when we are sending a message to a recipient for the first time. +func NewSenderParameters(ourIdentityKey *identity.KeyPair, ourBaseKey *ecc.ECKeyPair, + theirIdentityKey *identity.Key, theirSignedPreKey ecc.ECPublicKeyable, + theirRatchetKey ecc.ECPublicKeyable, theirOneTimePreKey ecc.ECPublicKeyable) *SenderParameters { + + senderParams := SenderParameters{ + ourIdentityKeyPair: ourIdentityKey, + ourBaseKey: ourBaseKey, + theirIdentityKey: theirIdentityKey, + theirSignedPreKey: theirSignedPreKey, + theirOneTimePreKey: theirOneTimePreKey, + theirRatchetKey: theirRatchetKey, + } + + return &senderParams +} + +// NewEmptySenderParameters creates an empty structure with the sender parameters +// needed to create a session. You should use the `set` functions to set all the +// necessary keys needed to build a session. +func NewEmptySenderParameters() *SenderParameters { + senderParams := SenderParameters{} + + return &senderParams +} + +// SenderParameters describes the session parameters if we are sending the +// recipient a message for the first time. These parameters are used as the +// basis for deriving a shared secret with a recipient. +type SenderParameters struct { + ourIdentityKeyPair *identity.KeyPair + ourBaseKey *ecc.ECKeyPair + + theirIdentityKey *identity.Key + theirSignedPreKey ecc.ECPublicKeyable + theirOneTimePreKey ecc.ECPublicKeyable + theirRatchetKey ecc.ECPublicKeyable +} + +// OurIdentityKey returns the identity key pair of the sender. +func (s *SenderParameters) OurIdentityKey() *identity.KeyPair { + return s.ourIdentityKeyPair +} + +// OurBaseKey returns the base ECC key pair of the sender. +func (s *SenderParameters) OurBaseKey() *ecc.ECKeyPair { + return s.ourBaseKey +} + +// TheirIdentityKey returns the identity public key of the receiver. +func (s *SenderParameters) TheirIdentityKey() *identity.Key { + return s.theirIdentityKey +} + +// TheirSignedPreKey returns the signed pre key of the receiver. +func (s *SenderParameters) TheirSignedPreKey() ecc.ECPublicKeyable { + return s.theirSignedPreKey +} + +// TheirOneTimePreKey returns the receiver's one time prekey. +func (s *SenderParameters) TheirOneTimePreKey() ecc.ECPublicKeyable { + return s.theirOneTimePreKey +} + +// TheirRatchetKey returns the receiver's ratchet key. +func (s *SenderParameters) TheirRatchetKey() ecc.ECPublicKeyable { + return s.theirRatchetKey +} + +// SetOurIdentityKey sets the identity key pair of the sender. +func (s *SenderParameters) SetOurIdentityKey(ourIdentityKey *identity.KeyPair) { + s.ourIdentityKeyPair = ourIdentityKey +} + +// SetOurBaseKey sets the base ECC key pair of the sender. +func (s *SenderParameters) SetOurBaseKey(ourBaseKey *ecc.ECKeyPair) { + s.ourBaseKey = ourBaseKey +} + +// SetTheirIdentityKey sets the identity public key of the receiver. +func (s *SenderParameters) SetTheirIdentityKey(theirIdentityKey *identity.Key) { + s.theirIdentityKey = theirIdentityKey +} + +// SetTheirSignedPreKey sets the signed pre key of the receiver. +func (s *SenderParameters) SetTheirSignedPreKey(theirSignedPreKey ecc.ECPublicKeyable) { + s.theirSignedPreKey = theirSignedPreKey +} + +// SetTheirOneTimePreKey sets the receiver's one time prekey. +func (s *SenderParameters) SetTheirOneTimePreKey(theirOneTimePreKey ecc.ECPublicKeyable) { + s.theirOneTimePreKey = theirOneTimePreKey +} + +// SetTheirRatchetKey sets the receiver's ratchet key. +func (s *SenderParameters) SetTheirRatchetKey(theirRatchetKey ecc.ECPublicKeyable) { + s.theirRatchetKey = theirRatchetKey +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ratchet/SymmetricParameters.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ratchet/SymmetricParameters.go new file mode 100644 index 0000000..e7811de --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/ratchet/SymmetricParameters.go @@ -0,0 +1,18 @@ +package ratchet + +import ( + "go.mau.fi/libsignal/ecc" + "go.mau.fi/libsignal/keys/identity" +) + +// SymmetricParameters describes the session parameters for sessions where +// both users are online, which doesn't use prekeys for setup. +type SymmetricParameters struct { + OurBaseKey *ecc.ECKeyPair + OurRatchetKey *ecc.ECKeyPair + OurIdentityKeyPair *identity.KeyPair + + TheirBaseKey ecc.ECPublicKeyable + TheirRatchetKey ecc.ECPublicKeyable + TheirIdentityKey *identity.Key +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/serialize/FingerprintProtocol.pb.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/serialize/FingerprintProtocol.pb.go new file mode 100644 index 0000000..1e90caa --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/serialize/FingerprintProtocol.pb.go @@ -0,0 +1,245 @@ +// From https://github.com/signalapp/libsignal-protocol-c/blob/master/protobuf/FingerprintProtocol.proto + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.12.4 +// source: serialize/FingerprintProtocol.proto + +package serialize + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type LogicalFingerprint struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Content []byte `protobuf:"bytes,1,opt,name=content" json:"content,omitempty"` + Identifier []byte `protobuf:"bytes,2,opt,name=identifier" json:"identifier,omitempty"` // Version 0 +} + +func (x *LogicalFingerprint) Reset() { + *x = LogicalFingerprint{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_FingerprintProtocol_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LogicalFingerprint) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LogicalFingerprint) ProtoMessage() {} + +func (x *LogicalFingerprint) ProtoReflect() protoreflect.Message { + mi := &file_serialize_FingerprintProtocol_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LogicalFingerprint.ProtoReflect.Descriptor instead. +func (*LogicalFingerprint) Descriptor() ([]byte, []int) { + return file_serialize_FingerprintProtocol_proto_rawDescGZIP(), []int{0} +} + +func (x *LogicalFingerprint) GetContent() []byte { + if x != nil { + return x.Content + } + return nil +} + +func (x *LogicalFingerprint) GetIdentifier() []byte { + if x != nil { + return x.Identifier + } + return nil +} + +type CombinedFingerprints struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Version *uint32 `protobuf:"varint,1,opt,name=version" json:"version,omitempty"` + LocalFingerprint *LogicalFingerprint `protobuf:"bytes,2,opt,name=localFingerprint" json:"localFingerprint,omitempty"` + RemoteFingerprint *LogicalFingerprint `protobuf:"bytes,3,opt,name=remoteFingerprint" json:"remoteFingerprint,omitempty"` +} + +func (x *CombinedFingerprints) Reset() { + *x = CombinedFingerprints{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_FingerprintProtocol_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CombinedFingerprints) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CombinedFingerprints) ProtoMessage() {} + +func (x *CombinedFingerprints) ProtoReflect() protoreflect.Message { + mi := &file_serialize_FingerprintProtocol_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CombinedFingerprints.ProtoReflect.Descriptor instead. +func (*CombinedFingerprints) Descriptor() ([]byte, []int) { + return file_serialize_FingerprintProtocol_proto_rawDescGZIP(), []int{1} +} + +func (x *CombinedFingerprints) GetVersion() uint32 { + if x != nil && x.Version != nil { + return *x.Version + } + return 0 +} + +func (x *CombinedFingerprints) GetLocalFingerprint() *LogicalFingerprint { + if x != nil { + return x.LocalFingerprint + } + return nil +} + +func (x *CombinedFingerprints) GetRemoteFingerprint() *LogicalFingerprint { + if x != nil { + return x.RemoteFingerprint + } + return nil +} + +var File_serialize_FingerprintProtocol_proto protoreflect.FileDescriptor + +var file_serialize_FingerprintProtocol_proto_rawDesc = []byte{ + 0x0a, 0x23, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x2f, 0x46, 0x69, 0x6e, 0x67, + 0x65, 0x72, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x74, 0x65, 0x78, 0x74, 0x73, 0x65, 0x63, 0x75, 0x72, + 0x65, 0x22, 0x4e, 0x0a, 0x12, 0x4c, 0x6f, 0x67, 0x69, 0x63, 0x61, 0x6c, 0x46, 0x69, 0x6e, 0x67, + 0x65, 0x72, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, + 0x72, 0x22, 0xca, 0x01, 0x0a, 0x14, 0x43, 0x6f, 0x6d, 0x62, 0x69, 0x6e, 0x65, 0x64, 0x46, 0x69, + 0x6e, 0x67, 0x65, 0x72, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x4a, 0x0a, 0x10, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x46, 0x69, 0x6e, + 0x67, 0x65, 0x72, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, + 0x2e, 0x74, 0x65, 0x78, 0x74, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x2e, 0x4c, 0x6f, 0x67, 0x69, + 0x63, 0x61, 0x6c, 0x46, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x52, 0x10, + 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x46, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x70, 0x72, 0x69, 0x6e, 0x74, + 0x12, 0x4c, 0x0a, 0x11, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x46, 0x69, 0x6e, 0x67, 0x65, 0x72, + 0x70, 0x72, 0x69, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x74, 0x65, + 0x78, 0x74, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x63, 0x61, 0x6c, + 0x46, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x52, 0x11, 0x72, 0x65, 0x6d, + 0x6f, 0x74, 0x65, 0x46, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x70, 0x72, 0x69, 0x6e, 0x74, +} + +var ( + file_serialize_FingerprintProtocol_proto_rawDescOnce sync.Once + file_serialize_FingerprintProtocol_proto_rawDescData = file_serialize_FingerprintProtocol_proto_rawDesc +) + +func file_serialize_FingerprintProtocol_proto_rawDescGZIP() []byte { + file_serialize_FingerprintProtocol_proto_rawDescOnce.Do(func() { + file_serialize_FingerprintProtocol_proto_rawDescData = protoimpl.X.CompressGZIP(file_serialize_FingerprintProtocol_proto_rawDescData) + }) + return file_serialize_FingerprintProtocol_proto_rawDescData +} + +var file_serialize_FingerprintProtocol_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_serialize_FingerprintProtocol_proto_goTypes = []interface{}{ + (*LogicalFingerprint)(nil), // 0: textsecure.LogicalFingerprint + (*CombinedFingerprints)(nil), // 1: textsecure.CombinedFingerprints +} +var file_serialize_FingerprintProtocol_proto_depIdxs = []int32{ + 0, // 0: textsecure.CombinedFingerprints.localFingerprint:type_name -> textsecure.LogicalFingerprint + 0, // 1: textsecure.CombinedFingerprints.remoteFingerprint:type_name -> textsecure.LogicalFingerprint + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_serialize_FingerprintProtocol_proto_init() } +func file_serialize_FingerprintProtocol_proto_init() { + if File_serialize_FingerprintProtocol_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_serialize_FingerprintProtocol_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LogicalFingerprint); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_FingerprintProtocol_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CombinedFingerprints); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_serialize_FingerprintProtocol_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_serialize_FingerprintProtocol_proto_goTypes, + DependencyIndexes: file_serialize_FingerprintProtocol_proto_depIdxs, + MessageInfos: file_serialize_FingerprintProtocol_proto_msgTypes, + }.Build() + File_serialize_FingerprintProtocol_proto = out.File + file_serialize_FingerprintProtocol_proto_rawDesc = nil + file_serialize_FingerprintProtocol_proto_goTypes = nil + file_serialize_FingerprintProtocol_proto_depIdxs = nil +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/serialize/FingerprintProtocol.proto b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/serialize/FingerprintProtocol.proto new file mode 100644 index 0000000..2003ec7 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/serialize/FingerprintProtocol.proto @@ -0,0 +1,14 @@ +// From https://github.com/signalapp/libsignal-protocol-c/blob/master/protobuf/FingerprintProtocol.proto +syntax = "proto2"; +package textsecure; + +message LogicalFingerprint { + optional bytes content = 1; + optional bytes identifier = 2; // Version 0 +} + +message CombinedFingerprints { + optional uint32 version = 1; + optional LogicalFingerprint localFingerprint = 2; + optional LogicalFingerprint remoteFingerprint = 3; +}
\ No newline at end of file diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/serialize/JSONSerializer.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/serialize/JSONSerializer.go new file mode 100644 index 0000000..1245fc4 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/serialize/JSONSerializer.go @@ -0,0 +1,303 @@ +package serialize + +import ( + "encoding/json" + + groupRecord "go.mau.fi/libsignal/groups/state/record" + "go.mau.fi/libsignal/logger" + "go.mau.fi/libsignal/protocol" + "go.mau.fi/libsignal/state/record" +) + +// NewJSONSerializer will return a serializer for all Signal objects that will +// be responsible for converting objects to and from JSON bytes. +func NewJSONSerializer() *Serializer { + serializer := NewSerializer() + + serializer.SignalMessage = &JSONSignalMessageSerializer{} + serializer.PreKeySignalMessage = &JSONPreKeySignalMessageSerializer{} + serializer.SignedPreKeyRecord = &JSONSignedPreKeyRecordSerializer{} + serializer.PreKeyRecord = &JSONPreKeyRecordSerializer{} + serializer.State = &JSONStateSerializer{} + serializer.Session = &JSONSessionSerializer{} + serializer.SenderKeyMessage = &JSONSenderKeyMessageSerializer{} + serializer.SenderKeyDistributionMessage = &JSONSenderKeyDistributionMessageSerializer{} + serializer.SenderKeyRecord = &JSONSenderKeySessionSerializer{} + serializer.SenderKeyState = &JSONSenderKeyStateSerializer{} + + return serializer +} + +// JSONSignalMessageSerializer is a structure for serializing signal messages into +// and from JSON. +type JSONSignalMessageSerializer struct{} + +// Serialize will take a signal message structure and convert it to JSON bytes. +func (j *JSONSignalMessageSerializer) Serialize(signalMessage *protocol.SignalMessageStructure) []byte { + serialized, err := json.Marshal(*signalMessage) + if err != nil { + logger.Error("Error serializing signal message: ", err) + } + // logger.Debug("Serialize result: ", string(serialized)) + + return serialized +} + +// Deserialize will take in JSON bytes and return a signal message structure. +func (j *JSONSignalMessageSerializer) Deserialize(serialized []byte) (*protocol.SignalMessageStructure, error) { + var signalMessage protocol.SignalMessageStructure + err := json.Unmarshal(serialized, &signalMessage) + if err != nil { + logger.Error("Error deserializing signal message: ", err) + return nil, err + } + + return &signalMessage, nil +} + +// JSONPreKeySignalMessageSerializer is a structure for serializing prekey signal messages +// into and from JSON. +type JSONPreKeySignalMessageSerializer struct{} + +// Serialize will take a prekey signal message structure and convert it to JSON bytes. +func (j *JSONPreKeySignalMessageSerializer) Serialize(signalMessage *protocol.PreKeySignalMessageStructure) []byte { + serialized, err := json.Marshal(signalMessage) + if err != nil { + logger.Error("Error serializing prekey signal message: ", err) + } + // logger.Debug("Serialize result: ", string(serialized)) + + return serialized +} + +// Deserialize will take in JSON bytes and return a prekey signal message structure. +func (j *JSONPreKeySignalMessageSerializer) Deserialize(serialized []byte) (*protocol.PreKeySignalMessageStructure, error) { + var preKeySignalMessage protocol.PreKeySignalMessageStructure + err := json.Unmarshal(serialized, &preKeySignalMessage) + if err != nil { + logger.Error("Error deserializing prekey signal message: ", err) + return nil, err + } + + return &preKeySignalMessage, nil +} + +// JSONSignedPreKeyRecordSerializer is a structure for serializing signed prekey records +// into and from JSON. +type JSONSignedPreKeyRecordSerializer struct{} + +// Serialize will take a signed prekey record structure and convert it to JSON bytes. +func (j *JSONSignedPreKeyRecordSerializer) Serialize(signedPreKey *record.SignedPreKeyStructure) []byte { + serialized, err := json.Marshal(signedPreKey) + if err != nil { + logger.Error("Error serializing signed prekey record: ", err) + } + // logger.Debug("Serialize result: ", string(serialized)) + + return serialized +} + +// Deserialize will take in JSON bytes and return a signed prekey record structure. +func (j *JSONSignedPreKeyRecordSerializer) Deserialize(serialized []byte) (*record.SignedPreKeyStructure, error) { + var signedPreKeyStructure record.SignedPreKeyStructure + err := json.Unmarshal(serialized, &signedPreKeyStructure) + if err != nil { + logger.Error("Error deserializing signed prekey record: ", err) + return nil, err + } + + return &signedPreKeyStructure, nil +} + +// JSONPreKeyRecordSerializer is a structure for serializing prekey records +// into and from JSON. +type JSONPreKeyRecordSerializer struct{} + +// Serialize will take a prekey record structure and convert it to JSON bytes. +func (j *JSONPreKeyRecordSerializer) Serialize(preKey *record.PreKeyStructure) []byte { + serialized, err := json.Marshal(preKey) + if err != nil { + logger.Error("Error serializing prekey record: ", err) + } + // logger.Debug("Serialize result: ", string(serialized)) + + return serialized +} + +// Deserialize will take in JSON bytes and return a prekey record structure. +func (j *JSONPreKeyRecordSerializer) Deserialize(serialized []byte) (*record.PreKeyStructure, error) { + var preKeyStructure record.PreKeyStructure + err := json.Unmarshal(serialized, &preKeyStructure) + if err != nil { + logger.Error("Error deserializing prekey record: ", err) + return nil, err + } + + return &preKeyStructure, nil +} + +// JSONStateSerializer is a structure for serializing session states into +// and from JSON. +type JSONStateSerializer struct{} + +// Serialize will take a session state structure and convert it to JSON bytes. +func (j *JSONStateSerializer) Serialize(state *record.StateStructure) []byte { + serialized, err := json.Marshal(state) + if err != nil { + logger.Error("Error serializing session state: ", err) + } + logger.Debug("Serialize result: ", string(serialized)) + + return serialized +} + +// Deserialize will take in JSON bytes and return a session state structure. +func (j *JSONStateSerializer) Deserialize(serialized []byte) (*record.StateStructure, error) { + var stateStructure record.StateStructure + err := json.Unmarshal(serialized, &stateStructure) + if err != nil { + logger.Error("Error deserializing session state: ", err) + return nil, err + } + + return &stateStructure, nil +} + +// JSONSessionSerializer is a structure for serializing session records into +// and from JSON. +type JSONSessionSerializer struct{} + +// Serialize will take a session structure and convert it to JSON bytes. +func (j *JSONSessionSerializer) Serialize(session *record.SessionStructure) []byte { + serialized, err := json.Marshal(session) + if err != nil { + logger.Error("Error serializing session: ", err) + } + // logger.Debug("Serialize result: ", string(serialized)) + + return serialized +} + +// Deserialize will take in JSON bytes and return a session structure, which can be +// used to create a new Session Record object. +func (j *JSONSessionSerializer) Deserialize(serialized []byte) (*record.SessionStructure, error) { + var sessionStructure record.SessionStructure + err := json.Unmarshal(serialized, &sessionStructure) + if err != nil { + logger.Error("Error deserializing session: ", err) + return nil, err + } + + return &sessionStructure, nil +} + +// JSONSenderKeyDistributionMessageSerializer is a structure for serializing senderkey +// distribution records to and from JSON. +type JSONSenderKeyDistributionMessageSerializer struct{} + +// Serialize will take a senderkey distribution message and convert it to JSON bytes. +func (j *JSONSenderKeyDistributionMessageSerializer) Serialize(message *protocol.SenderKeyDistributionMessageStructure) []byte { + serialized, err := json.Marshal(message) + if err != nil { + logger.Error("Error serializing senderkey distribution message: ", err) + } + // logger.Debug("Serialize result: ", string(serialized)) + + return serialized +} + +// Deserialize will take in JSON bytes and return a message structure, which can be +// used to create a new SenderKey Distribution object. +func (j *JSONSenderKeyDistributionMessageSerializer) Deserialize(serialized []byte) (*protocol.SenderKeyDistributionMessageStructure, error) { + var msgStructure protocol.SenderKeyDistributionMessageStructure + err := json.Unmarshal(serialized, &msgStructure) + if err != nil { + logger.Error("Error deserializing senderkey distribution message: ", err) + return nil, err + } + + return &msgStructure, nil +} + +// JSONSenderKeyMessageSerializer is a structure for serializing senderkey +// messages to and from JSON. +type JSONSenderKeyMessageSerializer struct{} + +// Serialize will take a senderkey message and convert it to JSON bytes. +func (j *JSONSenderKeyMessageSerializer) Serialize(message *protocol.SenderKeyMessageStructure) []byte { + serialized, err := json.Marshal(message) + if err != nil { + logger.Error("Error serializing senderkey distribution message: ", err) + } + // logger.Debug("Serialize result: ", string(serialized)) + + return serialized +} + +// Deserialize will take in JSON bytes and return a message structure, which can be +// used to create a new SenderKey message object. +func (j *JSONSenderKeyMessageSerializer) Deserialize(serialized []byte) (*protocol.SenderKeyMessageStructure, error) { + var msgStructure protocol.SenderKeyMessageStructure + err := json.Unmarshal(serialized, &msgStructure) + if err != nil { + logger.Error("Error deserializing senderkey message: ", err) + return nil, err + } + + return &msgStructure, nil +} + +// JSONSenderKeyStateSerializer is a structure for serializing group session states into +// and from JSON. +type JSONSenderKeyStateSerializer struct{} + +// Serialize will take a session state structure and convert it to JSON bytes. +func (j *JSONSenderKeyStateSerializer) Serialize(state *groupRecord.SenderKeyStateStructure) []byte { + serialized, err := json.Marshal(state) + if err != nil { + logger.Error("Error serializing session state: ", err) + } + // logger.Debug("Serialize result: ", string(serialized)) + + return serialized +} + +// Deserialize will take in JSON bytes and return a session state structure. +func (j *JSONSenderKeyStateSerializer) Deserialize(serialized []byte) (*groupRecord.SenderKeyStateStructure, error) { + var stateStructure groupRecord.SenderKeyStateStructure + err := json.Unmarshal(serialized, &stateStructure) + if err != nil { + logger.Error("Error deserializing session state: ", err) + return nil, err + } + + return &stateStructure, nil +} + +// JSONSenderKeySessionSerializer is a structure for serializing session records into +// and from JSON. +type JSONSenderKeySessionSerializer struct{} + +// Serialize will take a session structure and convert it to JSON bytes. +func (j *JSONSenderKeySessionSerializer) Serialize(session *groupRecord.SenderKeyStructure) []byte { + serialized, err := json.Marshal(session) + if err != nil { + logger.Error("Error serializing session: ", err) + } + // logger.Debug("Serialize result: ", string(serialized)) + + return serialized +} + +// Deserialize will take in JSON bytes and return a session structure, which can be +// used to create a new Session Record object. +func (j *JSONSenderKeySessionSerializer) Deserialize(serialized []byte) (*groupRecord.SenderKeyStructure, error) { + var sessionStructure groupRecord.SenderKeyStructure + err := json.Unmarshal(serialized, &sessionStructure) + if err != nil { + logger.Error("Error deserializing session: ", err) + return nil, err + } + + return &sessionStructure, nil +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/serialize/LocalStorageProtocol.pb.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/serialize/LocalStorageProtocol.pb.go new file mode 100644 index 0000000..e709739 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/serialize/LocalStorageProtocol.pb.go @@ -0,0 +1,1500 @@ +// From https://github.com/signalapp/libsignal-protocol-c/blob/master/protobuf/LocalStorageProtocol.proto + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.12.4 +// source: serialize/LocalStorageProtocol.proto + +package serialize + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type SessionStructure struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SessionVersion *uint32 `protobuf:"varint,1,opt,name=sessionVersion" json:"sessionVersion,omitempty"` + LocalIdentityPublic []byte `protobuf:"bytes,2,opt,name=localIdentityPublic" json:"localIdentityPublic,omitempty"` + RemoteIdentityPublic []byte `protobuf:"bytes,3,opt,name=remoteIdentityPublic" json:"remoteIdentityPublic,omitempty"` + RootKey []byte `protobuf:"bytes,4,opt,name=rootKey" json:"rootKey,omitempty"` + PreviousCounter *uint32 `protobuf:"varint,5,opt,name=previousCounter" json:"previousCounter,omitempty"` + SenderChain *SessionStructure_Chain `protobuf:"bytes,6,opt,name=senderChain" json:"senderChain,omitempty"` + ReceiverChains []*SessionStructure_Chain `protobuf:"bytes,7,rep,name=receiverChains" json:"receiverChains,omitempty"` + PendingKeyExchange *SessionStructure_PendingKeyExchange `protobuf:"bytes,8,opt,name=pendingKeyExchange" json:"pendingKeyExchange,omitempty"` + PendingPreKey *SessionStructure_PendingPreKey `protobuf:"bytes,9,opt,name=pendingPreKey" json:"pendingPreKey,omitempty"` + RemoteRegistrationId *uint32 `protobuf:"varint,10,opt,name=remoteRegistrationId" json:"remoteRegistrationId,omitempty"` + LocalRegistrationId *uint32 `protobuf:"varint,11,opt,name=localRegistrationId" json:"localRegistrationId,omitempty"` + NeedsRefresh *bool `protobuf:"varint,12,opt,name=needsRefresh" json:"needsRefresh,omitempty"` + AliceBaseKey []byte `protobuf:"bytes,13,opt,name=aliceBaseKey" json:"aliceBaseKey,omitempty"` +} + +func (x *SessionStructure) Reset() { + *x = SessionStructure{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SessionStructure) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionStructure) ProtoMessage() {} + +func (x *SessionStructure) ProtoReflect() protoreflect.Message { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SessionStructure.ProtoReflect.Descriptor instead. +func (*SessionStructure) Descriptor() ([]byte, []int) { + return file_serialize_LocalStorageProtocol_proto_rawDescGZIP(), []int{0} +} + +func (x *SessionStructure) GetSessionVersion() uint32 { + if x != nil && x.SessionVersion != nil { + return *x.SessionVersion + } + return 0 +} + +func (x *SessionStructure) GetLocalIdentityPublic() []byte { + if x != nil { + return x.LocalIdentityPublic + } + return nil +} + +func (x *SessionStructure) GetRemoteIdentityPublic() []byte { + if x != nil { + return x.RemoteIdentityPublic + } + return nil +} + +func (x *SessionStructure) GetRootKey() []byte { + if x != nil { + return x.RootKey + } + return nil +} + +func (x *SessionStructure) GetPreviousCounter() uint32 { + if x != nil && x.PreviousCounter != nil { + return *x.PreviousCounter + } + return 0 +} + +func (x *SessionStructure) GetSenderChain() *SessionStructure_Chain { + if x != nil { + return x.SenderChain + } + return nil +} + +func (x *SessionStructure) GetReceiverChains() []*SessionStructure_Chain { + if x != nil { + return x.ReceiverChains + } + return nil +} + +func (x *SessionStructure) GetPendingKeyExchange() *SessionStructure_PendingKeyExchange { + if x != nil { + return x.PendingKeyExchange + } + return nil +} + +func (x *SessionStructure) GetPendingPreKey() *SessionStructure_PendingPreKey { + if x != nil { + return x.PendingPreKey + } + return nil +} + +func (x *SessionStructure) GetRemoteRegistrationId() uint32 { + if x != nil && x.RemoteRegistrationId != nil { + return *x.RemoteRegistrationId + } + return 0 +} + +func (x *SessionStructure) GetLocalRegistrationId() uint32 { + if x != nil && x.LocalRegistrationId != nil { + return *x.LocalRegistrationId + } + return 0 +} + +func (x *SessionStructure) GetNeedsRefresh() bool { + if x != nil && x.NeedsRefresh != nil { + return *x.NeedsRefresh + } + return false +} + +func (x *SessionStructure) GetAliceBaseKey() []byte { + if x != nil { + return x.AliceBaseKey + } + return nil +} + +type RecordStructure struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CurrentSession *SessionStructure `protobuf:"bytes,1,opt,name=currentSession" json:"currentSession,omitempty"` + PreviousSessions []*SessionStructure `protobuf:"bytes,2,rep,name=previousSessions" json:"previousSessions,omitempty"` +} + +func (x *RecordStructure) Reset() { + *x = RecordStructure{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RecordStructure) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RecordStructure) ProtoMessage() {} + +func (x *RecordStructure) ProtoReflect() protoreflect.Message { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RecordStructure.ProtoReflect.Descriptor instead. +func (*RecordStructure) Descriptor() ([]byte, []int) { + return file_serialize_LocalStorageProtocol_proto_rawDescGZIP(), []int{1} +} + +func (x *RecordStructure) GetCurrentSession() *SessionStructure { + if x != nil { + return x.CurrentSession + } + return nil +} + +func (x *RecordStructure) GetPreviousSessions() []*SessionStructure { + if x != nil { + return x.PreviousSessions + } + return nil +} + +type PreKeyRecordStructure struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id *uint32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` + PublicKey []byte `protobuf:"bytes,2,opt,name=publicKey" json:"publicKey,omitempty"` + PrivateKey []byte `protobuf:"bytes,3,opt,name=privateKey" json:"privateKey,omitempty"` +} + +func (x *PreKeyRecordStructure) Reset() { + *x = PreKeyRecordStructure{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PreKeyRecordStructure) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PreKeyRecordStructure) ProtoMessage() {} + +func (x *PreKeyRecordStructure) ProtoReflect() protoreflect.Message { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PreKeyRecordStructure.ProtoReflect.Descriptor instead. +func (*PreKeyRecordStructure) Descriptor() ([]byte, []int) { + return file_serialize_LocalStorageProtocol_proto_rawDescGZIP(), []int{2} +} + +func (x *PreKeyRecordStructure) GetId() uint32 { + if x != nil && x.Id != nil { + return *x.Id + } + return 0 +} + +func (x *PreKeyRecordStructure) GetPublicKey() []byte { + if x != nil { + return x.PublicKey + } + return nil +} + +func (x *PreKeyRecordStructure) GetPrivateKey() []byte { + if x != nil { + return x.PrivateKey + } + return nil +} + +type SignedPreKeyRecordStructure struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id *uint32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` + PublicKey []byte `protobuf:"bytes,2,opt,name=publicKey" json:"publicKey,omitempty"` + PrivateKey []byte `protobuf:"bytes,3,opt,name=privateKey" json:"privateKey,omitempty"` + Signature []byte `protobuf:"bytes,4,opt,name=signature" json:"signature,omitempty"` + Timestamp *uint64 `protobuf:"fixed64,5,opt,name=timestamp" json:"timestamp,omitempty"` +} + +func (x *SignedPreKeyRecordStructure) Reset() { + *x = SignedPreKeyRecordStructure{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SignedPreKeyRecordStructure) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SignedPreKeyRecordStructure) ProtoMessage() {} + +func (x *SignedPreKeyRecordStructure) ProtoReflect() protoreflect.Message { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SignedPreKeyRecordStructure.ProtoReflect.Descriptor instead. +func (*SignedPreKeyRecordStructure) Descriptor() ([]byte, []int) { + return file_serialize_LocalStorageProtocol_proto_rawDescGZIP(), []int{3} +} + +func (x *SignedPreKeyRecordStructure) GetId() uint32 { + if x != nil && x.Id != nil { + return *x.Id + } + return 0 +} + +func (x *SignedPreKeyRecordStructure) GetPublicKey() []byte { + if x != nil { + return x.PublicKey + } + return nil +} + +func (x *SignedPreKeyRecordStructure) GetPrivateKey() []byte { + if x != nil { + return x.PrivateKey + } + return nil +} + +func (x *SignedPreKeyRecordStructure) GetSignature() []byte { + if x != nil { + return x.Signature + } + return nil +} + +func (x *SignedPreKeyRecordStructure) GetTimestamp() uint64 { + if x != nil && x.Timestamp != nil { + return *x.Timestamp + } + return 0 +} + +type IdentityKeyPairStructure struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PublicKey []byte `protobuf:"bytes,1,opt,name=publicKey" json:"publicKey,omitempty"` + PrivateKey []byte `protobuf:"bytes,2,opt,name=privateKey" json:"privateKey,omitempty"` +} + +func (x *IdentityKeyPairStructure) Reset() { + *x = IdentityKeyPairStructure{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IdentityKeyPairStructure) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IdentityKeyPairStructure) ProtoMessage() {} + +func (x *IdentityKeyPairStructure) ProtoReflect() protoreflect.Message { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IdentityKeyPairStructure.ProtoReflect.Descriptor instead. +func (*IdentityKeyPairStructure) Descriptor() ([]byte, []int) { + return file_serialize_LocalStorageProtocol_proto_rawDescGZIP(), []int{4} +} + +func (x *IdentityKeyPairStructure) GetPublicKey() []byte { + if x != nil { + return x.PublicKey + } + return nil +} + +func (x *IdentityKeyPairStructure) GetPrivateKey() []byte { + if x != nil { + return x.PrivateKey + } + return nil +} + +type SenderKeyStateStructure struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SenderKeyId *uint32 `protobuf:"varint,1,opt,name=senderKeyId" json:"senderKeyId,omitempty"` + SenderChainKey *SenderKeyStateStructure_SenderChainKey `protobuf:"bytes,2,opt,name=senderChainKey" json:"senderChainKey,omitempty"` + SenderSigningKey *SenderKeyStateStructure_SenderSigningKey `protobuf:"bytes,3,opt,name=senderSigningKey" json:"senderSigningKey,omitempty"` + SenderMessageKeys []*SenderKeyStateStructure_SenderMessageKey `protobuf:"bytes,4,rep,name=senderMessageKeys" json:"senderMessageKeys,omitempty"` +} + +func (x *SenderKeyStateStructure) Reset() { + *x = SenderKeyStateStructure{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SenderKeyStateStructure) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SenderKeyStateStructure) ProtoMessage() {} + +func (x *SenderKeyStateStructure) ProtoReflect() protoreflect.Message { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SenderKeyStateStructure.ProtoReflect.Descriptor instead. +func (*SenderKeyStateStructure) Descriptor() ([]byte, []int) { + return file_serialize_LocalStorageProtocol_proto_rawDescGZIP(), []int{5} +} + +func (x *SenderKeyStateStructure) GetSenderKeyId() uint32 { + if x != nil && x.SenderKeyId != nil { + return *x.SenderKeyId + } + return 0 +} + +func (x *SenderKeyStateStructure) GetSenderChainKey() *SenderKeyStateStructure_SenderChainKey { + if x != nil { + return x.SenderChainKey + } + return nil +} + +func (x *SenderKeyStateStructure) GetSenderSigningKey() *SenderKeyStateStructure_SenderSigningKey { + if x != nil { + return x.SenderSigningKey + } + return nil +} + +func (x *SenderKeyStateStructure) GetSenderMessageKeys() []*SenderKeyStateStructure_SenderMessageKey { + if x != nil { + return x.SenderMessageKeys + } + return nil +} + +type SenderKeyRecordStructure struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SenderKeyStates []*SenderKeyStateStructure `protobuf:"bytes,1,rep,name=senderKeyStates" json:"senderKeyStates,omitempty"` +} + +func (x *SenderKeyRecordStructure) Reset() { + *x = SenderKeyRecordStructure{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SenderKeyRecordStructure) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SenderKeyRecordStructure) ProtoMessage() {} + +func (x *SenderKeyRecordStructure) ProtoReflect() protoreflect.Message { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SenderKeyRecordStructure.ProtoReflect.Descriptor instead. +func (*SenderKeyRecordStructure) Descriptor() ([]byte, []int) { + return file_serialize_LocalStorageProtocol_proto_rawDescGZIP(), []int{6} +} + +func (x *SenderKeyRecordStructure) GetSenderKeyStates() []*SenderKeyStateStructure { + if x != nil { + return x.SenderKeyStates + } + return nil +} + +type SessionStructure_Chain struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SenderRatchetKey []byte `protobuf:"bytes,1,opt,name=senderRatchetKey" json:"senderRatchetKey,omitempty"` + SenderRatchetKeyPrivate []byte `protobuf:"bytes,2,opt,name=senderRatchetKeyPrivate" json:"senderRatchetKeyPrivate,omitempty"` + ChainKey *SessionStructure_Chain_ChainKey `protobuf:"bytes,3,opt,name=chainKey" json:"chainKey,omitempty"` + MessageKeys []*SessionStructure_Chain_MessageKey `protobuf:"bytes,4,rep,name=messageKeys" json:"messageKeys,omitempty"` +} + +func (x *SessionStructure_Chain) Reset() { + *x = SessionStructure_Chain{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SessionStructure_Chain) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionStructure_Chain) ProtoMessage() {} + +func (x *SessionStructure_Chain) ProtoReflect() protoreflect.Message { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SessionStructure_Chain.ProtoReflect.Descriptor instead. +func (*SessionStructure_Chain) Descriptor() ([]byte, []int) { + return file_serialize_LocalStorageProtocol_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *SessionStructure_Chain) GetSenderRatchetKey() []byte { + if x != nil { + return x.SenderRatchetKey + } + return nil +} + +func (x *SessionStructure_Chain) GetSenderRatchetKeyPrivate() []byte { + if x != nil { + return x.SenderRatchetKeyPrivate + } + return nil +} + +func (x *SessionStructure_Chain) GetChainKey() *SessionStructure_Chain_ChainKey { + if x != nil { + return x.ChainKey + } + return nil +} + +func (x *SessionStructure_Chain) GetMessageKeys() []*SessionStructure_Chain_MessageKey { + if x != nil { + return x.MessageKeys + } + return nil +} + +type SessionStructure_PendingKeyExchange struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Sequence *uint32 `protobuf:"varint,1,opt,name=sequence" json:"sequence,omitempty"` + LocalBaseKey []byte `protobuf:"bytes,2,opt,name=localBaseKey" json:"localBaseKey,omitempty"` + LocalBaseKeyPrivate []byte `protobuf:"bytes,3,opt,name=localBaseKeyPrivate" json:"localBaseKeyPrivate,omitempty"` + LocalRatchetKey []byte `protobuf:"bytes,4,opt,name=localRatchetKey" json:"localRatchetKey,omitempty"` + LocalRatchetKeyPrivate []byte `protobuf:"bytes,5,opt,name=localRatchetKeyPrivate" json:"localRatchetKeyPrivate,omitempty"` + LocalIdentityKey []byte `protobuf:"bytes,7,opt,name=localIdentityKey" json:"localIdentityKey,omitempty"` + LocalIdentityKeyPrivate []byte `protobuf:"bytes,8,opt,name=localIdentityKeyPrivate" json:"localIdentityKeyPrivate,omitempty"` +} + +func (x *SessionStructure_PendingKeyExchange) Reset() { + *x = SessionStructure_PendingKeyExchange{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SessionStructure_PendingKeyExchange) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionStructure_PendingKeyExchange) ProtoMessage() {} + +func (x *SessionStructure_PendingKeyExchange) ProtoReflect() protoreflect.Message { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SessionStructure_PendingKeyExchange.ProtoReflect.Descriptor instead. +func (*SessionStructure_PendingKeyExchange) Descriptor() ([]byte, []int) { + return file_serialize_LocalStorageProtocol_proto_rawDescGZIP(), []int{0, 1} +} + +func (x *SessionStructure_PendingKeyExchange) GetSequence() uint32 { + if x != nil && x.Sequence != nil { + return *x.Sequence + } + return 0 +} + +func (x *SessionStructure_PendingKeyExchange) GetLocalBaseKey() []byte { + if x != nil { + return x.LocalBaseKey + } + return nil +} + +func (x *SessionStructure_PendingKeyExchange) GetLocalBaseKeyPrivate() []byte { + if x != nil { + return x.LocalBaseKeyPrivate + } + return nil +} + +func (x *SessionStructure_PendingKeyExchange) GetLocalRatchetKey() []byte { + if x != nil { + return x.LocalRatchetKey + } + return nil +} + +func (x *SessionStructure_PendingKeyExchange) GetLocalRatchetKeyPrivate() []byte { + if x != nil { + return x.LocalRatchetKeyPrivate + } + return nil +} + +func (x *SessionStructure_PendingKeyExchange) GetLocalIdentityKey() []byte { + if x != nil { + return x.LocalIdentityKey + } + return nil +} + +func (x *SessionStructure_PendingKeyExchange) GetLocalIdentityKeyPrivate() []byte { + if x != nil { + return x.LocalIdentityKeyPrivate + } + return nil +} + +type SessionStructure_PendingPreKey struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PreKeyId *uint32 `protobuf:"varint,1,opt,name=preKeyId" json:"preKeyId,omitempty"` + SignedPreKeyId *int32 `protobuf:"varint,3,opt,name=signedPreKeyId" json:"signedPreKeyId,omitempty"` + BaseKey []byte `protobuf:"bytes,2,opt,name=baseKey" json:"baseKey,omitempty"` +} + +func (x *SessionStructure_PendingPreKey) Reset() { + *x = SessionStructure_PendingPreKey{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SessionStructure_PendingPreKey) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionStructure_PendingPreKey) ProtoMessage() {} + +func (x *SessionStructure_PendingPreKey) ProtoReflect() protoreflect.Message { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SessionStructure_PendingPreKey.ProtoReflect.Descriptor instead. +func (*SessionStructure_PendingPreKey) Descriptor() ([]byte, []int) { + return file_serialize_LocalStorageProtocol_proto_rawDescGZIP(), []int{0, 2} +} + +func (x *SessionStructure_PendingPreKey) GetPreKeyId() uint32 { + if x != nil && x.PreKeyId != nil { + return *x.PreKeyId + } + return 0 +} + +func (x *SessionStructure_PendingPreKey) GetSignedPreKeyId() int32 { + if x != nil && x.SignedPreKeyId != nil { + return *x.SignedPreKeyId + } + return 0 +} + +func (x *SessionStructure_PendingPreKey) GetBaseKey() []byte { + if x != nil { + return x.BaseKey + } + return nil +} + +type SessionStructure_Chain_ChainKey struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Index *uint32 `protobuf:"varint,1,opt,name=index" json:"index,omitempty"` + Key []byte `protobuf:"bytes,2,opt,name=key" json:"key,omitempty"` +} + +func (x *SessionStructure_Chain_ChainKey) Reset() { + *x = SessionStructure_Chain_ChainKey{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SessionStructure_Chain_ChainKey) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionStructure_Chain_ChainKey) ProtoMessage() {} + +func (x *SessionStructure_Chain_ChainKey) ProtoReflect() protoreflect.Message { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SessionStructure_Chain_ChainKey.ProtoReflect.Descriptor instead. +func (*SessionStructure_Chain_ChainKey) Descriptor() ([]byte, []int) { + return file_serialize_LocalStorageProtocol_proto_rawDescGZIP(), []int{0, 0, 0} +} + +func (x *SessionStructure_Chain_ChainKey) GetIndex() uint32 { + if x != nil && x.Index != nil { + return *x.Index + } + return 0 +} + +func (x *SessionStructure_Chain_ChainKey) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +type SessionStructure_Chain_MessageKey struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Index *uint32 `protobuf:"varint,1,opt,name=index" json:"index,omitempty"` + CipherKey []byte `protobuf:"bytes,2,opt,name=cipherKey" json:"cipherKey,omitempty"` + MacKey []byte `protobuf:"bytes,3,opt,name=macKey" json:"macKey,omitempty"` + Iv []byte `protobuf:"bytes,4,opt,name=iv" json:"iv,omitempty"` +} + +func (x *SessionStructure_Chain_MessageKey) Reset() { + *x = SessionStructure_Chain_MessageKey{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SessionStructure_Chain_MessageKey) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SessionStructure_Chain_MessageKey) ProtoMessage() {} + +func (x *SessionStructure_Chain_MessageKey) ProtoReflect() protoreflect.Message { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SessionStructure_Chain_MessageKey.ProtoReflect.Descriptor instead. +func (*SessionStructure_Chain_MessageKey) Descriptor() ([]byte, []int) { + return file_serialize_LocalStorageProtocol_proto_rawDescGZIP(), []int{0, 0, 1} +} + +func (x *SessionStructure_Chain_MessageKey) GetIndex() uint32 { + if x != nil && x.Index != nil { + return *x.Index + } + return 0 +} + +func (x *SessionStructure_Chain_MessageKey) GetCipherKey() []byte { + if x != nil { + return x.CipherKey + } + return nil +} + +func (x *SessionStructure_Chain_MessageKey) GetMacKey() []byte { + if x != nil { + return x.MacKey + } + return nil +} + +func (x *SessionStructure_Chain_MessageKey) GetIv() []byte { + if x != nil { + return x.Iv + } + return nil +} + +type SenderKeyStateStructure_SenderChainKey struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Iteration *uint32 `protobuf:"varint,1,opt,name=iteration" json:"iteration,omitempty"` + Seed []byte `protobuf:"bytes,2,opt,name=seed" json:"seed,omitempty"` +} + +func (x *SenderKeyStateStructure_SenderChainKey) Reset() { + *x = SenderKeyStateStructure_SenderChainKey{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SenderKeyStateStructure_SenderChainKey) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SenderKeyStateStructure_SenderChainKey) ProtoMessage() {} + +func (x *SenderKeyStateStructure_SenderChainKey) ProtoReflect() protoreflect.Message { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SenderKeyStateStructure_SenderChainKey.ProtoReflect.Descriptor instead. +func (*SenderKeyStateStructure_SenderChainKey) Descriptor() ([]byte, []int) { + return file_serialize_LocalStorageProtocol_proto_rawDescGZIP(), []int{5, 0} +} + +func (x *SenderKeyStateStructure_SenderChainKey) GetIteration() uint32 { + if x != nil && x.Iteration != nil { + return *x.Iteration + } + return 0 +} + +func (x *SenderKeyStateStructure_SenderChainKey) GetSeed() []byte { + if x != nil { + return x.Seed + } + return nil +} + +type SenderKeyStateStructure_SenderMessageKey struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Iteration *uint32 `protobuf:"varint,1,opt,name=iteration" json:"iteration,omitempty"` + Seed []byte `protobuf:"bytes,2,opt,name=seed" json:"seed,omitempty"` +} + +func (x *SenderKeyStateStructure_SenderMessageKey) Reset() { + *x = SenderKeyStateStructure_SenderMessageKey{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SenderKeyStateStructure_SenderMessageKey) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SenderKeyStateStructure_SenderMessageKey) ProtoMessage() {} + +func (x *SenderKeyStateStructure_SenderMessageKey) ProtoReflect() protoreflect.Message { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SenderKeyStateStructure_SenderMessageKey.ProtoReflect.Descriptor instead. +func (*SenderKeyStateStructure_SenderMessageKey) Descriptor() ([]byte, []int) { + return file_serialize_LocalStorageProtocol_proto_rawDescGZIP(), []int{5, 1} +} + +func (x *SenderKeyStateStructure_SenderMessageKey) GetIteration() uint32 { + if x != nil && x.Iteration != nil { + return *x.Iteration + } + return 0 +} + +func (x *SenderKeyStateStructure_SenderMessageKey) GetSeed() []byte { + if x != nil { + return x.Seed + } + return nil +} + +type SenderKeyStateStructure_SenderSigningKey struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Public []byte `protobuf:"bytes,1,opt,name=public" json:"public,omitempty"` + Private []byte `protobuf:"bytes,2,opt,name=private" json:"private,omitempty"` +} + +func (x *SenderKeyStateStructure_SenderSigningKey) Reset() { + *x = SenderKeyStateStructure_SenderSigningKey{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SenderKeyStateStructure_SenderSigningKey) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SenderKeyStateStructure_SenderSigningKey) ProtoMessage() {} + +func (x *SenderKeyStateStructure_SenderSigningKey) ProtoReflect() protoreflect.Message { + mi := &file_serialize_LocalStorageProtocol_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SenderKeyStateStructure_SenderSigningKey.ProtoReflect.Descriptor instead. +func (*SenderKeyStateStructure_SenderSigningKey) Descriptor() ([]byte, []int) { + return file_serialize_LocalStorageProtocol_proto_rawDescGZIP(), []int{5, 2} +} + +func (x *SenderKeyStateStructure_SenderSigningKey) GetPublic() []byte { + if x != nil { + return x.Public + } + return nil +} + +func (x *SenderKeyStateStructure_SenderSigningKey) GetPrivate() []byte { + if x != nil { + return x.Private + } + return nil +} + +var File_serialize_LocalStorageProtocol_proto protoreflect.FileDescriptor + +var file_serialize_LocalStorageProtocol_proto_rawDesc = []byte{ + 0x0a, 0x24, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x2f, 0x4c, 0x6f, 0x63, 0x61, + 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x74, 0x65, 0x78, 0x74, 0x73, 0x65, 0x63, 0x75, + 0x72, 0x65, 0x22, 0xbf, 0x0c, 0x0a, 0x10, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x74, + 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x73, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x0e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, + 0x30, 0x0a, 0x13, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, + 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x13, 0x6c, 0x6f, + 0x63, 0x61, 0x6c, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, 0x75, 0x62, 0x6c, 0x69, + 0x63, 0x12, 0x32, 0x0a, 0x14, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x74, 0x79, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x14, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x50, + 0x75, 0x62, 0x6c, 0x69, 0x63, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x6f, 0x6f, 0x74, 0x4b, 0x65, 0x79, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x72, 0x6f, 0x6f, 0x74, 0x4b, 0x65, 0x79, 0x12, + 0x28, 0x0a, 0x0f, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0f, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, + 0x75, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x44, 0x0a, 0x0b, 0x73, 0x65, 0x6e, + 0x64, 0x65, 0x72, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, + 0x2e, 0x74, 0x65, 0x78, 0x74, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x2e, 0x53, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x43, 0x68, 0x61, + 0x69, 0x6e, 0x52, 0x0b, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x12, + 0x4a, 0x0a, 0x0e, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x43, 0x68, 0x61, 0x69, 0x6e, + 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x74, 0x65, 0x78, 0x74, 0x73, 0x65, + 0x63, 0x75, 0x72, 0x65, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x72, 0x75, + 0x63, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x52, 0x0e, 0x72, 0x65, 0x63, + 0x65, 0x69, 0x76, 0x65, 0x72, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x73, 0x12, 0x5f, 0x0a, 0x12, 0x70, + 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, + 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x74, 0x65, 0x78, 0x74, 0x73, 0x65, + 0x63, 0x75, 0x72, 0x65, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x72, 0x75, + 0x63, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, + 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x12, 0x70, 0x65, 0x6e, 0x64, 0x69, 0x6e, + 0x67, 0x4b, 0x65, 0x79, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x50, 0x0a, 0x0d, + 0x70, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x65, 0x4b, 0x65, 0x79, 0x18, 0x09, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x74, 0x65, 0x78, 0x74, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, + 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, + 0x65, 0x2e, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x65, 0x4b, 0x65, 0x79, 0x52, + 0x0d, 0x70, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x50, 0x72, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x32, + 0x0a, 0x14, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x14, 0x72, 0x65, + 0x6d, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x49, 0x64, 0x12, 0x30, 0x0a, 0x13, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x52, 0x65, 0x67, 0x69, 0x73, + 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x13, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x6e, 0x65, 0x65, 0x64, 0x73, 0x52, 0x65, 0x66, + 0x72, 0x65, 0x73, 0x68, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x6e, 0x65, 0x65, 0x64, + 0x73, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x6c, 0x69, 0x63, + 0x65, 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, + 0x61, 0x6c, 0x69, 0x63, 0x65, 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x1a, 0xa5, 0x03, 0x0a, + 0x05, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x12, 0x2a, 0x0a, 0x10, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, + 0x52, 0x61, 0x74, 0x63, 0x68, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x10, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x52, 0x61, 0x74, 0x63, 0x68, 0x65, 0x74, 0x4b, + 0x65, 0x79, 0x12, 0x38, 0x0a, 0x17, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x52, 0x61, 0x74, 0x63, + 0x68, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x17, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x52, 0x61, 0x74, 0x63, 0x68, + 0x65, 0x74, 0x4b, 0x65, 0x79, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x12, 0x47, 0x0a, 0x08, + 0x63, 0x68, 0x61, 0x69, 0x6e, 0x4b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, + 0x2e, 0x74, 0x65, 0x78, 0x74, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x2e, 0x53, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x43, 0x68, 0x61, + 0x69, 0x6e, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x4b, 0x65, 0x79, 0x52, 0x08, 0x63, 0x68, 0x61, + 0x69, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x4f, 0x0a, 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x4b, 0x65, 0x79, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x74, 0x65, 0x78, + 0x74, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, + 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4b, 0x65, 0x79, 0x52, 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x4b, 0x65, 0x79, 0x73, 0x1a, 0x32, 0x0a, 0x08, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x4b, + 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x1a, 0x68, 0x0a, 0x0a, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, + 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1c, + 0x0a, 0x09, 0x63, 0x69, 0x70, 0x68, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x09, 0x63, 0x69, 0x70, 0x68, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x12, 0x16, 0x0a, 0x06, + 0x6d, 0x61, 0x63, 0x4b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x6d, 0x61, + 0x63, 0x4b, 0x65, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x76, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x02, 0x69, 0x76, 0x1a, 0xce, 0x02, 0x0a, 0x12, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, + 0x4b, 0x65, 0x79, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x73, + 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x73, + 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x6c, 0x6f, 0x63, 0x61, 0x6c, + 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x6c, + 0x6f, 0x63, 0x61, 0x6c, 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x30, 0x0a, 0x13, 0x6c, + 0x6f, 0x63, 0x61, 0x6c, 0x42, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x50, 0x72, 0x69, 0x76, 0x61, + 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x13, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x42, + 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x12, 0x28, 0x0a, + 0x0f, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x52, 0x61, 0x74, 0x63, 0x68, 0x65, 0x74, 0x4b, 0x65, 0x79, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0f, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x52, 0x61, 0x74, + 0x63, 0x68, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x36, 0x0a, 0x16, 0x6c, 0x6f, 0x63, 0x61, 0x6c, + 0x52, 0x61, 0x74, 0x63, 0x68, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, + 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x16, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x52, 0x61, + 0x74, 0x63, 0x68, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x12, + 0x2a, 0x0a, 0x10, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, + 0x4b, 0x65, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x10, 0x6c, 0x6f, 0x63, 0x61, 0x6c, + 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x12, 0x38, 0x0a, 0x17, 0x6c, + 0x6f, 0x63, 0x61, 0x6c, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x50, + 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x17, 0x6c, 0x6f, + 0x63, 0x61, 0x6c, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x50, 0x72, + 0x69, 0x76, 0x61, 0x74, 0x65, 0x1a, 0x6d, 0x0a, 0x0d, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, + 0x50, 0x72, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x65, 0x4b, 0x65, 0x79, + 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x72, 0x65, 0x4b, 0x65, 0x79, + 0x49, 0x64, 0x12, 0x26, 0x0a, 0x0e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x50, 0x72, 0x65, 0x4b, + 0x65, 0x79, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x73, 0x69, 0x67, 0x6e, + 0x65, 0x64, 0x50, 0x72, 0x65, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x61, + 0x73, 0x65, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x62, 0x61, 0x73, + 0x65, 0x4b, 0x65, 0x79, 0x22, 0xa1, 0x01, 0x0a, 0x0f, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x53, + 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x0e, 0x63, 0x75, 0x72, 0x72, + 0x65, 0x6e, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1c, 0x2e, 0x74, 0x65, 0x78, 0x74, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x2e, 0x53, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0e, + 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x48, + 0x0a, 0x10, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x74, 0x65, 0x78, 0x74, 0x73, + 0x65, 0x63, 0x75, 0x72, 0x65, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x72, + 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x52, 0x10, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, + 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x65, 0x0a, 0x15, 0x50, 0x72, 0x65, 0x4b, + 0x65, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, + 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, + 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, + 0x1e, 0x0a, 0x0a, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x22, + 0xa7, 0x01, 0x0a, 0x1b, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x50, 0x72, 0x65, 0x4b, 0x65, 0x79, + 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x1c, 0x0a, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x1e, 0x0a, + 0x0a, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x0a, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, + 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x06, 0x52, 0x09, + 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x58, 0x0a, 0x18, 0x49, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x50, 0x61, 0x69, 0x72, 0x53, 0x74, 0x72, 0x75, + 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, + 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, + 0x4b, 0x65, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x4b, 0x65, + 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, + 0x4b, 0x65, 0x79, 0x22, 0xad, 0x04, 0x0a, 0x17, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4b, 0x65, + 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, + 0x20, 0x0a, 0x0b, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x49, + 0x64, 0x12, 0x5a, 0x0a, 0x0e, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x43, 0x68, 0x61, 0x69, 0x6e, + 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x74, 0x65, 0x78, 0x74, + 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4b, 0x65, 0x79, + 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x53, + 0x65, 0x6e, 0x64, 0x65, 0x72, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x4b, 0x65, 0x79, 0x52, 0x0e, 0x73, + 0x65, 0x6e, 0x64, 0x65, 0x72, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x60, 0x0a, + 0x10, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x53, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x4b, 0x65, + 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x74, 0x65, 0x78, 0x74, 0x73, 0x65, + 0x63, 0x75, 0x72, 0x65, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x53, 0x74, + 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x53, 0x65, 0x6e, + 0x64, 0x65, 0x72, 0x53, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x52, 0x10, 0x73, + 0x65, 0x6e, 0x64, 0x65, 0x72, 0x53, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x12, + 0x62, 0x0a, 0x11, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x4b, 0x65, 0x79, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x74, 0x65, 0x78, + 0x74, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4b, 0x65, + 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x2e, + 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4b, 0x65, 0x79, + 0x52, 0x11, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4b, + 0x65, 0x79, 0x73, 0x1a, 0x42, 0x0a, 0x0e, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x43, 0x68, 0x61, + 0x69, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x65, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x04, 0x73, 0x65, 0x65, 0x64, 0x1a, 0x44, 0x0a, 0x10, 0x53, 0x65, 0x6e, 0x64, 0x65, + 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x69, + 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, + 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x65, 0x65, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x73, 0x65, 0x65, 0x64, 0x1a, 0x44, 0x0a, + 0x10, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x53, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x4b, 0x65, + 0x79, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x06, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x69, + 0x76, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x72, 0x69, 0x76, + 0x61, 0x74, 0x65, 0x22, 0x69, 0x0a, 0x18, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4b, 0x65, 0x79, + 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, + 0x4d, 0x0a, 0x0f, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x74, 0x65, 0x78, 0x74, 0x73, + 0x65, 0x63, 0x75, 0x72, 0x65, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x53, + 0x74, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x52, 0x0f, 0x73, + 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x42, 0x33, + 0x0a, 0x22, 0x6f, 0x72, 0x67, 0x2e, 0x77, 0x68, 0x69, 0x73, 0x70, 0x65, 0x72, 0x73, 0x79, 0x73, + 0x74, 0x65, 0x6d, 0x73, 0x2e, 0x6c, 0x69, 0x62, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x2e, 0x73, + 0x74, 0x61, 0x74, 0x65, 0x42, 0x0d, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x73, +} + +var ( + file_serialize_LocalStorageProtocol_proto_rawDescOnce sync.Once + file_serialize_LocalStorageProtocol_proto_rawDescData = file_serialize_LocalStorageProtocol_proto_rawDesc +) + +func file_serialize_LocalStorageProtocol_proto_rawDescGZIP() []byte { + file_serialize_LocalStorageProtocol_proto_rawDescOnce.Do(func() { + file_serialize_LocalStorageProtocol_proto_rawDescData = protoimpl.X.CompressGZIP(file_serialize_LocalStorageProtocol_proto_rawDescData) + }) + return file_serialize_LocalStorageProtocol_proto_rawDescData +} + +var file_serialize_LocalStorageProtocol_proto_msgTypes = make([]protoimpl.MessageInfo, 15) +var file_serialize_LocalStorageProtocol_proto_goTypes = []interface{}{ + (*SessionStructure)(nil), // 0: textsecure.SessionStructure + (*RecordStructure)(nil), // 1: textsecure.RecordStructure + (*PreKeyRecordStructure)(nil), // 2: textsecure.PreKeyRecordStructure + (*SignedPreKeyRecordStructure)(nil), // 3: textsecure.SignedPreKeyRecordStructure + (*IdentityKeyPairStructure)(nil), // 4: textsecure.IdentityKeyPairStructure + (*SenderKeyStateStructure)(nil), // 5: textsecure.SenderKeyStateStructure + (*SenderKeyRecordStructure)(nil), // 6: textsecure.SenderKeyRecordStructure + (*SessionStructure_Chain)(nil), // 7: textsecure.SessionStructure.Chain + (*SessionStructure_PendingKeyExchange)(nil), // 8: textsecure.SessionStructure.PendingKeyExchange + (*SessionStructure_PendingPreKey)(nil), // 9: textsecure.SessionStructure.PendingPreKey + (*SessionStructure_Chain_ChainKey)(nil), // 10: textsecure.SessionStructure.Chain.ChainKey + (*SessionStructure_Chain_MessageKey)(nil), // 11: textsecure.SessionStructure.Chain.MessageKey + (*SenderKeyStateStructure_SenderChainKey)(nil), // 12: textsecure.SenderKeyStateStructure.SenderChainKey + (*SenderKeyStateStructure_SenderMessageKey)(nil), // 13: textsecure.SenderKeyStateStructure.SenderMessageKey + (*SenderKeyStateStructure_SenderSigningKey)(nil), // 14: textsecure.SenderKeyStateStructure.SenderSigningKey +} +var file_serialize_LocalStorageProtocol_proto_depIdxs = []int32{ + 7, // 0: textsecure.SessionStructure.senderChain:type_name -> textsecure.SessionStructure.Chain + 7, // 1: textsecure.SessionStructure.receiverChains:type_name -> textsecure.SessionStructure.Chain + 8, // 2: textsecure.SessionStructure.pendingKeyExchange:type_name -> textsecure.SessionStructure.PendingKeyExchange + 9, // 3: textsecure.SessionStructure.pendingPreKey:type_name -> textsecure.SessionStructure.PendingPreKey + 0, // 4: textsecure.RecordStructure.currentSession:type_name -> textsecure.SessionStructure + 0, // 5: textsecure.RecordStructure.previousSessions:type_name -> textsecure.SessionStructure + 12, // 6: textsecure.SenderKeyStateStructure.senderChainKey:type_name -> textsecure.SenderKeyStateStructure.SenderChainKey + 14, // 7: textsecure.SenderKeyStateStructure.senderSigningKey:type_name -> textsecure.SenderKeyStateStructure.SenderSigningKey + 13, // 8: textsecure.SenderKeyStateStructure.senderMessageKeys:type_name -> textsecure.SenderKeyStateStructure.SenderMessageKey + 5, // 9: textsecure.SenderKeyRecordStructure.senderKeyStates:type_name -> textsecure.SenderKeyStateStructure + 10, // 10: textsecure.SessionStructure.Chain.chainKey:type_name -> textsecure.SessionStructure.Chain.ChainKey + 11, // 11: textsecure.SessionStructure.Chain.messageKeys:type_name -> textsecure.SessionStructure.Chain.MessageKey + 12, // [12:12] is the sub-list for method output_type + 12, // [12:12] is the sub-list for method input_type + 12, // [12:12] is the sub-list for extension type_name + 12, // [12:12] is the sub-list for extension extendee + 0, // [0:12] is the sub-list for field type_name +} + +func init() { file_serialize_LocalStorageProtocol_proto_init() } +func file_serialize_LocalStorageProtocol_proto_init() { + if File_serialize_LocalStorageProtocol_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_serialize_LocalStorageProtocol_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SessionStructure); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_LocalStorageProtocol_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RecordStructure); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_LocalStorageProtocol_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PreKeyRecordStructure); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_LocalStorageProtocol_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SignedPreKeyRecordStructure); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_LocalStorageProtocol_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IdentityKeyPairStructure); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_LocalStorageProtocol_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SenderKeyStateStructure); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_LocalStorageProtocol_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SenderKeyRecordStructure); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_LocalStorageProtocol_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SessionStructure_Chain); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_LocalStorageProtocol_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SessionStructure_PendingKeyExchange); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_LocalStorageProtocol_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SessionStructure_PendingPreKey); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_LocalStorageProtocol_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SessionStructure_Chain_ChainKey); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_LocalStorageProtocol_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SessionStructure_Chain_MessageKey); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_LocalStorageProtocol_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SenderKeyStateStructure_SenderChainKey); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_LocalStorageProtocol_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SenderKeyStateStructure_SenderMessageKey); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_LocalStorageProtocol_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SenderKeyStateStructure_SenderSigningKey); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_serialize_LocalStorageProtocol_proto_rawDesc, + NumEnums: 0, + NumMessages: 15, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_serialize_LocalStorageProtocol_proto_goTypes, + DependencyIndexes: file_serialize_LocalStorageProtocol_proto_depIdxs, + MessageInfos: file_serialize_LocalStorageProtocol_proto_msgTypes, + }.Build() + File_serialize_LocalStorageProtocol_proto = out.File + file_serialize_LocalStorageProtocol_proto_rawDesc = nil + file_serialize_LocalStorageProtocol_proto_goTypes = nil + file_serialize_LocalStorageProtocol_proto_depIdxs = nil +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/serialize/LocalStorageProtocol.proto b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/serialize/LocalStorageProtocol.proto new file mode 100644 index 0000000..8ae9c01 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/serialize/LocalStorageProtocol.proto @@ -0,0 +1,114 @@ +// From https://github.com/signalapp/libsignal-protocol-c/blob/master/protobuf/LocalStorageProtocol.proto +syntax = "proto2"; +package textsecure; + +option java_package = "org.whispersystems.libsignal.state"; +option java_outer_classname = "StorageProtos"; + +message SessionStructure { + message Chain { + optional bytes senderRatchetKey = 1; + optional bytes senderRatchetKeyPrivate = 2; + + message ChainKey { + optional uint32 index = 1; + optional bytes key = 2; + } + + optional ChainKey chainKey = 3; + + message MessageKey { + optional uint32 index = 1; + optional bytes cipherKey = 2; + optional bytes macKey = 3; + optional bytes iv = 4; + } + + repeated MessageKey messageKeys = 4; + } + + message PendingKeyExchange { + optional uint32 sequence = 1; + optional bytes localBaseKey = 2; + optional bytes localBaseKeyPrivate = 3; + optional bytes localRatchetKey = 4; + optional bytes localRatchetKeyPrivate = 5; + optional bytes localIdentityKey = 7; + optional bytes localIdentityKeyPrivate = 8; + } + + message PendingPreKey { + optional uint32 preKeyId = 1; + optional int32 signedPreKeyId = 3; + optional bytes baseKey = 2; + } + + optional uint32 sessionVersion = 1; + optional bytes localIdentityPublic = 2; + optional bytes remoteIdentityPublic = 3; + + optional bytes rootKey = 4; + optional uint32 previousCounter = 5; + + optional Chain senderChain = 6; + repeated Chain receiverChains = 7; + + optional PendingKeyExchange pendingKeyExchange = 8; + optional PendingPreKey pendingPreKey = 9; + + optional uint32 remoteRegistrationId = 10; + optional uint32 localRegistrationId = 11; + + optional bool needsRefresh = 12; + optional bytes aliceBaseKey = 13; +} + +message RecordStructure { + optional SessionStructure currentSession = 1; + repeated SessionStructure previousSessions = 2; +} + +message PreKeyRecordStructure { + optional uint32 id = 1; + optional bytes publicKey = 2; + optional bytes privateKey = 3; +} + +message SignedPreKeyRecordStructure { + optional uint32 id = 1; + optional bytes publicKey = 2; + optional bytes privateKey = 3; + optional bytes signature = 4; + optional fixed64 timestamp = 5; +} + +message IdentityKeyPairStructure { + optional bytes publicKey = 1; + optional bytes privateKey = 2; +} + +message SenderKeyStateStructure { + message SenderChainKey { + optional uint32 iteration = 1; + optional bytes seed = 2; + } + + message SenderMessageKey { + optional uint32 iteration = 1; + optional bytes seed = 2; + } + + message SenderSigningKey { + optional bytes public = 1; + optional bytes private = 2; + } + + optional uint32 senderKeyId = 1; + optional SenderChainKey senderChainKey = 2; + optional SenderSigningKey senderSigningKey = 3; + repeated SenderMessageKey senderMessageKeys = 4; +} + +message SenderKeyRecordStructure { + repeated SenderKeyStateStructure senderKeyStates = 1; +}
\ No newline at end of file diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/serialize/ProtoBufferSerializer.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/serialize/ProtoBufferSerializer.go new file mode 100644 index 0000000..81482d3 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/serialize/ProtoBufferSerializer.go @@ -0,0 +1,262 @@ +package serialize + +import ( + "fmt" + "strconv" + + "go.mau.fi/libsignal/logger" + "go.mau.fi/libsignal/protocol" + "go.mau.fi/libsignal/util/bytehelper" + "go.mau.fi/libsignal/util/optional" + proto "google.golang.org/protobuf/proto" +) + +// NewProtoBufSerializer will return a serializer for all Signal objects that will +// be responsible for converting objects to and from ProtoBuf bytes. +func NewProtoBufSerializer() *Serializer { + serializer := NewSerializer() + + serializer.SignalMessage = &ProtoBufSignalMessageSerializer{} + serializer.PreKeySignalMessage = &ProtoBufPreKeySignalMessageSerializer{} + serializer.SenderKeyMessage = &ProtoBufSenderKeyMessageSerializer{} + serializer.SenderKeyDistributionMessage = &ProtoBufSenderKeyDistributionMessageSerializer{} + serializer.SignedPreKeyRecord = &JSONSignedPreKeyRecordSerializer{} + serializer.PreKeyRecord = &JSONPreKeyRecordSerializer{} + serializer.State = &JSONStateSerializer{} + serializer.Session = &JSONSessionSerializer{} + serializer.SenderKeyRecord = &JSONSenderKeySessionSerializer{} + serializer.SenderKeyState = &JSONSenderKeyStateSerializer{} + + return serializer +} + +func highBitsToInt(value byte) int { + return int((value & 0xFF) >> 4) +} + +func intsToByteHighAndLow(highValue, lowValue int) byte { + return byte((highValue<<4 | lowValue) & 0xFF) +} + +// ProtoBufSignalMessageSerializer is a structure for serializing signal messages into +// and from ProtoBuf. +type ProtoBufSignalMessageSerializer struct{} + +// Serialize will take a signal message structure and convert it to ProtoBuf bytes. +func (j *ProtoBufSignalMessageSerializer) Serialize(signalMessage *protocol.SignalMessageStructure) []byte { + sm := &SignalMessage{ + RatchetKey: signalMessage.RatchetKey, + Counter: &signalMessage.Counter, + PreviousCounter: &signalMessage.PreviousCounter, + Ciphertext: signalMessage.CipherText, + } + var serialized []byte + message, err := proto.Marshal(sm) + if err != nil { + logger.Error("Error serializing signal message: ", err) + } + + if signalMessage.Version != 0 { + serialized = append(serialized, []byte(strconv.Itoa(signalMessage.Version))...) + } + serialized = append(serialized, message...) + + if signalMessage.Mac != nil { + serialized = append(serialized, signalMessage.Mac...) + } + + return serialized +} + +// Deserialize will take in ProtoBuf bytes and return a signal message structure. +func (j *ProtoBufSignalMessageSerializer) Deserialize(serialized []byte) (*protocol.SignalMessageStructure, error) { + parts, err := bytehelper.SplitThree(serialized, 1, len(serialized)-1-protocol.MacLength, protocol.MacLength) + if err != nil { + logger.Error("Error split signal message: ", err) + return nil, err + } + version := highBitsToInt(parts[0][0]) + message := parts[1] + mac := parts[2] + + var sm SignalMessage + err = proto.Unmarshal(message, &sm) + if err != nil { + logger.Error("Error deserializing signal message: ", err) + return nil, err + } + + signalMessage := protocol.SignalMessageStructure{ + Version: version, + RatchetKey: sm.GetRatchetKey(), + Counter: sm.GetCounter(), + PreviousCounter: sm.GetPreviousCounter(), + CipherText: sm.GetCiphertext(), + Mac: mac, + } + + return &signalMessage, nil +} + +// ProtoBufPreKeySignalMessageSerializer is a structure for serializing prekey signal messages +// into and from ProtoBuf. +type ProtoBufPreKeySignalMessageSerializer struct{} + +// Serialize will take a prekey signal message structure and convert it to ProtoBuf bytes. +func (j *ProtoBufPreKeySignalMessageSerializer) Serialize(signalMessage *protocol.PreKeySignalMessageStructure) []byte { + preKeyMessage := &PreKeySignalMessage{ + RegistrationId: &signalMessage.RegistrationID, + SignedPreKeyId: &signalMessage.SignedPreKeyID, + BaseKey: signalMessage.BaseKey, + IdentityKey: signalMessage.IdentityKey, + Message: signalMessage.Message, + } + + if !signalMessage.PreKeyID.IsEmpty { + preKeyMessage.PreKeyId = &signalMessage.PreKeyID.Value + } + + message, err := proto.Marshal(preKeyMessage) + if err != nil { + logger.Error("Error serializing prekey signal message: ", err) + } + + serialized := append([]byte(strconv.Itoa(signalMessage.Version)), message...) + logger.Debug("Serialize PreKeySignalMessage result: ", serialized) + return serialized +} + +// Deserialize will take in ProtoBuf bytes and return a prekey signal message structure. +func (j *ProtoBufPreKeySignalMessageSerializer) Deserialize(serialized []byte) (*protocol.PreKeySignalMessageStructure, error) { + version := highBitsToInt(serialized[0]) + message := serialized[1:] + var sm PreKeySignalMessage + err := proto.Unmarshal(message, &sm) + if err != nil { + logger.Error("Error deserializing prekey signal message: ", err) + return nil, err + } + + preKeyId := optional.NewEmptyUint32() + if sm.GetPreKeyId() != 0 { + preKeyId = optional.NewOptionalUint32(sm.GetPreKeyId()) + } + + preKeySignalMessage := protocol.PreKeySignalMessageStructure{ + Version: version, + RegistrationID: sm.GetRegistrationId(), + BaseKey: sm.GetBaseKey(), + IdentityKey: sm.GetIdentityKey(), + SignedPreKeyID: sm.GetSignedPreKeyId(), + Message: sm.GetMessage(), + PreKeyID: preKeyId, + } + + return &preKeySignalMessage, nil +} + +// ProtoBufSenderKeyDistributionMessageSerializer is a structure for serializing senderkey +// distribution records to and from ProtoBuf. +type ProtoBufSenderKeyDistributionMessageSerializer struct{} + +// Serialize will take a senderkey distribution message and convert it to ProtoBuf bytes. +func (j *ProtoBufSenderKeyDistributionMessageSerializer) Serialize(message *protocol.SenderKeyDistributionMessageStructure) []byte { + senderDis := SenderKeyDistributionMessage{ + Id: &message.ID, + Iteration: &message.Iteration, + ChainKey: message.ChainKey, + SigningKey: message.SigningKey, + } + + serialized, err := proto.Marshal(&senderDis) + if err != nil { + logger.Error("Error serializing senderkey distribution message: ", err) + } + + version := strconv.Itoa(int(message.Version)) + serialized = append([]byte(version), serialized...) + logger.Debug("Serialize result: ", serialized) + return serialized +} + +// Deserialize will take in ProtoBuf bytes and return a message structure, which can be +// used to create a new SenderKey Distribution object. +func (j *ProtoBufSenderKeyDistributionMessageSerializer) Deserialize(serialized []byte) (*protocol.SenderKeyDistributionMessageStructure, error) { + version := uint32(highBitsToInt(serialized[0])) + message := serialized[1:] + + var senderKeyDis SenderKeyDistributionMessage + err := proto.Unmarshal(message, &senderKeyDis) + if err != nil { + logger.Error("Error deserializing senderkey distribution message: ", err) + return nil, err + } + + msgStructure := protocol.SenderKeyDistributionMessageStructure{ + ID: senderKeyDis.GetId(), + Iteration: senderKeyDis.GetIteration(), + ChainKey: senderKeyDis.GetChainKey(), + SigningKey: senderKeyDis.GetSigningKey(), + Version: version, + } + return &msgStructure, nil +} + +// ProtoBufSenderKeyMessageSerializer is a structure for serializing senderkey +// messages to and from ProtoBuf. +type ProtoBufSenderKeyMessageSerializer struct{} + +// Serialize will take a senderkey message and convert it to ProtoBuf bytes. +func (j *ProtoBufSenderKeyMessageSerializer) Serialize(message *protocol.SenderKeyMessageStructure) []byte { + senderMessage := &SenderKeyMessage{ + Id: &message.ID, + Iteration: &message.Iteration, + Ciphertext: message.CipherText, + } + + var serialized []byte + m, err := proto.Marshal(senderMessage) + if err != nil { + logger.Error("Error serializing signal message: ", err) + } + + if message.Version != 0 { + serialized = append([]byte(fmt.Sprint(message.Version)), m...) + } + + if message.Signature != nil { + serialized = append(serialized, message.Signature...) + } + logger.Debug("Serialize result: ", serialized) + return serialized +} + +// Deserialize will take in ProtoBuf bytes and return a message structure, which can be +// used to create a new SenderKey message object. +func (j *ProtoBufSenderKeyMessageSerializer) Deserialize(serialized []byte) (*protocol.SenderKeyMessageStructure, error) { + parts, err := bytehelper.SplitThree(serialized, 1, len(serialized)-1-64, 64) + if err != nil { + logger.Error("Error split signal message: ", err) + return nil, err + } + version := uint32(highBitsToInt(parts[0][0])) + message := parts[1] + signature := parts[2] + + var senderKey SenderKeyMessage + err = proto.Unmarshal(message, &senderKey) + if err != nil { + logger.Error("Error deserializing senderkey message: ", err) + return nil, err + } + + msgStructure := protocol.SenderKeyMessageStructure{ + Version: version, + ID: senderKey.GetId(), + Iteration: senderKey.GetIteration(), + CipherText: senderKey.GetCiphertext(), + Signature: signature, + } + + return &msgStructure, nil +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/serialize/Serializer.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/serialize/Serializer.go new file mode 100644 index 0000000..fe7dd43 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/serialize/Serializer.go @@ -0,0 +1,31 @@ +// Package serialize provides a serialization structure to serialize and +// deserialize Signal objects into storeable and transportable bytes. +package serialize + +import ( + groupRecord "go.mau.fi/libsignal/groups/state/record" + "go.mau.fi/libsignal/protocol" + "go.mau.fi/libsignal/state/record" +) + +// NewSerializer will return a new serializer object that will be used +// to encode/decode Signal objects into bytes. +func NewSerializer() *Serializer { + return &Serializer{} +} + +// Serializer is a structure to serialize Signal objects +// into bytes. This allows you to use any serialization format +// to store or send Signal objects. +type Serializer struct { + SenderKeyRecord groupRecord.SenderKeySerializer + SenderKeyState groupRecord.SenderKeyStateSerializer + SignalMessage protocol.SignalMessageSerializer + PreKeySignalMessage protocol.PreKeySignalMessageSerializer + SenderKeyMessage protocol.SenderKeyMessageSerializer + SenderKeyDistributionMessage protocol.SenderKeyDistributionMessageSerializer + SignedPreKeyRecord record.SignedPreKeySerializer + PreKeyRecord record.PreKeySerializer + State record.StateSerializer + Session record.SessionSerializer +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/serialize/WhisperTextProtocol.pb.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/serialize/WhisperTextProtocol.pb.go new file mode 100644 index 0000000..18143be --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/serialize/WhisperTextProtocol.pb.go @@ -0,0 +1,640 @@ +// From https://github.com/signalapp/libsignal-protocol-c/blob/master/protobuf/WhisperTextProtocol.proto + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.12.4 +// source: serialize/WhisperTextProtocol.proto + +package serialize + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type SignalMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RatchetKey []byte `protobuf:"bytes,1,opt,name=ratchetKey" json:"ratchetKey,omitempty"` + Counter *uint32 `protobuf:"varint,2,opt,name=counter" json:"counter,omitempty"` + PreviousCounter *uint32 `protobuf:"varint,3,opt,name=previousCounter" json:"previousCounter,omitempty"` + Ciphertext []byte `protobuf:"bytes,4,opt,name=ciphertext" json:"ciphertext,omitempty"` +} + +func (x *SignalMessage) Reset() { + *x = SignalMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_WhisperTextProtocol_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SignalMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SignalMessage) ProtoMessage() {} + +func (x *SignalMessage) ProtoReflect() protoreflect.Message { + mi := &file_serialize_WhisperTextProtocol_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SignalMessage.ProtoReflect.Descriptor instead. +func (*SignalMessage) Descriptor() ([]byte, []int) { + return file_serialize_WhisperTextProtocol_proto_rawDescGZIP(), []int{0} +} + +func (x *SignalMessage) GetRatchetKey() []byte { + if x != nil { + return x.RatchetKey + } + return nil +} + +func (x *SignalMessage) GetCounter() uint32 { + if x != nil && x.Counter != nil { + return *x.Counter + } + return 0 +} + +func (x *SignalMessage) GetPreviousCounter() uint32 { + if x != nil && x.PreviousCounter != nil { + return *x.PreviousCounter + } + return 0 +} + +func (x *SignalMessage) GetCiphertext() []byte { + if x != nil { + return x.Ciphertext + } + return nil +} + +type PreKeySignalMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RegistrationId *uint32 `protobuf:"varint,5,opt,name=registrationId" json:"registrationId,omitempty"` + PreKeyId *uint32 `protobuf:"varint,1,opt,name=preKeyId" json:"preKeyId,omitempty"` + SignedPreKeyId *uint32 `protobuf:"varint,6,opt,name=signedPreKeyId" json:"signedPreKeyId,omitempty"` + BaseKey []byte `protobuf:"bytes,2,opt,name=baseKey" json:"baseKey,omitempty"` + IdentityKey []byte `protobuf:"bytes,3,opt,name=identityKey" json:"identityKey,omitempty"` + Message []byte `protobuf:"bytes,4,opt,name=message" json:"message,omitempty"` // SignalMessage +} + +func (x *PreKeySignalMessage) Reset() { + *x = PreKeySignalMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_WhisperTextProtocol_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PreKeySignalMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PreKeySignalMessage) ProtoMessage() {} + +func (x *PreKeySignalMessage) ProtoReflect() protoreflect.Message { + mi := &file_serialize_WhisperTextProtocol_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PreKeySignalMessage.ProtoReflect.Descriptor instead. +func (*PreKeySignalMessage) Descriptor() ([]byte, []int) { + return file_serialize_WhisperTextProtocol_proto_rawDescGZIP(), []int{1} +} + +func (x *PreKeySignalMessage) GetRegistrationId() uint32 { + if x != nil && x.RegistrationId != nil { + return *x.RegistrationId + } + return 0 +} + +func (x *PreKeySignalMessage) GetPreKeyId() uint32 { + if x != nil && x.PreKeyId != nil { + return *x.PreKeyId + } + return 0 +} + +func (x *PreKeySignalMessage) GetSignedPreKeyId() uint32 { + if x != nil && x.SignedPreKeyId != nil { + return *x.SignedPreKeyId + } + return 0 +} + +func (x *PreKeySignalMessage) GetBaseKey() []byte { + if x != nil { + return x.BaseKey + } + return nil +} + +func (x *PreKeySignalMessage) GetIdentityKey() []byte { + if x != nil { + return x.IdentityKey + } + return nil +} + +func (x *PreKeySignalMessage) GetMessage() []byte { + if x != nil { + return x.Message + } + return nil +} + +type KeyExchangeMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id *uint32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` + BaseKey []byte `protobuf:"bytes,2,opt,name=baseKey" json:"baseKey,omitempty"` + RatchetKey []byte `protobuf:"bytes,3,opt,name=ratchetKey" json:"ratchetKey,omitempty"` + IdentityKey []byte `protobuf:"bytes,4,opt,name=identityKey" json:"identityKey,omitempty"` + BaseKeySignature []byte `protobuf:"bytes,5,opt,name=baseKeySignature" json:"baseKeySignature,omitempty"` +} + +func (x *KeyExchangeMessage) Reset() { + *x = KeyExchangeMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_WhisperTextProtocol_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KeyExchangeMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeyExchangeMessage) ProtoMessage() {} + +func (x *KeyExchangeMessage) ProtoReflect() protoreflect.Message { + mi := &file_serialize_WhisperTextProtocol_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KeyExchangeMessage.ProtoReflect.Descriptor instead. +func (*KeyExchangeMessage) Descriptor() ([]byte, []int) { + return file_serialize_WhisperTextProtocol_proto_rawDescGZIP(), []int{2} +} + +func (x *KeyExchangeMessage) GetId() uint32 { + if x != nil && x.Id != nil { + return *x.Id + } + return 0 +} + +func (x *KeyExchangeMessage) GetBaseKey() []byte { + if x != nil { + return x.BaseKey + } + return nil +} + +func (x *KeyExchangeMessage) GetRatchetKey() []byte { + if x != nil { + return x.RatchetKey + } + return nil +} + +func (x *KeyExchangeMessage) GetIdentityKey() []byte { + if x != nil { + return x.IdentityKey + } + return nil +} + +func (x *KeyExchangeMessage) GetBaseKeySignature() []byte { + if x != nil { + return x.BaseKeySignature + } + return nil +} + +type SenderKeyMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id *uint32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` + Iteration *uint32 `protobuf:"varint,2,opt,name=iteration" json:"iteration,omitempty"` + Ciphertext []byte `protobuf:"bytes,3,opt,name=ciphertext" json:"ciphertext,omitempty"` +} + +func (x *SenderKeyMessage) Reset() { + *x = SenderKeyMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_WhisperTextProtocol_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SenderKeyMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SenderKeyMessage) ProtoMessage() {} + +func (x *SenderKeyMessage) ProtoReflect() protoreflect.Message { + mi := &file_serialize_WhisperTextProtocol_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SenderKeyMessage.ProtoReflect.Descriptor instead. +func (*SenderKeyMessage) Descriptor() ([]byte, []int) { + return file_serialize_WhisperTextProtocol_proto_rawDescGZIP(), []int{3} +} + +func (x *SenderKeyMessage) GetId() uint32 { + if x != nil && x.Id != nil { + return *x.Id + } + return 0 +} + +func (x *SenderKeyMessage) GetIteration() uint32 { + if x != nil && x.Iteration != nil { + return *x.Iteration + } + return 0 +} + +func (x *SenderKeyMessage) GetCiphertext() []byte { + if x != nil { + return x.Ciphertext + } + return nil +} + +type SenderKeyDistributionMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id *uint32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` + Iteration *uint32 `protobuf:"varint,2,opt,name=iteration" json:"iteration,omitempty"` + ChainKey []byte `protobuf:"bytes,3,opt,name=chainKey" json:"chainKey,omitempty"` + SigningKey []byte `protobuf:"bytes,4,opt,name=signingKey" json:"signingKey,omitempty"` +} + +func (x *SenderKeyDistributionMessage) Reset() { + *x = SenderKeyDistributionMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_WhisperTextProtocol_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SenderKeyDistributionMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SenderKeyDistributionMessage) ProtoMessage() {} + +func (x *SenderKeyDistributionMessage) ProtoReflect() protoreflect.Message { + mi := &file_serialize_WhisperTextProtocol_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SenderKeyDistributionMessage.ProtoReflect.Descriptor instead. +func (*SenderKeyDistributionMessage) Descriptor() ([]byte, []int) { + return file_serialize_WhisperTextProtocol_proto_rawDescGZIP(), []int{4} +} + +func (x *SenderKeyDistributionMessage) GetId() uint32 { + if x != nil && x.Id != nil { + return *x.Id + } + return 0 +} + +func (x *SenderKeyDistributionMessage) GetIteration() uint32 { + if x != nil && x.Iteration != nil { + return *x.Iteration + } + return 0 +} + +func (x *SenderKeyDistributionMessage) GetChainKey() []byte { + if x != nil { + return x.ChainKey + } + return nil +} + +func (x *SenderKeyDistributionMessage) GetSigningKey() []byte { + if x != nil { + return x.SigningKey + } + return nil +} + +type DeviceConsistencyCodeMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Generation *uint32 `protobuf:"varint,1,opt,name=generation" json:"generation,omitempty"` + Signature []byte `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"` +} + +func (x *DeviceConsistencyCodeMessage) Reset() { + *x = DeviceConsistencyCodeMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_serialize_WhisperTextProtocol_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeviceConsistencyCodeMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeviceConsistencyCodeMessage) ProtoMessage() {} + +func (x *DeviceConsistencyCodeMessage) ProtoReflect() protoreflect.Message { + mi := &file_serialize_WhisperTextProtocol_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeviceConsistencyCodeMessage.ProtoReflect.Descriptor instead. +func (*DeviceConsistencyCodeMessage) Descriptor() ([]byte, []int) { + return file_serialize_WhisperTextProtocol_proto_rawDescGZIP(), []int{5} +} + +func (x *DeviceConsistencyCodeMessage) GetGeneration() uint32 { + if x != nil && x.Generation != nil { + return *x.Generation + } + return 0 +} + +func (x *DeviceConsistencyCodeMessage) GetSignature() []byte { + if x != nil { + return x.Signature + } + return nil +} + +var File_serialize_WhisperTextProtocol_proto protoreflect.FileDescriptor + +var file_serialize_WhisperTextProtocol_proto_rawDesc = []byte{ + 0x0a, 0x23, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x2f, 0x57, 0x68, 0x69, 0x73, + 0x70, 0x65, 0x72, 0x54, 0x65, 0x78, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x74, 0x65, 0x78, 0x74, 0x73, 0x65, 0x63, 0x75, 0x72, + 0x65, 0x22, 0x93, 0x01, 0x0a, 0x0d, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x61, 0x74, 0x63, 0x68, 0x65, 0x74, 0x4b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x72, 0x61, 0x74, 0x63, 0x68, 0x65, 0x74, + 0x4b, 0x65, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x28, 0x0a, + 0x0f, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0f, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x69, 0x70, 0x68, 0x65, + 0x72, 0x74, 0x65, 0x78, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x63, 0x69, 0x70, + 0x68, 0x65, 0x72, 0x74, 0x65, 0x78, 0x74, 0x22, 0xd7, 0x01, 0x0a, 0x13, 0x50, 0x72, 0x65, 0x4b, + 0x65, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, + 0x26, 0x0a, 0x0e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, + 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x65, 0x4b, 0x65, + 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x70, 0x72, 0x65, 0x4b, 0x65, + 0x79, 0x49, 0x64, 0x12, 0x26, 0x0a, 0x0e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x50, 0x72, 0x65, + 0x4b, 0x65, 0x79, 0x49, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0e, 0x73, 0x69, 0x67, + 0x6e, 0x65, 0x64, 0x50, 0x72, 0x65, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x62, + 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x62, 0x61, + 0x73, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, + 0x79, 0x4b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x69, 0x64, 0x65, 0x6e, + 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x22, 0xac, 0x01, 0x0a, 0x12, 0x4b, 0x65, 0x79, 0x45, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, + 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x61, 0x73, 0x65, + 0x4b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x62, 0x61, 0x73, 0x65, 0x4b, + 0x65, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x61, 0x74, 0x63, 0x68, 0x65, 0x74, 0x4b, 0x65, 0x79, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x72, 0x61, 0x74, 0x63, 0x68, 0x65, 0x74, 0x4b, + 0x65, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x4b, 0x65, + 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, + 0x79, 0x4b, 0x65, 0x79, 0x12, 0x2a, 0x0a, 0x10, 0x62, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x53, + 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x10, + 0x62, 0x61, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, + 0x22, 0x60, 0x0a, 0x10, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x02, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x69, 0x70, 0x68, 0x65, 0x72, 0x74, 0x65, 0x78, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x63, 0x69, 0x70, 0x68, 0x65, 0x72, 0x74, 0x65, + 0x78, 0x74, 0x22, 0x88, 0x01, 0x0a, 0x1c, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x4b, 0x65, 0x79, + 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x4b, 0x65, 0x79, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x4b, 0x65, 0x79, 0x12, 0x1e, 0x0a, + 0x0a, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x0a, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x22, 0x5c, 0x0a, + 0x1c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x73, 0x69, 0x73, 0x74, 0x65, 0x6e, + 0x63, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1e, 0x0a, + 0x0a, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x0a, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, + 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, +} + +var ( + file_serialize_WhisperTextProtocol_proto_rawDescOnce sync.Once + file_serialize_WhisperTextProtocol_proto_rawDescData = file_serialize_WhisperTextProtocol_proto_rawDesc +) + +func file_serialize_WhisperTextProtocol_proto_rawDescGZIP() []byte { + file_serialize_WhisperTextProtocol_proto_rawDescOnce.Do(func() { + file_serialize_WhisperTextProtocol_proto_rawDescData = protoimpl.X.CompressGZIP(file_serialize_WhisperTextProtocol_proto_rawDescData) + }) + return file_serialize_WhisperTextProtocol_proto_rawDescData +} + +var file_serialize_WhisperTextProtocol_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_serialize_WhisperTextProtocol_proto_goTypes = []interface{}{ + (*SignalMessage)(nil), // 0: textsecure.SignalMessage + (*PreKeySignalMessage)(nil), // 1: textsecure.PreKeySignalMessage + (*KeyExchangeMessage)(nil), // 2: textsecure.KeyExchangeMessage + (*SenderKeyMessage)(nil), // 3: textsecure.SenderKeyMessage + (*SenderKeyDistributionMessage)(nil), // 4: textsecure.SenderKeyDistributionMessage + (*DeviceConsistencyCodeMessage)(nil), // 5: textsecure.DeviceConsistencyCodeMessage +} +var file_serialize_WhisperTextProtocol_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_serialize_WhisperTextProtocol_proto_init() } +func file_serialize_WhisperTextProtocol_proto_init() { + if File_serialize_WhisperTextProtocol_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_serialize_WhisperTextProtocol_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SignalMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_WhisperTextProtocol_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PreKeySignalMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_WhisperTextProtocol_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KeyExchangeMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_WhisperTextProtocol_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SenderKeyMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_WhisperTextProtocol_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SenderKeyDistributionMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_serialize_WhisperTextProtocol_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeviceConsistencyCodeMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_serialize_WhisperTextProtocol_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_serialize_WhisperTextProtocol_proto_goTypes, + DependencyIndexes: file_serialize_WhisperTextProtocol_proto_depIdxs, + MessageInfos: file_serialize_WhisperTextProtocol_proto_msgTypes, + }.Build() + File_serialize_WhisperTextProtocol_proto = out.File + file_serialize_WhisperTextProtocol_proto_rawDesc = nil + file_serialize_WhisperTextProtocol_proto_goTypes = nil + file_serialize_WhisperTextProtocol_proto_depIdxs = nil +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/serialize/WhisperTextProtocol.proto b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/serialize/WhisperTextProtocol.proto new file mode 100644 index 0000000..def080b --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/serialize/WhisperTextProtocol.proto @@ -0,0 +1,45 @@ +// From https://github.com/signalapp/libsignal-protocol-c/blob/master/protobuf/WhisperTextProtocol.proto +syntax = "proto2"; +package textsecure; + +message SignalMessage { + optional bytes ratchetKey = 1; + optional uint32 counter = 2; + optional uint32 previousCounter = 3; + optional bytes ciphertext = 4; +} + +message PreKeySignalMessage { + optional uint32 registrationId = 5; + optional uint32 preKeyId = 1; + optional uint32 signedPreKeyId = 6; + optional bytes baseKey = 2; + optional bytes identityKey = 3; + optional bytes message = 4; // SignalMessage +} + +message KeyExchangeMessage { + optional uint32 id = 1; + optional bytes baseKey = 2; + optional bytes ratchetKey = 3; + optional bytes identityKey = 4; + optional bytes baseKeySignature = 5; +} + +message SenderKeyMessage { + optional uint32 id = 1; + optional uint32 iteration = 2; + optional bytes ciphertext = 3; +} + +message SenderKeyDistributionMessage { + optional uint32 id = 1; + optional uint32 iteration = 2; + optional bytes chainKey = 3; + optional bytes signingKey = 4; +} + +message DeviceConsistencyCodeMessage { + optional uint32 generation = 1; + optional bytes signature = 2; +}
\ No newline at end of file diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/session/Session.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/session/Session.go new file mode 100644 index 0000000..88e4276 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/session/Session.go @@ -0,0 +1,272 @@ +// Package session provides the methods necessary to build sessions +package session + +import ( + "fmt" + + "go.mau.fi/libsignal/ecc" + "go.mau.fi/libsignal/keys/prekey" + "go.mau.fi/libsignal/logger" + "go.mau.fi/libsignal/protocol" + "go.mau.fi/libsignal/ratchet" + "go.mau.fi/libsignal/serialize" + "go.mau.fi/libsignal/signalerror" + "go.mau.fi/libsignal/state/record" + "go.mau.fi/libsignal/state/store" + "go.mau.fi/libsignal/util/medium" + "go.mau.fi/libsignal/util/optional" +) + +// NewBuilder constructs a session builder. +func NewBuilder(sessionStore store.Session, preKeyStore store.PreKey, + signedStore store.SignedPreKey, identityStore store.IdentityKey, + remoteAddress *protocol.SignalAddress, serializer *serialize.Serializer) *Builder { + + builder := Builder{ + sessionStore: sessionStore, + preKeyStore: preKeyStore, + signedPreKeyStore: signedStore, + identityKeyStore: identityStore, + remoteAddress: remoteAddress, + serializer: serializer, + } + + return &builder +} + +// NewBuilderFromSignal Store constructs a session builder using a +// SignalProtocol Store. +func NewBuilderFromSignal(signalStore store.SignalProtocol, + remoteAddress *protocol.SignalAddress, serializer *serialize.Serializer) *Builder { + + builder := Builder{ + sessionStore: signalStore, + preKeyStore: signalStore, + signedPreKeyStore: signalStore, + identityKeyStore: signalStore, + remoteAddress: remoteAddress, + serializer: serializer, + } + + return &builder +} + +// Builder is responsible for setting up encrypted sessions. +// Once a session has been established, SessionCipher can be +// used to encrypt/decrypt messages in that session. +// +// Sessions are built from one of three different vectors: +// * PreKeyBundle retrieved from a server. +// * PreKeySignalMessage received from a client. +// * KeyExchangeMessage sent to or received from a client. +// +// Sessions are constructed per recipientId + deviceId tuple. +// Remote logical users are identified by their recipientId, +// and each logical recipientId can have multiple physical +// devices. +type Builder struct { + sessionStore store.Session + preKeyStore store.PreKey + signedPreKeyStore store.SignedPreKey + identityKeyStore store.IdentityKey + remoteAddress *protocol.SignalAddress + serializer *serialize.Serializer +} + +// Process builds a new session from a session record and pre +// key signal message. +func (b *Builder) Process(sessionRecord *record.Session, message *protocol.PreKeySignalMessage) (unsignedPreKeyID *optional.Uint32, err error) { + + // Check to see if the keys are trusted. + theirIdentityKey := message.IdentityKey() + if !(b.identityKeyStore.IsTrustedIdentity(b.remoteAddress, theirIdentityKey)) { + return nil, signalerror.ErrUntrustedIdentity + } + + // Use version 3 of the signal/axolotl protocol. + unsignedPreKeyID, err = b.processV3(sessionRecord, message) + if err != nil { + return nil, err + } + + // Save the identity key to our identity store. + b.identityKeyStore.SaveIdentity(b.remoteAddress, theirIdentityKey) + + // Return the unsignedPreKeyID + return unsignedPreKeyID, nil +} + +// ProcessV3 builds a new session from a session record and pre key +// signal message. After a session is constructed in this way, the embedded +// SignalMessage can be decrypted. +func (b *Builder) processV3(sessionRecord *record.Session, + message *protocol.PreKeySignalMessage) (unsignedPreKeyID *optional.Uint32, err error) { + + logger.Debug("Processing message with PreKeyID: ", message.PreKeyID()) + // Check to see if we've already set up a session for this V3 message. + sessionExists := sessionRecord.HasSessionState( + message.MessageVersion(), + message.BaseKey().Serialize(), + ) + if sessionExists { + logger.Debug("We've already setup a session for this V3 message, letting bundled message fall through...") + return optional.NewEmptyUint32(), nil + } + + // Load our signed prekey from our signed prekey store. + ourSignedPreKeyRecord := b.signedPreKeyStore.LoadSignedPreKey(message.SignedPreKeyID()) + if ourSignedPreKeyRecord == nil { + return nil, fmt.Errorf("%w with ID %d", signalerror.ErrNoSignedPreKey, message.SignedPreKeyID()) + } + ourSignedPreKey := ourSignedPreKeyRecord.KeyPair() + + // Build the parameters of the session. + parameters := ratchet.NewEmptyReceiverParameters() + parameters.SetTheirBaseKey(message.BaseKey()) + parameters.SetTheirIdentityKey(message.IdentityKey()) + parameters.SetOurIdentityKeyPair(b.identityKeyStore.GetIdentityKeyPair()) + parameters.SetOurSignedPreKey(ourSignedPreKey) + parameters.SetOurRatchetKey(ourSignedPreKey) + + // Set our one time pre key with the one from our prekey store + // if the message contains a valid pre key id + if !message.PreKeyID().IsEmpty { + oneTimePreKey := b.preKeyStore.LoadPreKey(message.PreKeyID().Value) + if oneTimePreKey == nil { + return nil, fmt.Errorf("%w with ID %d", signalerror.ErrNoOneTimeKeyFound, message.PreKeyID().Value) + } + parameters.SetOurOneTimePreKey(oneTimePreKey.KeyPair()) + } else { + parameters.SetOurOneTimePreKey(nil) + } + + // If this is a fresh record, archive our current state. + if !sessionRecord.IsFresh() { + sessionRecord.ArchiveCurrentState() + } + + ///////// Initialize our session ///////// + sessionState := sessionRecord.SessionState() + derivedKeys, sessionErr := ratchet.CalculateReceiverSession(parameters) + if sessionErr != nil { + return nil, sessionErr + } + sessionState.SetVersion(protocol.CurrentVersion) + sessionState.SetRemoteIdentityKey(parameters.TheirIdentityKey()) + sessionState.SetLocalIdentityKey(parameters.OurIdentityKeyPair().PublicKey()) + sessionState.SetSenderChain(parameters.OurRatchetKey(), derivedKeys.ChainKey) + sessionState.SetRootKey(derivedKeys.RootKey) + + // Set the session's registration ids and base key + sessionState.SetLocalRegistrationID(b.identityKeyStore.GetLocalRegistrationId()) + sessionState.SetRemoteRegistrationID(message.RegistrationID()) + sessionState.SetSenderBaseKey(message.BaseKey().Serialize()) + + // Remove the PreKey from our store and return the message prekey id if it is valid. + if message.PreKeyID() != nil && message.PreKeyID().Value != medium.MaxValue { + return message.PreKeyID(), nil + } + return optional.NewEmptyUint32(), nil +} + +// ProcessBundle builds a new session from a PreKeyBundle retrieved +// from a server. +func (b *Builder) ProcessBundle(preKey *prekey.Bundle) error { + // Check to see if the keys are trusted. + if !(b.identityKeyStore.IsTrustedIdentity(b.remoteAddress, preKey.IdentityKey())) { + return signalerror.ErrUntrustedIdentity + } + + // Check to see if the bundle has a signed pre key. + if preKey.SignedPreKey() == nil { + return signalerror.ErrNoSignedPreKey + } + + // Verify the signature of the pre key + preKeyPublic := preKey.IdentityKey().PublicKey() + preKeyBytes := preKey.SignedPreKey().Serialize() + preKeySignature := preKey.SignedPreKeySignature() + if !ecc.VerifySignature(preKeyPublic, preKeyBytes, preKeySignature) { + return signalerror.ErrInvalidSignature + } + + // Load our session and generate keys. + sessionRecord := b.sessionStore.LoadSession(b.remoteAddress) + ourBaseKey, err := ecc.GenerateKeyPair() + if err != nil { + return err + } + theirSignedPreKey := preKey.SignedPreKey() + theirOneTimePreKey := preKey.PreKey() + theirOneTimePreKeyID := preKey.PreKeyID() + + // Build the parameters of the session + parameters := ratchet.NewEmptySenderParameters() + parameters.SetOurBaseKey(ourBaseKey) + parameters.SetOurIdentityKey(b.identityKeyStore.GetIdentityKeyPair()) + parameters.SetTheirIdentityKey(preKey.IdentityKey()) + parameters.SetTheirSignedPreKey(theirSignedPreKey) + parameters.SetTheirRatchetKey(theirSignedPreKey) + parameters.SetTheirOneTimePreKey(theirOneTimePreKey) + + // If this is a fresh record, archive our current state. + if !sessionRecord.IsFresh() { + sessionRecord.ArchiveCurrentState() + } + + ///////// Initialize our session ///////// + sessionState := sessionRecord.SessionState() + derivedKeys, sessionErr := ratchet.CalculateSenderSession(parameters) + if sessionErr != nil { + return sessionErr + } + // Generate an ephemeral "ratchet" key that will be advertised to + // the receiving user. + sendingRatchetKey, keyErr := ecc.GenerateKeyPair() + if keyErr != nil { + return keyErr + } + sendingChain, chainErr := derivedKeys.RootKey.CreateChain( + parameters.TheirRatchetKey(), + sendingRatchetKey, + ) + if chainErr != nil { + return chainErr + } + + // Calculate the sender session. + sessionState.SetVersion(protocol.CurrentVersion) + sessionState.SetRemoteIdentityKey(parameters.TheirIdentityKey()) + sessionState.SetLocalIdentityKey(parameters.OurIdentityKey().PublicKey()) + sessionState.AddReceiverChain(parameters.TheirRatchetKey(), derivedKeys.ChainKey.Current()) + sessionState.SetSenderChain(sendingRatchetKey, sendingChain.ChainKey) + sessionState.SetRootKey(sendingChain.RootKey) + + // Update our session record with the unackowledged prekey message + sessionState.SetUnacknowledgedPreKeyMessage( + theirOneTimePreKeyID, + preKey.SignedPreKeyID(), + ourBaseKey.PublicKey(), + ) + + // Set the local registration ID based on the registration id in our identity key store. + sessionState.SetLocalRegistrationID( + b.identityKeyStore.GetLocalRegistrationId(), + ) + + // Set the remote registration ID based on the given prekey bundle registrationID. + sessionState.SetRemoteRegistrationID( + preKey.RegistrationID(), + ) + + // Set the sender base key in our session record state. + sessionState.SetSenderBaseKey( + ourBaseKey.PublicKey().Serialize(), + ) + + // Store the session in our session store and save the identity in our identity store. + b.sessionStore.StoreSession(b.remoteAddress, sessionRecord) + b.identityKeyStore.SaveIdentity(b.remoteAddress, preKey.IdentityKey()) + + return nil +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/session/SessionCipher.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/session/SessionCipher.go new file mode 100644 index 0000000..a70812b --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/session/SessionCipher.go @@ -0,0 +1,366 @@ +package session + +import ( + "fmt" + + "go.mau.fi/libsignal/cipher" + "go.mau.fi/libsignal/ecc" + "go.mau.fi/libsignal/keys/chain" + "go.mau.fi/libsignal/keys/message" + "go.mau.fi/libsignal/logger" + "go.mau.fi/libsignal/protocol" + "go.mau.fi/libsignal/signalerror" + "go.mau.fi/libsignal/state/record" + "go.mau.fi/libsignal/state/store" + "go.mau.fi/libsignal/util/bytehelper" +) + +const maxFutureMessages = 2000 + +// NewCipher constructs a session cipher for encrypt/decrypt operations on a +// session. In order to use the session cipher, a session must have already +// been created and stored using session.Builder. +func NewCipher(builder *Builder, remoteAddress *protocol.SignalAddress) *Cipher { + cipher := &Cipher{ + sessionStore: builder.sessionStore, + preKeyMessageSerializer: builder.serializer.PreKeySignalMessage, + signalMessageSerializer: builder.serializer.SignalMessage, + preKeyStore: builder.preKeyStore, + remoteAddress: remoteAddress, + builder: builder, + identityKeyStore: builder.identityKeyStore, + } + + return cipher +} + +func NewCipherFromSession(remoteAddress *protocol.SignalAddress, + sessionStore store.Session, preKeyStore store.PreKey, identityKeyStore store.IdentityKey, + preKeyMessageSerializer protocol.PreKeySignalMessageSerializer, + signalMessageSerializer protocol.SignalMessageSerializer) *Cipher { + cipher := &Cipher{ + sessionStore: sessionStore, + preKeyMessageSerializer: preKeyMessageSerializer, + signalMessageSerializer: signalMessageSerializer, + preKeyStore: preKeyStore, + remoteAddress: remoteAddress, + identityKeyStore: identityKeyStore, + } + + return cipher +} + +// Cipher is the main entry point for Signal Protocol encrypt/decrypt operations. +// Once a session has been established with session.Builder, this can be used for +// all encrypt/decrypt operations within that session. +type Cipher struct { + sessionStore store.Session + preKeyMessageSerializer protocol.PreKeySignalMessageSerializer + signalMessageSerializer protocol.SignalMessageSerializer + preKeyStore store.PreKey + remoteAddress *protocol.SignalAddress + builder *Builder + identityKeyStore store.IdentityKey +} + +// Encrypt will take the given message in bytes and return an object that follows +// the CiphertextMessage interface. +func (d *Cipher) Encrypt(plaintext []byte) (protocol.CiphertextMessage, error) { + sessionRecord := d.sessionStore.LoadSession(d.remoteAddress) + sessionState := sessionRecord.SessionState() + chainKey := sessionState.SenderChainKey() + messageKeys := chainKey.MessageKeys() + senderEphemeral := sessionState.SenderRatchetKey() + previousCounter := sessionState.PreviousCounter() + sessionVersion := sessionState.Version() + + ciphertextBody, err := encrypt(messageKeys, plaintext) + logger.Debug("Got ciphertextBody: ", ciphertextBody) + if err != nil { + return nil, err + } + + var ciphertextMessage protocol.CiphertextMessage + ciphertextMessage, err = protocol.NewSignalMessage( + sessionVersion, + chainKey.Index(), + previousCounter, + messageKeys.MacKey(), + senderEphemeral, + ciphertextBody, + sessionState.LocalIdentityKey(), + sessionState.RemoteIdentityKey(), + d.signalMessageSerializer, + ) + if err != nil { + return nil, err + } + + // If we haven't established a session with the recipient yet, + // send our message as a PreKeySignalMessage. + if sessionState.HasUnacknowledgedPreKeyMessage() { + items, err := sessionState.UnackPreKeyMessageItems() + if err != nil { + return nil, err + } + localRegistrationID := sessionState.LocalRegistrationID() + + ciphertextMessage, err = protocol.NewPreKeySignalMessage( + sessionVersion, + localRegistrationID, + items.PreKeyID(), + items.SignedPreKeyID(), + items.BaseKey(), + sessionState.LocalIdentityKey(), + ciphertextMessage.(*protocol.SignalMessage), + d.preKeyMessageSerializer, + d.signalMessageSerializer, + ) + if err != nil { + return nil, err + } + } + + sessionState.SetSenderChainKey(chainKey.NextKey()) + if !d.identityKeyStore.IsTrustedIdentity(d.remoteAddress, sessionState.RemoteIdentityKey()) { + // return err + } + d.identityKeyStore.SaveIdentity(d.remoteAddress, sessionState.RemoteIdentityKey()) + d.sessionStore.StoreSession(d.remoteAddress, sessionRecord) + return ciphertextMessage, nil +} + +// Decrypt decrypts the given message using an existing session that +// is stored in the session store. +func (d *Cipher) Decrypt(ciphertextMessage *protocol.SignalMessage) ([]byte, error) { + plaintext, _, err := d.DecryptAndGetKey(ciphertextMessage) + + return plaintext, err +} + +// DecryptAndGetKey decrypts the given message using an existing session that +// is stored in the session store and returns the message keys used for encryption. +func (d *Cipher) DecryptAndGetKey(ciphertextMessage *protocol.SignalMessage) ([]byte, *message.Keys, error) { + if !d.sessionStore.ContainsSession(d.remoteAddress) { + return nil, nil, fmt.Errorf("%w %s", signalerror.ErrNoSessionForUser, d.remoteAddress.String()) + } + + // Load the session record from our session store and decrypt the message. + sessionRecord := d.sessionStore.LoadSession(d.remoteAddress) + plaintext, messageKeys, err := d.DecryptWithRecord(sessionRecord, ciphertextMessage) + if err != nil { + return nil, nil, err + } + + if !d.identityKeyStore.IsTrustedIdentity(d.remoteAddress, sessionRecord.SessionState().RemoteIdentityKey()) { + // return err + } + d.identityKeyStore.SaveIdentity(d.remoteAddress, sessionRecord.SessionState().RemoteIdentityKey()) + + // Store the session record in our session store. + d.sessionStore.StoreSession(d.remoteAddress, sessionRecord) + return plaintext, messageKeys, nil +} + +func (d *Cipher) DecryptMessage(ciphertextMessage *protocol.PreKeySignalMessage) ([]byte, error) { + plaintext, _, err := d.DecryptMessageReturnKey(ciphertextMessage) + return plaintext, err +} + +func (d *Cipher) DecryptMessageReturnKey(ciphertextMessage *protocol.PreKeySignalMessage) ([]byte, *message.Keys, error) { + // Load or create session record for this session. + sessionRecord := d.sessionStore.LoadSession(d.remoteAddress) + unsignedPreKeyID, err := d.builder.Process(sessionRecord, ciphertextMessage) + if err != nil { + return nil, nil, err + } + plaintext, keys, err := d.DecryptWithRecord(sessionRecord, ciphertextMessage.WhisperMessage()) + if err != nil { + return nil, nil, err + } + // Store the session record in our session store. + d.sessionStore.StoreSession(d.remoteAddress, sessionRecord) + if !unsignedPreKeyID.IsEmpty { + d.preKeyStore.RemovePreKey(unsignedPreKeyID.Value) + } + return plaintext, keys, nil +} + +// DecryptWithKey will decrypt the given message using the given symmetric key. This +// can be used when decrypting messages at a later time if the message key was saved. +func (d *Cipher) DecryptWithKey(ciphertextMessage *protocol.SignalMessage, key *message.Keys) ([]byte, error) { + logger.Debug("Decrypting ciphertext body: ", ciphertextMessage.Body()) + plaintext, err := decrypt(key, ciphertextMessage.Body()) + if err != nil { + logger.Error("Unable to get plain text from ciphertext: ", err) + return nil, err + } + + return plaintext, nil +} + +// DecryptWithRecord decrypts the given message using the given session record. +func (d *Cipher) DecryptWithRecord(sessionRecord *record.Session, ciphertext *protocol.SignalMessage) ([]byte, *message.Keys, error) { + logger.Debug("Decrypting ciphertext with record: ", sessionRecord) + previousStates := sessionRecord.PreviousSessionStates() + sessionState := sessionRecord.SessionState() + + // Try and decrypt the message with the current session state. + plaintext, messageKeys, err := d.DecryptWithState(sessionState, ciphertext) + + // If we received an error using the current session state, loop + // through all previous states. + if err != nil { + logger.Warning(err) + for i, state := range previousStates { + // Try decrypting the message with previous states + plaintext, messageKeys, err = d.DecryptWithState(state, ciphertext) + if err != nil { + continue + } + + // If successful, remove and promote the state. + previousStates = append(previousStates[:i], previousStates[i+1:]...) + sessionRecord.PromoteState(state) + + return plaintext, messageKeys, nil + } + + return nil, nil, signalerror.ErrNoValidSessions + } + + // If decryption was successful, set the session state and return the plain text. + sessionRecord.SetState(sessionState) + + return plaintext, messageKeys, nil +} + +// DecryptWithState decrypts the given message with the given session state. +func (d *Cipher) DecryptWithState(sessionState *record.State, ciphertextMessage *protocol.SignalMessage) ([]byte, *message.Keys, error) { + logger.Debug("Decrypting ciphertext with session state: ", sessionState) + if !sessionState.HasSenderChain() { + logger.Error("Unable to decrypt message with state: ", signalerror.ErrUninitializedSession) + return nil, nil, signalerror.ErrUninitializedSession + } + + if ciphertextMessage.MessageVersion() != sessionState.Version() { + logger.Error("Unable to decrypt message with state: ", signalerror.ErrWrongMessageVersion) + return nil, nil, signalerror.ErrWrongMessageVersion + } + + messageVersion := ciphertextMessage.MessageVersion() + theirEphemeral := ciphertextMessage.SenderRatchetKey() + counter := ciphertextMessage.Counter() + chainKey, chainCreateErr := getOrCreateChainKey(sessionState, theirEphemeral) + if chainCreateErr != nil { + logger.Error("Unable to get or create chain key: ", chainCreateErr) + return nil, nil, fmt.Errorf("failed to get or create chain key: %w", chainCreateErr) + } + + messageKeys, keysCreateErr := getOrCreateMessageKeys(sessionState, theirEphemeral, chainKey, counter) + if keysCreateErr != nil { + logger.Error("Unable to get or create message keys: ", keysCreateErr) + return nil, nil, fmt.Errorf("failed to get or create message keys: %w", keysCreateErr) + } + + err := ciphertextMessage.VerifyMac(messageVersion, sessionState.RemoteIdentityKey(), sessionState.LocalIdentityKey(), messageKeys.MacKey()) + if err != nil { + logger.Error("Unable to verify ciphertext mac: ", err) + return nil, nil, fmt.Errorf("failed to verify ciphertext MAC: %w", err) + } + + plaintext, err := d.DecryptWithKey(ciphertextMessage, messageKeys) + if err != nil { + return nil, nil, err + } + + sessionState.ClearUnackPreKeyMessage() + + return plaintext, messageKeys, nil +} + +func getOrCreateMessageKeys(sessionState *record.State, theirEphemeral ecc.ECPublicKeyable, + chainKey *chain.Key, counter uint32) (*message.Keys, error) { + + if chainKey.Index() > counter { + if sessionState.HasMessageKeys(theirEphemeral, counter) { + return sessionState.RemoveMessageKeys(theirEphemeral, counter), nil + } + return nil, fmt.Errorf("%w (index: %d, count: %d)", signalerror.ErrOldCounter, chainKey.Index(), counter) + } + + if counter-chainKey.Index() > maxFutureMessages { + return nil, signalerror.ErrTooFarIntoFuture + } + + for chainKey.Index() < counter { + messageKeys := chainKey.MessageKeys() + sessionState.SetMessageKeys(theirEphemeral, messageKeys) + chainKey = chainKey.NextKey() + } + + sessionState.SetReceiverChainKey(theirEphemeral, chainKey.NextKey()) + return chainKey.MessageKeys(), nil +} + +// getOrCreateChainKey will either return the existing chain key or +// create a new one with the given session state and ephemeral key. +func getOrCreateChainKey(sessionState *record.State, theirEphemeral ecc.ECPublicKeyable) (*chain.Key, error) { + + // If our session state already has a receiver chain, use their + // ephemeral key in the existing chain. + if sessionState.HasReceiverChain(theirEphemeral) { + return sessionState.ReceiverChainKey(theirEphemeral), nil + } + + // If we don't have a chain key, create one with ephemeral keys. + rootKey := sessionState.RootKey() + ourEphemeral := sessionState.SenderRatchetKeyPair() + receiverChain, rErr := rootKey.CreateChain(theirEphemeral, ourEphemeral) + if rErr != nil { + return nil, rErr + } + + // Generate a new ephemeral key pair. + ourNewEphemeral, gErr := ecc.GenerateKeyPair() + if gErr != nil { + return nil, gErr + } + + // Create a new chain using our new ephemeral key. + senderChain, cErr := receiverChain.RootKey.CreateChain(theirEphemeral, ourNewEphemeral) + if cErr != nil { + return nil, cErr + } + + // Set our session state parameters. + sessionState.SetRootKey(senderChain.RootKey) + sessionState.AddReceiverChain(theirEphemeral, receiverChain.ChainKey) + previousCounter := max(sessionState.SenderChainKey().Index()-1, 0) + sessionState.SetPreviousCounter(previousCounter) + sessionState.SetSenderChain(ourNewEphemeral, senderChain.ChainKey) + + return receiverChain.ChainKey.(*chain.Key), nil +} + +// decrypt will use the given message keys and ciphertext and return +// the plaintext bytes. +func decrypt(keys *message.Keys, body []byte) ([]byte, error) { + logger.Debug("Using cipherKey: ", keys.CipherKey()) + return cipher.DecryptCbc(keys.Iv(), keys.CipherKey(), bytehelper.CopySlice(body)) +} + +// encrypt will use the given cipher, message keys, and plaintext bytes +// and return ciphertext bytes. +func encrypt(messageKeys *message.Keys, plaintext []byte) ([]byte, error) { + logger.Debug("Using cipherKey: ", messageKeys.CipherKey()) + return cipher.EncryptCbc(messageKeys.Iv(), messageKeys.CipherKey(), plaintext) +} + +// Max is a uint32 implementation of math.Max +func max(x, y uint32) uint32 { + if x > y { + return x + } + return y +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/signalerror/errors.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/signalerror/errors.go new file mode 100644 index 0000000..5123216 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/signalerror/errors.go @@ -0,0 +1,37 @@ +package signalerror + +import "errors" + +var ( + ErrNoSenderKeyStatesInRecord = errors.New("no sender key states in record") + ErrNoSenderKeyStateForID = errors.New("no sender key state for key ID") +) + +var ( + ErrUntrustedIdentity = errors.New("untrusted identity") + ErrNoSignedPreKey = errors.New("no signed prekey found in bundle") + ErrInvalidSignature = errors.New("invalid signature on device key") + ErrNoOneTimeKeyFound = errors.New("prekey store didn't return one-time key") +) + +var ( + ErrNoValidSessions = errors.New("no valid sessions") + ErrUninitializedSession = errors.New("uninitialized session") + ErrWrongMessageVersion = errors.New("wrong message version") + ErrTooFarIntoFuture = errors.New("message index is over 2000 messages into the future") + ErrOldCounter = errors.New("received message with old counter") + ErrNoSessionForUser = errors.New("no session found for user") +) + +var ( + ErrSenderKeyStateVerificationFailed = errors.New("sender key state failed verification with given public key") + ErrNoSenderKeyForUser = errors.New("no sender key") +) + +var ( + ErrOldMessageVersion = errors.New("too old message version") + ErrUnknownMessageVersion = errors.New("unknown message version") + ErrIncompleteMessage = errors.New("incomplete message") +) + +var ErrBadMAC = errors.New("mismatching MAC in signal message") diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/record/ChainState.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/record/ChainState.go new file mode 100644 index 0000000..dd07bf8 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/record/ChainState.go @@ -0,0 +1,157 @@ +package record + +import ( + "go.mau.fi/libsignal/ecc" + "go.mau.fi/libsignal/kdf" + "go.mau.fi/libsignal/keys/chain" + "go.mau.fi/libsignal/keys/message" + "go.mau.fi/libsignal/util/bytehelper" +) + +// NewReceiverChainPair will return a new ReceiverChainPair object. +func NewReceiverChainPair(receiverChain *Chain, index int) *ReceiverChainPair { + return &ReceiverChainPair{ + ReceiverChain: receiverChain, + Index: index, + } +} + +// ReceiverChainPair is a structure for a receiver chain key and index number. +type ReceiverChainPair struct { + ReceiverChain *Chain + Index int +} + +// NewChain returns a new Chain structure for SessionState. +func NewChain(senderRatchetKeyPair *ecc.ECKeyPair, chainKey *chain.Key, + messageKeys []*message.Keys) *Chain { + + return &Chain{ + senderRatchetKeyPair: senderRatchetKeyPair, + chainKey: chainKey, + messageKeys: messageKeys, + } +} + +// NewChainFromStructure will return a new Chain with the given +// chain structure. +func NewChainFromStructure(structure *ChainStructure) (*Chain, error) { + // Alias to SliceToArray + getArray := bytehelper.SliceToArray + + // Build the sender ratchet key from bytes. + senderRatchetKeyPublic, err := ecc.DecodePoint(structure.SenderRatchetKeyPublic, 0) + if err != nil { + return nil, err + } + var senderRatchetKeyPrivate ecc.ECPrivateKeyable + if len(structure.SenderRatchetKeyPrivate) == 32 { + senderRatchetKeyPrivate = ecc.NewDjbECPrivateKey(getArray(structure.SenderRatchetKeyPrivate)) + } + senderRatchetKeyPair := ecc.NewECKeyPair(senderRatchetKeyPublic, senderRatchetKeyPrivate) + + // Build our message keys from the message key structures. + messageKeys := make([]*message.Keys, len(structure.MessageKeys)) + for i := range structure.MessageKeys { + messageKeys[i] = message.NewKeysFromStruct(structure.MessageKeys[i]) + } + + // Build our new chain state. + chainState := NewChain( + senderRatchetKeyPair, + chain.NewKeyFromStruct(structure.ChainKey, kdf.DeriveSecrets), + messageKeys, + ) + + return chainState, nil +} + +// ChainStructure is a serializeable structure for chain states. +type ChainStructure struct { + SenderRatchetKeyPublic []byte + SenderRatchetKeyPrivate []byte + ChainKey *chain.KeyStructure + MessageKeys []*message.KeysStructure +} + +// Chain is a structure used inside the SessionState that keeps +// track of an ongoing ratcheting chain for a session. +type Chain struct { + senderRatchetKeyPair *ecc.ECKeyPair + chainKey *chain.Key + messageKeys []*message.Keys +} + +// SenderRatchetKey returns the sender's EC keypair. +func (c *Chain) SenderRatchetKey() *ecc.ECKeyPair { + return c.senderRatchetKeyPair +} + +// SetSenderRatchetKey will set the chain state with the given EC +// key pair. +func (c *Chain) SetSenderRatchetKey(key *ecc.ECKeyPair) { + c.senderRatchetKeyPair = key +} + +// ChainKey will return the chain key in the chain state. +func (c *Chain) ChainKey() *chain.Key { + return c.chainKey +} + +// SetChainKey will set the chain state's chain key. +func (c *Chain) SetChainKey(key *chain.Key) { + c.chainKey = key +} + +// MessageKeys will return the message keys associated with the +// chain state. +func (c *Chain) MessageKeys() []*message.Keys { + return c.messageKeys +} + +// SetMessageKeys will set the chain state with the given message +// keys. +func (c *Chain) SetMessageKeys(keys []*message.Keys) { + c.messageKeys = keys +} + +// AddMessageKeys will append the chain state with the given +// message keys. +func (c *Chain) AddMessageKeys(keys *message.Keys) { + c.messageKeys = append(c.messageKeys, keys) +} + +// PopFirstMessageKeys will remove the first message key from +// the chain's list of message keys. +func (c *Chain) PopFirstMessageKeys() *message.Keys { + removed := c.messageKeys[0] + c.messageKeys = c.messageKeys[1:] + + return removed +} + +// structure returns a serializeable structure of the chain state. +func (c *Chain) structure() *ChainStructure { + // Alias to ArrayToSlice + getSlice := bytehelper.ArrayToSlice + + // Convert our message keys into a serializeable structure. + messageKeys := make([]*message.KeysStructure, len(c.messageKeys)) + for i := range c.messageKeys { + messageKeys[i] = message.NewStructFromKeys(c.messageKeys[i]) + } + + // Convert our sender ratchet key private + var senderRatchetKeyPrivate []byte + if c.senderRatchetKeyPair.PrivateKey() != nil { + senderRatchetKeyPrivate = getSlice(c.senderRatchetKeyPair.PrivateKey().Serialize()) + } + + // Build the chain structure. + return &ChainStructure{ + SenderRatchetKeyPublic: c.senderRatchetKeyPair.PublicKey().Serialize(), + SenderRatchetKeyPrivate: senderRatchetKeyPrivate, + ChainKey: chain.NewStructFromKey(c.chainKey), + MessageKeys: messageKeys, + } +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/record/Doc.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/record/Doc.go new file mode 100644 index 0000000..036419d --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/record/Doc.go @@ -0,0 +1,3 @@ +// Package record provides the state and record of an ongoing double +// ratchet session. +package record diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/record/PendingKeyExchangeState.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/record/PendingKeyExchangeState.go new file mode 100644 index 0000000..ac64721 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/record/PendingKeyExchangeState.go @@ -0,0 +1,91 @@ +package record + +import ( + "go.mau.fi/libsignal/ecc" + "go.mau.fi/libsignal/keys/identity" + "go.mau.fi/libsignal/util/bytehelper" +) + +// NewPendingKeyExchange will return a new PendingKeyExchange object. +func NewPendingKeyExchange(sequence uint32, localBaseKeyPair, localRatchetKeyPair *ecc.ECKeyPair, + localIdentityKeyPair *identity.KeyPair) *PendingKeyExchange { + + return &PendingKeyExchange{ + sequence: sequence, + localBaseKeyPair: localBaseKeyPair, + localRatchetKeyPair: localRatchetKeyPair, + localIdentityKeyPair: localIdentityKeyPair, + } +} + +// NewPendingKeyExchangeFromStruct will return a PendingKeyExchange object from +// the given structure. This is used to get a deserialized pending prekey exchange +// fetched from persistent storage. +func NewPendingKeyExchangeFromStruct(structure *PendingKeyExchangeStructure) *PendingKeyExchange { + // Return nil if no structure was provided. + if structure == nil { + return nil + } + + // Alias the SliceToArray method. + getArray := bytehelper.SliceToArray + + // Convert the bytes in the given structure to ECC objects. + localBaseKeyPair := ecc.NewECKeyPair( + ecc.NewDjbECPublicKey(getArray(structure.LocalBaseKeyPublic)), + ecc.NewDjbECPrivateKey(getArray(structure.LocalBaseKeyPrivate)), + ) + localRatchetKeyPair := ecc.NewECKeyPair( + ecc.NewDjbECPublicKey(getArray(structure.LocalRatchetKeyPublic)), + ecc.NewDjbECPrivateKey(getArray(structure.LocalRatchetKeyPrivate)), + ) + localIdentityKeyPair := identity.NewKeyPair( + identity.NewKey(ecc.NewDjbECPublicKey(getArray(structure.LocalIdentityKeyPublic))), + ecc.NewDjbECPrivateKey(getArray(structure.LocalIdentityKeyPrivate)), + ) + + // Return the PendingKeyExchange with the deserialized keys. + return &PendingKeyExchange{ + sequence: structure.Sequence, + localBaseKeyPair: localBaseKeyPair, + localRatchetKeyPair: localRatchetKeyPair, + localIdentityKeyPair: localIdentityKeyPair, + } +} + +// PendingKeyExchangeStructure is a serializable structure for pending +// key exchanges. This structure is used for persistent storage of the +// key exchange state. +type PendingKeyExchangeStructure struct { + Sequence uint32 + LocalBaseKeyPublic []byte + LocalBaseKeyPrivate []byte + LocalRatchetKeyPublic []byte + LocalRatchetKeyPrivate []byte + LocalIdentityKeyPublic []byte + LocalIdentityKeyPrivate []byte +} + +// PendingKeyExchange is a structure for storing a pending +// key exchange for a session state. +type PendingKeyExchange struct { + sequence uint32 + localBaseKeyPair *ecc.ECKeyPair + localRatchetKeyPair *ecc.ECKeyPair + localIdentityKeyPair *identity.KeyPair +} + +// structre will return a serializable structure of a pending key exchange +// so it can be persistently stored. +func (p *PendingKeyExchange) structure() *PendingKeyExchangeStructure { + getSlice := bytehelper.ArrayToSlice + return &PendingKeyExchangeStructure{ + Sequence: p.sequence, + LocalBaseKeyPublic: getSlice(p.localBaseKeyPair.PublicKey().PublicKey()), + LocalBaseKeyPrivate: getSlice(p.localBaseKeyPair.PrivateKey().Serialize()), + LocalRatchetKeyPublic: getSlice(p.localRatchetKeyPair.PublicKey().PublicKey()), + LocalRatchetKeyPrivate: getSlice(p.localRatchetKeyPair.PrivateKey().Serialize()), + LocalIdentityKeyPublic: getSlice(p.localIdentityKeyPair.PublicKey().PublicKey().PublicKey()), + LocalIdentityKeyPrivate: getSlice(p.localIdentityKeyPair.PrivateKey().Serialize()), + } +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/record/PendingPreKeyState.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/record/PendingPreKeyState.go new file mode 100644 index 0000000..27a8878 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/record/PendingPreKeyState.go @@ -0,0 +1,62 @@ +package record + +import ( + "go.mau.fi/libsignal/ecc" + "go.mau.fi/libsignal/util/optional" +) + +// NewPendingPreKey will return a new pending pre key object. +func NewPendingPreKey(preKeyID *optional.Uint32, signedPreKeyID uint32, + baseKey ecc.ECPublicKeyable) *PendingPreKey { + + return &PendingPreKey{ + preKeyID: preKeyID, + signedPreKeyID: signedPreKeyID, + baseKey: baseKey, + } +} + +// NewPendingPreKeyFromStruct will return a new pending prekey object from the +// given structure. +func NewPendingPreKeyFromStruct(preKey *PendingPreKeyStructure) (*PendingPreKey, error) { + baseKey, err := ecc.DecodePoint(preKey.BaseKey, 0) + if err != nil { + return nil, err + } + + pendingPreKey := NewPendingPreKey( + preKey.PreKeyID, + preKey.SignedPreKeyID, + baseKey, + ) + + return pendingPreKey, nil +} + +// PendingPreKeyStructure is a serializeable structure for pending +// prekeys. +type PendingPreKeyStructure struct { + PreKeyID *optional.Uint32 + SignedPreKeyID uint32 + BaseKey []byte +} + +// PendingPreKey is a structure for pending pre keys +// for a session state. +type PendingPreKey struct { + preKeyID *optional.Uint32 + signedPreKeyID uint32 + baseKey ecc.ECPublicKeyable +} + +// structure will return a serializeable structure of the pending prekey. +func (p *PendingPreKey) structure() *PendingPreKeyStructure { + if p != nil { + return &PendingPreKeyStructure{ + PreKeyID: p.preKeyID, + SignedPreKeyID: p.signedPreKeyID, + BaseKey: p.baseKey.Serialize(), + } + } + return nil +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/record/PreKeyRecord.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/record/PreKeyRecord.go new file mode 100644 index 0000000..dcd630d --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/record/PreKeyRecord.go @@ -0,0 +1,90 @@ +package record + +import ( + "go.mau.fi/libsignal/ecc" + "go.mau.fi/libsignal/util/bytehelper" + "go.mau.fi/libsignal/util/optional" +) + +// PreKeySerializer is an interface for serializing and deserializing +// PreKey objects into bytes. An implementation of this interface should be +// used to encode/decode the object into JSON, Protobuffers, etc. +type PreKeySerializer interface { + Serialize(preKey *PreKeyStructure) []byte + Deserialize(serialized []byte) (*PreKeyStructure, error) +} + +// NewPreKeyFromBytes will return a prekey record from the given bytes using the given serializer. +func NewPreKeyFromBytes(serialized []byte, serializer PreKeySerializer) (*PreKey, error) { + // Use the given serializer to decode the signal message. + preKeyStructure, err := serializer.Deserialize(serialized) + if err != nil { + return nil, err + } + + return NewPreKeyFromStruct(preKeyStructure, serializer) +} + +// NewPreKeyFromStruct returns a PreKey record using the given serializable structure. +func NewPreKeyFromStruct(structure *PreKeyStructure, serializer PreKeySerializer) (*PreKey, error) { + // Create the prekey record from the structure. + preKey := &PreKey{ + structure: *structure, + serializer: serializer, + } + + // Generate the ECC key from bytes. + publicKey := ecc.NewDjbECPublicKey(bytehelper.SliceToArray(structure.PublicKey)) + privateKey := ecc.NewDjbECPrivateKey(bytehelper.SliceToArray(structure.PrivateKey)) + keyPair := ecc.NewECKeyPair(publicKey, privateKey) + preKey.keyPair = keyPair + + return preKey, nil +} + +// NewPreKey record returns a new pre key record that can +// be stored in a PreKeyStore. +func NewPreKey(id uint32, keyPair *ecc.ECKeyPair, serializer PreKeySerializer) *PreKey { + return &PreKey{ + structure: PreKeyStructure{ + ID: id, + PublicKey: keyPair.PublicKey().Serialize(), + PrivateKey: bytehelper.ArrayToSlice(keyPair.PrivateKey().Serialize()), + }, + keyPair: keyPair, + serializer: serializer, + } +} + +// PreKeyStructure is a structure for serializing PreKey records. +type PreKeyStructure struct { + ID uint32 + PublicKey []byte + PrivateKey []byte +} + +// PreKey record is a structure for storing pre keys inside +// a PreKeyStore. +type PreKey struct { + structure PreKeyStructure + keyPair *ecc.ECKeyPair + serializer PreKeySerializer +} + +// ID returns the pre key record's id. +func (p *PreKey) ID() *optional.Uint32 { + // TODO: manually set this to empty if empty + return optional.NewOptionalUint32(p.structure.ID) +} + +// KeyPair returns the pre key record's key pair. +func (p *PreKey) KeyPair() *ecc.ECKeyPair { + return p.keyPair +} + +// Serialize uses the PreKey serializer to return the PreKey +// as serialized bytes. +func (p *PreKey) Serialize() []byte { + structure := p.structure + return p.serializer.Serialize(&structure) +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/record/SessionRecord.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/record/SessionRecord.go new file mode 100644 index 0000000..01e817e --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/record/SessionRecord.go @@ -0,0 +1,197 @@ +package record + +import ( + "bytes" +) + +// archivedStatesMaxLength describes how many previous session +// states we should keep track of. +const archivedStatesMaxLength int = 40 + +// SessionSerializer is an interface for serializing and deserializing +// a Signal Session into bytes. An implementation of this interface should be +// used to encode/decode the object into JSON, Protobuffers, etc. +type SessionSerializer interface { + Serialize(state *SessionStructure) []byte + Deserialize(serialized []byte) (*SessionStructure, error) +} + +// NewSessionFromBytes will return a Signal Session from the given +// bytes using the given serializer. +func NewSessionFromBytes(serialized []byte, serializer SessionSerializer, stateSerializer StateSerializer) (*Session, error) { + // Use the given serializer to decode the session. + sessionStructure, err := serializer.Deserialize(serialized) + if err != nil { + return nil, err + } + + return NewSessionFromStructure(sessionStructure, serializer, stateSerializer) +} + +// NewSession creates a new session record and uses the given session and state +// serializers to convert the object into storeable bytes. +func NewSession(serializer SessionSerializer, stateSerializer StateSerializer) *Session { + record := Session{ + sessionState: NewState(stateSerializer), + previousStates: []*State{}, + fresh: true, + serializer: serializer, + } + + return &record +} + +// NewSessionFromStructure will return a new Signal Session from the given +// session structure and serializer. +func NewSessionFromStructure(structure *SessionStructure, serializer SessionSerializer, + stateSerializer StateSerializer) (*Session, error) { + + // Build our previous states from structure. + previousStates := make([]*State, len(structure.PreviousStates)) + for i := range structure.PreviousStates { + var err error + previousStates[i], err = NewStateFromStructure(structure.PreviousStates[i], stateSerializer) + if err != nil { + return nil, err + } + } + + // Build our current state from structure. + sessionState, err := NewStateFromStructure(structure.SessionState, stateSerializer) + if err != nil { + return nil, err + } + + // Build and return our session. + session := &Session{ + previousStates: previousStates, + sessionState: sessionState, + serializer: serializer, + fresh: false, + } + + return session, nil +} + +// NewSessionFromState creates a new session record from the given +// session state. +func NewSessionFromState(sessionState *State, serializer SessionSerializer) *Session { + record := Session{ + sessionState: sessionState, + previousStates: []*State{}, + fresh: false, + serializer: serializer, + } + + return &record +} + +// SessionStructure is a public, serializeable structure for Signal +// Sessions. The states defined in the session are immuteable, as +// they should not be changed by anyone but the serializer. +type SessionStructure struct { + SessionState *StateStructure + PreviousStates []*StateStructure +} + +// Session encapsulates the state of an ongoing session. +type Session struct { + serializer SessionSerializer + sessionState *State + previousStates []*State + fresh bool +} + +// SetState sets the session record's current state to the given +// one. +func (r *Session) SetState(sessionState *State) { + r.sessionState = sessionState +} + +// IsFresh is used to determine if this is a brand new session +// or if a session record has already existed. +func (r *Session) IsFresh() bool { + return r.fresh +} + +// SessionState returns the session state object of the current +// session record. +func (r *Session) SessionState() *State { + return r.sessionState +} + +// PreviousSessionStates returns a list of all currently maintained +// "previous" session states. +func (r *Session) PreviousSessionStates() []*State { + return r.previousStates +} + +// HasSessionState will check this record to see if the sender's +// base key exists in the current and previous states. +func (r *Session) HasSessionState(version int, senderBaseKey []byte) bool { + // Ensure the session state version is identical to this one. + if r.sessionState.Version() == version && (bytes.Compare(senderBaseKey, r.sessionState.SenderBaseKey()) == 0) { + return true + } + + // Loop through all of our previous states and see if this + // exists in our state. + for i := range r.previousStates { + if r.previousStates[i].Version() == version && bytes.Compare(senderBaseKey, r.previousStates[i].SenderBaseKey()) == 0 { + return true + } + } + + return false +} + +// ArchiveCurrentState moves the current session state into the list +// of "previous" session states, and replaces the current session state +// with a fresh reset instance. +func (r *Session) ArchiveCurrentState() { + r.PromoteState(NewState(r.sessionState.serializer)) +} + +// PromoteState takes the given session state and replaces it with the +// current state, pushing the previous current state to "previousStates". +func (r *Session) PromoteState(promotedState *State) { + r.previousStates = r.prependStates(r.previousStates, r.sessionState) + r.sessionState = promotedState + + // Remove the last state if it has reached our maximum length + if len(r.previousStates) > archivedStatesMaxLength { + r.previousStates = r.removeLastState(r.previousStates) + } +} + +// Serialize will return the session as serialized bytes so it can be +// persistently stored. +func (r *Session) Serialize() []byte { + return r.serializer.Serialize(r.Structure()) +} + +// prependStates takes an array/slice of states and prepends it with +// the given session state. +func (r *Session) prependStates(states []*State, sessionState *State) []*State { + return append([]*State{sessionState}, states...) +} + +// removeLastState takes an array/slice of states and removes the +// last element from it. +func (r *Session) removeLastState(states []*State) []*State { + return states[:len(states)-1] +} + +// Structure will return a simple serializable session structure +// from the given structure. This is used for serialization to persistently +// store a session record. +func (r *Session) Structure() *SessionStructure { + previousStates := make([]*StateStructure, len(r.previousStates)) + for i := range r.previousStates { + previousStates[i] = r.previousStates[i].structure() + } + return &SessionStructure{ + SessionState: r.sessionState.structure(), + PreviousStates: previousStates, + } +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/record/SessionState.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/record/SessionState.go new file mode 100644 index 0000000..d0f61d5 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/record/SessionState.go @@ -0,0 +1,531 @@ +package record + +import ( + "go.mau.fi/libsignal/ecc" + "go.mau.fi/libsignal/kdf" + "go.mau.fi/libsignal/keys/chain" + "go.mau.fi/libsignal/keys/identity" + "go.mau.fi/libsignal/keys/message" + "go.mau.fi/libsignal/keys/root" + "go.mau.fi/libsignal/keys/session" + "go.mau.fi/libsignal/logger" + "go.mau.fi/libsignal/util/errorhelper" + "go.mau.fi/libsignal/util/optional" +) + +const maxMessageKeys int = 2000 +const maxReceiverChains int = 5 + +// StateSerializer is an interface for serializing and deserializing +// a Signal State into bytes. An implementation of this interface should be +// used to encode/decode the object into JSON, Protobuffers, etc. +type StateSerializer interface { + Serialize(state *StateStructure) []byte + Deserialize(serialized []byte) (*StateStructure, error) +} + +// NewStateFromBytes will return a Signal State from the given +// bytes using the given serializer. +func NewStateFromBytes(serialized []byte, serializer StateSerializer) (*State, error) { + // Use the given serializer to decode the signal message. + stateStructure, err := serializer.Deserialize(serialized) + if err != nil { + return nil, err + } + + return NewStateFromStructure(stateStructure, serializer) +} + +// NewState returns a new session state. +func NewState(serializer StateSerializer) *State { + return &State{serializer: serializer} +} + +// NewStateFromStructure will return a new session state with the +// given state structure. +func NewStateFromStructure(structure *StateStructure, serializer StateSerializer) (*State, error) { + // Keep a list of errors, so they can be handled once. + errors := errorhelper.NewMultiError() + + // Convert our ecc keys from bytes into object form. + localIdentityPublic, err := ecc.DecodePoint(structure.LocalIdentityPublic, 0) + errors.Add(err) + remoteIdentityPublic, err := ecc.DecodePoint(structure.RemoteIdentityPublic, 0) + errors.Add(err) + senderBaseKey, err := ecc.DecodePoint(structure.SenderBaseKey, 0) + errors.Add(err) + var pendingPreKey *PendingPreKey + if structure.PendingPreKey != nil { + pendingPreKey, err = NewPendingPreKeyFromStruct(structure.PendingPreKey) + errors.Add(err) + } + senderChain, err := NewChainFromStructure(structure.SenderChain) + errors.Add(err) + + // Build our receiver chains from structure. + receiverChains := make([]*Chain, len(structure.ReceiverChains)) + for i := range structure.ReceiverChains { + receiverChains[i], err = NewChainFromStructure(structure.ReceiverChains[i]) + errors.Add(err) + } + + // Handle any errors. The first error will always be returned if there are multiple. + if errors.HasErrors() { + return nil, errors + } + + // Build our state object. + state := &State{ + localIdentityPublic: identity.NewKey(localIdentityPublic), + localRegistrationID: structure.LocalRegistrationID, + needsRefresh: structure.NeedsRefresh, + pendingKeyExchange: NewPendingKeyExchangeFromStruct(structure.PendingKeyExchange), + pendingPreKey: pendingPreKey, + previousCounter: structure.PreviousCounter, + receiverChains: receiverChains, + remoteIdentityPublic: identity.NewKey(remoteIdentityPublic), + remoteRegistrationID: structure.RemoteRegistrationID, + rootKey: root.NewKey(kdf.DeriveSecrets, structure.RootKey), + senderBaseKey: senderBaseKey, + senderChain: senderChain, + serializer: serializer, + sessionVersion: structure.SessionVersion, + } + + return state, nil +} + +// StateStructure is the structure of a session state. Fields are public +// to be used for serialization and deserialization. +type StateStructure struct { + LocalIdentityPublic []byte + LocalRegistrationID uint32 + NeedsRefresh bool + PendingKeyExchange *PendingKeyExchangeStructure + PendingPreKey *PendingPreKeyStructure + PreviousCounter uint32 + ReceiverChains []*ChainStructure + RemoteIdentityPublic []byte + RemoteRegistrationID uint32 + RootKey []byte + SenderBaseKey []byte + SenderChain *ChainStructure + SessionVersion int +} + +// State is a session state that contains the structure for +// all sessions. Session states are contained inside session records. +// The session state is implemented as a struct rather than protobuffers +// to allow other serialization methods. +type State struct { + localIdentityPublic *identity.Key + localRegistrationID uint32 + needsRefresh bool + pendingKeyExchange *PendingKeyExchange + pendingPreKey *PendingPreKey + previousCounter uint32 + receiverChains []*Chain + remoteIdentityPublic *identity.Key + remoteRegistrationID uint32 + rootKey *root.Key + senderBaseKey ecc.ECPublicKeyable + senderChain *Chain + serializer StateSerializer + sessionVersion int +} + +// SenderBaseKey returns the sender's base key in bytes. +func (s *State) SenderBaseKey() []byte { + if s.senderBaseKey == nil { + return nil + } + return s.senderBaseKey.Serialize() +} + +// SetSenderBaseKey sets the sender's base key with the given bytes. +func (s *State) SetSenderBaseKey(senderBaseKey []byte) { + s.senderBaseKey, _ = ecc.DecodePoint(senderBaseKey, 0) +} + +// Version returns the session's version. +func (s *State) Version() int { + return s.sessionVersion +} + +// SetVersion sets the session state's version number. +func (s *State) SetVersion(version int) { + s.sessionVersion = version +} + +// RemoteIdentityKey returns the identity key of the remote user. +func (s *State) RemoteIdentityKey() *identity.Key { + return s.remoteIdentityPublic +} + +// SetRemoteIdentityKey sets this session's identity key for the remote +// user. +func (s *State) SetRemoteIdentityKey(identityKey *identity.Key) { + s.remoteIdentityPublic = identityKey +} + +// LocalIdentityKey returns the session's identity key for the local +// user. +func (s *State) LocalIdentityKey() *identity.Key { + return s.localIdentityPublic +} + +// SetLocalIdentityKey sets the session's identity key for the local +// user. +func (s *State) SetLocalIdentityKey(identityKey *identity.Key) { + s.localIdentityPublic = identityKey +} + +// PreviousCounter returns the counter of the previous message. +func (s *State) PreviousCounter() uint32 { + return s.previousCounter +} + +// SetPreviousCounter sets the counter for the previous message. +func (s *State) SetPreviousCounter(previousCounter uint32) { + s.previousCounter = previousCounter +} + +// RootKey returns the root key for the session. +func (s *State) RootKey() session.RootKeyable { + return s.rootKey +} + +// SetRootKey sets the root key for the session. +func (s *State) SetRootKey(rootKey session.RootKeyable) { + s.rootKey = rootKey.(*root.Key) +} + +// SenderRatchetKey returns the public ratchet key of the sender. +func (s *State) SenderRatchetKey() ecc.ECPublicKeyable { + return s.senderChain.senderRatchetKeyPair.PublicKey() +} + +// SenderRatchetKeyPair returns the public/private ratchet key pair +// of the sender. +func (s *State) SenderRatchetKeyPair() *ecc.ECKeyPair { + return s.senderChain.senderRatchetKeyPair +} + +// HasReceiverChain will check to see if the session state has +// the given ephemeral key. +func (s *State) HasReceiverChain(senderEphemeral ecc.ECPublicKeyable) bool { + return s.receiverChain(senderEphemeral) != nil +} + +// HasSenderChain will check to see if the session state has a +// sender chain. +func (s *State) HasSenderChain() bool { + return s.senderChain != nil +} + +// receiverChain will loop through the session state's receiver chains +// and compare the given ephemeral key. If it is found, then the chain +// and index will be returned as a pair. +func (s *State) receiverChain(senderEphemeral ecc.ECPublicKeyable) *ReceiverChainPair { + receiverChains := s.receiverChains + + for i, receiverChain := range receiverChains { + chainSenderRatchetKey, err := ecc.DecodePoint(receiverChain.senderRatchetKeyPair.PublicKey().Serialize(), 0) + if err != nil { + logger.Error("Error getting receiverchain: ", err) + } + + // If the chainSenderRatchetKey equals our senderEphemeral key, return it. + if chainSenderRatchetKey.PublicKey() == senderEphemeral.PublicKey() { + return NewReceiverChainPair(receiverChain, i) + } + } + + return nil +} + +// ReceiverChainKey will use the given ephemeral key to generate a new +// chain key. +func (s *State) ReceiverChainKey(senderEphemeral ecc.ECPublicKeyable) *chain.Key { + receiverChainAndIndex := s.receiverChain(senderEphemeral) + receiverChain := receiverChainAndIndex.ReceiverChain + + if receiverChainAndIndex == nil || receiverChain == nil { + return nil + } + + return chain.NewKey( + kdf.DeriveSecrets, + receiverChain.chainKey.Key(), + receiverChain.chainKey.Index(), + ) +} + +// AddReceiverChain will add the given ratchet key and chain key to the session +// state. +func (s *State) AddReceiverChain(senderRatchetKey ecc.ECPublicKeyable, chainKey session.ChainKeyable) { + // Create a keypair structure with our sender ratchet key. + senderKey := ecc.NewECKeyPair(senderRatchetKey, nil) + + // Create a Chain state object that will hold our sender key, chain key, and + // message keys. + chain := NewChain(senderKey, chainKey.(*chain.Key), []*message.Keys{}) + + // Add the Chain state to our list of receiver chain states. + s.receiverChains = append(s.receiverChains, chain) + + // If our list of receiver chains is too big, delete the oldest entry. + if len(s.receiverChains) > maxReceiverChains { + i := 0 + s.receiverChains = append(s.receiverChains[:i], s.receiverChains[i+1:]...) + } +} + +// SetSenderChain will set the given ratchet key pair and chain key for this session +// state. +func (s *State) SetSenderChain(senderRatchetKeyPair *ecc.ECKeyPair, chainKey session.ChainKeyable) { + // Create a Chain state object that will hold our sender key, chain key, and + // message keys. + chain := NewChain(senderRatchetKeyPair, chainKey.(*chain.Key), []*message.Keys{}) + + // Set the sender chain. + s.senderChain = chain +} + +// SenderChainKey will return the chain key of the session state. +func (s *State) SenderChainKey() session.ChainKeyable { + chainKey := s.senderChain.chainKey + return chain.NewKey(kdf.DeriveSecrets, chainKey.Key(), chainKey.Index()) +} + +// SetSenderChainKey will set the chain key in the chain state for this session to +// the given chain key. +func (s *State) SetSenderChainKey(nextChainKey session.ChainKeyable) { + senderChain := s.senderChain + senderChain.SetChainKey(nextChainKey.(*chain.Key)) +} + +// HasMessageKeys returns true if we have message keys associated with the given +// sender key and counter. +func (s *State) HasMessageKeys(senderEphemeral ecc.ECPublicKeyable, counter uint32) bool { + // Get our chain state that has our chain key. + chainAndIndex := s.receiverChain(senderEphemeral) + receiverChain := chainAndIndex.ReceiverChain + + // If the chain is empty, we don't have any message keys. + if receiverChain == nil { + return false + } + + // Get our message keys from our receiver chain. + messageKeyList := receiverChain.MessageKeys() + + // Loop through our message keys and compare its index with the + // given counter. + for _, messageKey := range messageKeyList { + if messageKey.Index() == counter { + return true + } + } + + return false +} + +// RemoveMessageKeys removes the message key with the given sender key and +// counter. It will return the removed message key. +func (s *State) RemoveMessageKeys(senderEphemeral ecc.ECPublicKeyable, counter uint32) *message.Keys { + // Get our chain state that has our chain key. + chainAndIndex := s.receiverChain(senderEphemeral) + chainKey := chainAndIndex.ReceiverChain + + // If the chain is empty, we don't have any message keys. + if chainKey == nil { + return nil + } + + // Get our message keys from our receiver chain. + messageKeyList := chainKey.MessageKeys() + + // Loop through our message keys and compare its index with the + // given counter. When we find a match, remove it from our list. + var rmIndex int + for i, messageKey := range messageKeyList { + if messageKey.Index() == counter { + rmIndex = i + break + } + } + + // Retrive the message key + messageKey := chainKey.messageKeys[rmIndex] + + // Delete the message key from the given position. + chainKey.messageKeys = append(chainKey.messageKeys[:rmIndex], chainKey.messageKeys[rmIndex+1:]...) + + return message.NewKeys( + messageKey.CipherKey(), + messageKey.MacKey(), + messageKey.Iv(), + messageKey.Index(), + ) +} + +// SetMessageKeys will update the chain associated with the given sender key with +// the given message keys. +func (s *State) SetMessageKeys(senderEphemeral ecc.ECPublicKeyable, messageKeys *message.Keys) { + chainAndIndex := s.receiverChain(senderEphemeral) + chainState := chainAndIndex.ReceiverChain + + // Add the message keys to our chain state. + chainState.AddMessageKeys( + message.NewKeys( + messageKeys.CipherKey(), + messageKeys.MacKey(), + messageKeys.Iv(), + messageKeys.Index(), + ), + ) + + if len(chainState.MessageKeys()) > maxMessageKeys { + chainState.PopFirstMessageKeys() + } +} + +// SetReceiverChainKey sets the session's receiver chain key with the given chain key +// associated with the given senderEphemeral key. +func (s *State) SetReceiverChainKey(senderEphemeral ecc.ECPublicKeyable, chainKey session.ChainKeyable) { + chainAndIndex := s.receiverChain(senderEphemeral) + chainState := chainAndIndex.ReceiverChain + chainState.SetChainKey(chainKey.(*chain.Key)) +} + +// SetPendingKeyExchange will set the session's pending key exchange state to the given +// sequence and key pairs. +func (s *State) SetPendingKeyExchange(sequence uint32, ourBaseKey, ourRatchetKey *ecc.ECKeyPair, + ourIdentityKey *identity.KeyPair) { + + s.pendingKeyExchange = NewPendingKeyExchange( + sequence, + ourBaseKey, + ourRatchetKey, + ourIdentityKey, + ) +} + +// PendingKeyExchangeSequence will return the session's pending key exchange sequence +// number. +func (s *State) PendingKeyExchangeSequence() uint32 { + return s.pendingKeyExchange.sequence +} + +// PendingKeyExchangeBaseKeyPair will return the session's pending key exchange base keypair. +func (s *State) PendingKeyExchangeBaseKeyPair() *ecc.ECKeyPair { + return s.pendingKeyExchange.localBaseKeyPair +} + +// PendingKeyExchangeRatchetKeyPair will return the session's pending key exchange ratchet +// keypair. +func (s *State) PendingKeyExchangeRatchetKeyPair() *ecc.ECKeyPair { + return s.pendingKeyExchange.localRatchetKeyPair +} + +// PendingKeyExchangeIdentityKeyPair will return the session's pending key exchange identity +// keypair. +func (s *State) PendingKeyExchangeIdentityKeyPair() *identity.KeyPair { + return s.pendingKeyExchange.localIdentityKeyPair +} + +// HasPendingKeyExchange will return true if there is a valid pending key exchange waiting. +func (s *State) HasPendingKeyExchange() bool { + return s.pendingKeyExchange != nil +} + +// SetUnacknowledgedPreKeyMessage will return unacknowledged pre key message with the +// given key ids and base key. +func (s *State) SetUnacknowledgedPreKeyMessage(preKeyID *optional.Uint32, signedPreKeyID uint32, baseKey ecc.ECPublicKeyable) { + s.pendingPreKey = NewPendingPreKey( + preKeyID, + signedPreKeyID, + baseKey, + ) +} + +// HasUnacknowledgedPreKeyMessage will return true if this session has an unacknowledged +// pre key message. +func (s *State) HasUnacknowledgedPreKeyMessage() bool { + return s.pendingPreKey != nil +} + +// UnackPreKeyMessageItems will return the session's unacknowledged pre key messages. +func (s *State) UnackPreKeyMessageItems() (*UnackPreKeyMessageItems, error) { + preKeyID := s.pendingPreKey.preKeyID + signedPreKeyID := s.pendingPreKey.signedPreKeyID + baseKey, err := ecc.DecodePoint(s.pendingPreKey.baseKey.Serialize(), 0) + if err != nil { + return nil, err + } + return NewUnackPreKeyMessageItems(preKeyID, signedPreKeyID, baseKey), nil +} + +// ClearUnackPreKeyMessage will clear the session's pending pre key. +func (s *State) ClearUnackPreKeyMessage() { + s.pendingPreKey = nil +} + +// SetRemoteRegistrationID sets the remote user's registration id. +func (s *State) SetRemoteRegistrationID(registrationID uint32) { + s.remoteRegistrationID = registrationID +} + +// RemoteRegistrationID returns the remote user's registration id. +func (s *State) RemoteRegistrationID() uint32 { + return s.remoteRegistrationID +} + +// SetLocalRegistrationID sets the local user's registration id. +func (s *State) SetLocalRegistrationID(registrationID uint32) { + s.localRegistrationID = registrationID +} + +// LocalRegistrationID returns the local user's registration id. +func (s *State) LocalRegistrationID() uint32 { + return s.localRegistrationID +} + +// Serialize will return the state as bytes using the given serializer. +func (s *State) Serialize() []byte { + return s.serializer.Serialize(s.structure()) +} + +// structure will return a serializable structure of the +// the given state so it can be persistently stored. +func (s *State) structure() *StateStructure { + // Convert our receiver chains into a serializeable structure + receiverChains := make([]*ChainStructure, len(s.receiverChains)) + for i := range s.receiverChains { + receiverChains[i] = s.receiverChains[i].structure() + } + + // Convert our pending key exchange into a serializeable structure + var pendingKeyExchange *PendingKeyExchangeStructure + if s.pendingKeyExchange != nil { + pendingKeyExchange = s.pendingKeyExchange.structure() + } + + // Build and return our state structure. + return &StateStructure{ + LocalIdentityPublic: s.localIdentityPublic.Serialize(), + LocalRegistrationID: s.localRegistrationID, + NeedsRefresh: s.needsRefresh, + PendingKeyExchange: pendingKeyExchange, + PendingPreKey: s.pendingPreKey.structure(), + PreviousCounter: s.previousCounter, + ReceiverChains: receiverChains, + RemoteIdentityPublic: s.remoteIdentityPublic.Serialize(), + RemoteRegistrationID: s.remoteRegistrationID, + RootKey: s.rootKey.Bytes(), + SenderBaseKey: s.senderBaseKey.Serialize(), + SenderChain: s.senderChain.structure(), + SessionVersion: s.sessionVersion, + } +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/record/SignedPreKeyRecord.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/record/SignedPreKeyRecord.go new file mode 100644 index 0000000..f11ab08 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/record/SignedPreKeyRecord.go @@ -0,0 +1,112 @@ +package record + +import ( + "go.mau.fi/libsignal/ecc" + "go.mau.fi/libsignal/util/bytehelper" +) + +// SignedPreKeySerializer is an interface for serializing and deserializing +// SignedPreKey objects into bytes. An implementation of this interface should be +// used to encode/decode the object into JSON, Protobuffers, etc. +type SignedPreKeySerializer interface { + Serialize(signedPreKey *SignedPreKeyStructure) []byte + Deserialize(serialized []byte) (*SignedPreKeyStructure, error) +} + +// NewSignedPreKeyFromBytes will return a signed prekey record from the given +// bytes using the given serializer. +func NewSignedPreKeyFromBytes(serialized []byte, serializer SignedPreKeySerializer) (*SignedPreKey, error) { + // Use the given serializer to decode the signal message. + signedPreKeyStructure, err := serializer.Deserialize(serialized) + if err != nil { + return nil, err + } + + return NewSignedPreKeyFromStruct(signedPreKeyStructure, serializer) +} + +// NewSignedPreKeyFromStruct returns a SignedPreKey record using the given +// serializable structure. +func NewSignedPreKeyFromStruct(structure *SignedPreKeyStructure, + serializer SignedPreKeySerializer) (*SignedPreKey, error) { + + // Create the signed prekey record from the structure. + signedPreKey := &SignedPreKey{ + structure: *structure, + serializer: serializer, + signature: bytehelper.SliceToArray64(structure.Signature), + } + + // Generate the ECC key from bytes. + publicKey := ecc.NewDjbECPublicKey(bytehelper.SliceToArray(structure.PublicKey)) + privateKey := ecc.NewDjbECPrivateKey(bytehelper.SliceToArray(structure.PrivateKey)) + keyPair := ecc.NewECKeyPair(publicKey, privateKey) + signedPreKey.keyPair = keyPair + + return signedPreKey, nil +} + +// NewSignedPreKey record creates a new signed pre key record +// with the given properties. +func NewSignedPreKey(id uint32, timestamp int64, keyPair *ecc.ECKeyPair, + sig [64]byte, serializer SignedPreKeySerializer) *SignedPreKey { + + return &SignedPreKey{ + structure: SignedPreKeyStructure{ + ID: id, + Timestamp: timestamp, + PublicKey: keyPair.PublicKey().Serialize(), + PrivateKey: bytehelper.ArrayToSlice(keyPair.PrivateKey().Serialize()), + Signature: bytehelper.ArrayToSlice64(sig), + }, + keyPair: keyPair, + signature: sig, + serializer: serializer, + } +} + +// SignedPreKeyStructure is a flat structure of a signed pre key, used +// for serialization and deserialization. +type SignedPreKeyStructure struct { + ID uint32 + PublicKey []byte + PrivateKey []byte + Signature []byte + Timestamp int64 +} + +// SignedPreKey record is a structure for storing a signed +// pre key in a SignedPreKey store. +type SignedPreKey struct { + structure SignedPreKeyStructure + keyPair *ecc.ECKeyPair + signature [64]byte + serializer SignedPreKeySerializer +} + +// ID returns the record's id. +func (s *SignedPreKey) ID() uint32 { + return s.structure.ID +} + +// Timestamp returns the record's timestamp +func (s *SignedPreKey) Timestamp() int64 { + return s.structure.Timestamp +} + +// KeyPair returns the signed pre key record's key pair. +func (s *SignedPreKey) KeyPair() *ecc.ECKeyPair { + return s.keyPair +} + +// Signature returns the record's signed prekey signature. +func (s *SignedPreKey) Signature() [64]byte { + return s.signature +} + +// Serialize uses the SignedPreKey serializer to return the SignedPreKey +// as serialized bytes. +func (s *SignedPreKey) Serialize() []byte { + structure := s.structure + return s.serializer.Serialize(&structure) +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/record/UnacknowledgedPreKey.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/record/UnacknowledgedPreKey.go new file mode 100644 index 0000000..61fe064 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/record/UnacknowledgedPreKey.go @@ -0,0 +1,69 @@ +package record + +import ( + "go.mau.fi/libsignal/ecc" + "go.mau.fi/libsignal/util/optional" +) + +// NewUnackPreKeyMessageItems returns message items that are unacknowledged. +func NewUnackPreKeyMessageItems(preKeyID *optional.Uint32, signedPreKeyID uint32, + baseKey ecc.ECPublicKeyable) *UnackPreKeyMessageItems { + + return &UnackPreKeyMessageItems{ + preKeyID: preKeyID, + signedPreKeyID: signedPreKeyID, + baseKey: baseKey, + } +} + +// NewUnackPreKeyMessageItemsFromStruct will return a new unacknowledged prekey +// message items object from the given structure. +func NewUnackPreKeyMessageItemsFromStruct(structure *UnackPreKeyMessageItemsStructure) *UnackPreKeyMessageItems { + baseKey, _ := ecc.DecodePoint(structure.BaseKey, 0) + return NewUnackPreKeyMessageItems( + structure.PreKeyID, + structure.SignedPreKeyID, + baseKey, + ) +} + +// UnackPreKeyMessageItemsStructure is a serializable structure for unackowledged +// prekey message items. +type UnackPreKeyMessageItemsStructure struct { + PreKeyID *optional.Uint32 + SignedPreKeyID uint32 + BaseKey []byte +} + +// UnackPreKeyMessageItems is a structure for messages that have not been +// acknowledged. +type UnackPreKeyMessageItems struct { + preKeyID *optional.Uint32 + signedPreKeyID uint32 + baseKey ecc.ECPublicKeyable +} + +// PreKeyID returns the prekey id of the unacknowledged message. +func (u *UnackPreKeyMessageItems) PreKeyID() *optional.Uint32 { + return u.preKeyID +} + +// SignedPreKeyID returns the signed prekey id of the unacknowledged message. +func (u *UnackPreKeyMessageItems) SignedPreKeyID() uint32 { + return u.signedPreKeyID +} + +// BaseKey returns the ECC public key of the unacknowledged message. +func (u *UnackPreKeyMessageItems) BaseKey() ecc.ECPublicKeyable { + return u.baseKey +} + +// structure will return a serializable base structure +// for unacknowledged prekey message items. +func (u *UnackPreKeyMessageItems) structure() *UnackPreKeyMessageItemsStructure { + return &UnackPreKeyMessageItemsStructure{ + PreKeyID: u.preKeyID, + SignedPreKeyID: u.signedPreKeyID, + BaseKey: u.baseKey.Serialize(), + } +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/store/Doc.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/store/Doc.go new file mode 100644 index 0000000..9a018d3 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/store/Doc.go @@ -0,0 +1,3 @@ +// Package store provides the storage interfaces for storing the state of +// ongoing double ratchet sessions and keys. +package store diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/store/IdentityKeyStore.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/store/IdentityKeyStore.go new file mode 100644 index 0000000..05ad8d1 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/store/IdentityKeyStore.go @@ -0,0 +1,29 @@ +package store + +import ( + "go.mau.fi/libsignal/keys/identity" + "go.mau.fi/libsignal/protocol" +) + +// IdentityKey provides an interface to identity information. +type IdentityKey interface { + // Get the local client's identity key pair. + GetIdentityKeyPair() *identity.KeyPair + + // Return the local client's registration ID. + // + // Clients should maintain a registration ID, a random number between 1 and 16380 + // that's generated once at install time. + GetLocalRegistrationId() uint32 + + // Save a remote client's identity key in our identity store. + SaveIdentity(address *protocol.SignalAddress, identityKey *identity.Key) + + // Verify a remote client's identity key. + // + // Determine whether a remote client's identity is trusted. Trust is based on + // 'trust on first use'. This means that an identity key is considered 'trusted' + // if there is no entry for the recipient in the local store, or if it matches the + // saved key for a recipient in the local store. + IsTrustedIdentity(address *protocol.SignalAddress, identityKey *identity.Key) bool +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/store/MessageKeyStore.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/store/MessageKeyStore.go new file mode 100644 index 0000000..fea2eed --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/store/MessageKeyStore.go @@ -0,0 +1,21 @@ +package store + +import ( + "go.mau.fi/libsignal/keys/message" +) + +// MessageKey store is an interface describing the optional local storage +// of message keys. +type MessageKey interface { + // Load a local message key by id + LoadMessageKey(keyID uint32) *message.Keys + + // Store a local message key + StoreMessageKey(keyID uint32, key *message.Keys) + + // Check to see if the store contains a message key with id. + ContainsMessageKey(keyID uint32) bool + + // Delete a message key from local storage. + RemoveMessageKey(keyID uint32) +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/store/PreKeyStore.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/store/PreKeyStore.go new file mode 100644 index 0000000..a132be6 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/store/PreKeyStore.go @@ -0,0 +1,21 @@ +package store + +import ( + "go.mau.fi/libsignal/state/record" +) + +// PreKey store is an interface describing the local storage +// of PreKeyRecords +type PreKey interface { + // Load a local PreKeyRecord + LoadPreKey(preKeyID uint32) *record.PreKey + + // Store a local PreKeyRecord + StorePreKey(preKeyID uint32, preKeyRecord *record.PreKey) + + // Check to see if the store contains a PreKeyRecord + ContainsPreKey(preKeyID uint32) bool + + // Delete a PreKeyRecord from local storage. + RemovePreKey(preKeyID uint32) +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/store/SessionStore.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/store/SessionStore.go new file mode 100644 index 0000000..e18fc02 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/store/SessionStore.go @@ -0,0 +1,17 @@ +package store + +import ( + "go.mau.fi/libsignal/protocol" + "go.mau.fi/libsignal/state/record" +) + +// Session store is an interface for the persistent storage of session +// state information for remote clients. +type Session interface { + LoadSession(address *protocol.SignalAddress) *record.Session + GetSubDeviceSessions(name string) []uint32 + StoreSession(remoteAddress *protocol.SignalAddress, record *record.Session) + ContainsSession(remoteAddress *protocol.SignalAddress) bool + DeleteSession(remoteAddress *protocol.SignalAddress) + DeleteAllSessions() +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/store/SignalProtocolStore.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/store/SignalProtocolStore.go new file mode 100644 index 0000000..081e038 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/store/SignalProtocolStore.go @@ -0,0 +1,15 @@ +package store + +import ( + "go.mau.fi/libsignal/groups/state/store" +) + +// SignalProtocol store is an interface that implements the +// methods for all stores needed in the Signal Protocol. +type SignalProtocol interface { + IdentityKey + PreKey + Session + SignedPreKey + store.SenderKey +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/store/SignedPreKeyStore.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/store/SignedPreKeyStore.go new file mode 100644 index 0000000..058cd67 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/state/store/SignedPreKeyStore.go @@ -0,0 +1,24 @@ +package store + +import ( + "go.mau.fi/libsignal/state/record" +) + +// SignedPreKey store is an interface that describes how to persistently +// store signed PreKeys. +type SignedPreKey interface { + // LoadSignedPreKey loads a local SignedPreKeyRecord + LoadSignedPreKey(signedPreKeyID uint32) *record.SignedPreKey + + // LoadSignedPreKeys loads all local SignedPreKeyRecords + LoadSignedPreKeys() []*record.SignedPreKey + + // Store a local SignedPreKeyRecord + StoreSignedPreKey(signedPreKeyID uint32, record *record.SignedPreKey) + + // Check to see if store contains the given record + ContainsSignedPreKey(signedPreKeyID uint32) bool + + // Delete a SignedPreKeyRecord from local storage + RemoveSignedPreKey(signedPreKeyID uint32) +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/util/bytehelper/ByteHelper.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/util/bytehelper/ByteHelper.go new file mode 100644 index 0000000..78f71ae --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/util/bytehelper/ByteHelper.go @@ -0,0 +1,97 @@ +package bytehelper + +import ( + "errors" +) + +// SliceToArray will convert byte slice to a 32 byte array +func SliceToArray(bytes []byte) [32]byte { + var byteArray [32]byte + copy(byteArray[:], bytes) + return byteArray +} + +// SliceToArray64 will convert byte slice to a 64 byte array +func SliceToArray64(bytes []byte) [64]byte { + var byteArray [64]byte + copy(byteArray[:], bytes) + return byteArray +} + +// ArrayToSlice will convert a 32 byte array to byte slice +func ArrayToSlice(bytes [32]byte) []byte { + return bytes[:] +} + +// ArrayToSlice64 will convert a 64 byte array to byte slice +func ArrayToSlice64(bytes [64]byte) []byte { + return bytes[:] +} + +// Split will take the given byte array and split it into half, +// with the first half being "firstLength" in size and the second +// half "secondLength" in size. +func Split(input []byte, firstLength, secondLength int) [][]byte { + parts := make([][]byte, 2) + + parts[0] = make([]byte, firstLength) + copy(parts[0], input[:firstLength]) + + parts[1] = make([]byte, secondLength) + copy(parts[1], input[firstLength:]) + + return parts +} + +// SplitThree will take the given byte array and split it into thirds, +// with the first third being "firstLength" in size, the second third +// being "secondLength" in size, and the last third being "thirdLength" +// in size. +func SplitThree(input []byte, firstLength, secondLength, thirdLength int) ([][]byte, error) { + if input == nil || firstLength < 0 || secondLength < 0 || thirdLength < 0 || + len(input) < firstLength+secondLength+thirdLength { + + return nil, errors.New("Input too small: " + string(input)) + } + + parts := make([][]byte, 3) + + parts[0] = make([]byte, firstLength) + copy(parts[0], input[:firstLength]) + + parts[1] = make([]byte, secondLength) + copy(parts[1], input[firstLength:][:secondLength]) + + parts[2] = make([]byte, thirdLength) + copy(parts[2], input[firstLength+secondLength:]) + + return parts, nil +} + +// Trim will trim the given byte array to the given length. +func Trim(input []byte, length int) []byte { + result := make([]byte, length) + copy(result, input[:length]) + + return result +} + +// Bytes5ToInt64 will convert the given byte array and offset to an int64. +func Bytes5ToInt64(bytes []byte, offset int) int64 { + + value := (int64(bytes[offset]&0xff) << 32) | + (int64(bytes[offset+1]&0xff) << 24) | + (int64(bytes[offset+2]&0xff) << 16) | + (int64(bytes[offset+3]&0xff) << 8) | + int64(bytes[offset+4]&0xff) + + return value +} + +// CopySlice returns a copy of the given bytes. +func CopySlice(bytes []byte) []byte { + cp := make([]byte, len(bytes)) + copy(cp, bytes) + + return cp +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/util/errorhelper/ErrorHelper.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/util/errorhelper/ErrorHelper.go new file mode 100644 index 0000000..b30adb0 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/util/errorhelper/ErrorHelper.go @@ -0,0 +1,40 @@ +package errorhelper + +// NewMultiError returns a new MultiError object. +func NewMultiError() *MultiError { + return &MultiError{ + errors: []error{}, + } +} + +// MultiError is a structure for holding multiple errors so they +// can be checked at a later point. +type MultiError struct { + errors []error +} + +// Add will add the given error if it is not nil. +func (m *MultiError) Add(err error) { + if err != nil { + m.errors = append(m.errors, err) + } +} + +// HasErrors will return true if any non-nil errors have been +// added. +func (m *MultiError) HasErrors() bool { + if len(m.errors) > 0 { + return true + } + + return false +} + +// Error will print the first error is encountered. +func (m *MultiError) Error() string { + if !m.HasErrors() { + return "" + } + + return m.errors[0].Error() +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/util/keyhelper/KeyHelper.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/util/keyhelper/KeyHelper.go new file mode 100644 index 0000000..62481cc --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/util/keyhelper/KeyHelper.go @@ -0,0 +1,95 @@ +// Package keyhelper is based on: https://github.com/WhisperSystems/libsignal-protocol-java/blob/master/java/src/main/java/org/whispersystems/libsignal/util/KeyHelper.java +package keyhelper + +import ( + "crypto/rand" + "encoding/binary" + "time" + + "go.mau.fi/libsignal/ecc" + "go.mau.fi/libsignal/keys/identity" + "go.mau.fi/libsignal/state/record" +) + +// GenerateIdentityKeyPair generates an identity keypair used for +// signing. Clients should only do this once at install time. +func GenerateIdentityKeyPair() (*identity.KeyPair, error) { + keyPair, err := ecc.GenerateKeyPair() + if err != nil { + return nil, err + } + + publicKey := identity.NewKey(keyPair.PublicKey()) + return identity.NewKeyPair(publicKey, keyPair.PrivateKey()), nil +} + +// GeneratePreKeys generates a list of PreKeys. Client shsould do this at +// install time, and subsequently any time the list of PreKeys stored on +// the server runs low. +// +// PreKeys IDs are shorts, so they will eventually be repeated. Clients +// should store PreKeys in a circular buffer, so that they are repeated +// as infrequently as possible. +func GeneratePreKeys(start int, count int, serializer record.PreKeySerializer) ([]*record.PreKey, error) { + var preKeys []*record.PreKey + + for i := start; i <= count; i++ { + key, err := ecc.GenerateKeyPair() + if err != nil { + return nil, err + } + preKeys = append(preKeys, record.NewPreKey(uint32(i), key, serializer)) + } + + return preKeys, nil +} + +// GenerateLastResortKey will generate the last resort PreKey. Clients should +// do this only once, at install time, and durably store it for the length +// of the install. +func GenerateLastResortKey(serializer record.PreKeySerializer) (*record.PreKey, error) { + keyPair, err := ecc.GenerateKeyPair() + if err != nil { + return nil, err + } + return record.NewPreKey(0, keyPair, serializer), nil +} + +// GenerateSignedPreKey generates a signed PreKey. +func GenerateSignedPreKey(identityKeyPair *identity.KeyPair, signedPreKeyID uint32, serializer record.SignedPreKeySerializer) (*record.SignedPreKey, error) { + keyPair, err := ecc.GenerateKeyPair() + if err != nil { + return nil, err + } + signature := ecc.CalculateSignature(identityKeyPair.PrivateKey(), keyPair.PublicKey().Serialize()) + timestamp := time.Now().Unix() + + return record.NewSignedPreKey(signedPreKeyID, timestamp, keyPair, signature, serializer), nil +} + +// GenerateRegistrationID generates a registration ID. Clients should only do +// this once, at install time. +func GenerateRegistrationID() uint32 { + var n uint32 + binary.Read(rand.Reader, binary.LittleEndian, &n) + + return n +} + +//---------- Group Stuff ---------------- + +func GenerateSenderSigningKey() (*ecc.ECKeyPair, error) { + return ecc.GenerateKeyPair() +} + +func GenerateSenderKey() []byte { + randBytes := make([]byte, 32) + rand.Read(randBytes) + return randBytes +} + +func GenerateSenderKeyID() uint32 { + return GenerateRegistrationID() +} + +//---------- End Group Stuff -------------- diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/util/medium/Medium.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/util/medium/Medium.go new file mode 100644 index 0000000..7a509a8 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/util/medium/Medium.go @@ -0,0 +1,4 @@ +package medium + +// MaxValue is the maximum possible integer value. +const MaxValue uint32 = 0xFFFFFF diff --git a/teleirc/matterbridge/vendor/go.mau.fi/libsignal/util/optional/Integer.go b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/util/optional/Integer.go new file mode 100644 index 0000000..9e43af4 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/libsignal/util/optional/Integer.go @@ -0,0 +1,17 @@ +package optional + +// NewOptionalUint32 returns an optional Uint32 structure. +func NewOptionalUint32(value uint32) *Uint32 { + return &Uint32{Value: value, IsEmpty: false} +} + +func NewEmptyUint32() *Uint32 { + return &Uint32{IsEmpty: true} +} + +// Uint32 is a simple structure for Uint32 values that can +// optionally be nil. +type Uint32 struct { + Value uint32 + IsEmpty bool +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/LICENSE b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/LICENSE new file mode 100644 index 0000000..52d1351 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/LICENSE @@ -0,0 +1,374 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. + diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/README.md b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/README.md new file mode 100644 index 0000000..123239b --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/README.md @@ -0,0 +1,38 @@ +# whatsmeow +[](https://pkg.go.dev/go.mau.fi/whatsmeow) + +whatsmeow is a Go library for the WhatsApp web multidevice API. + +## Discussion +Matrix room: [#whatsmeow:maunium.net](https://matrix.to/#/#whatsmeow:maunium.net) + +For questions about the WhatsApp protocol (like how to send a specific type of +message), you can also use the [WhatsApp protocol Q&A] section on GitHub +discussions. + +[WhatsApp protocol Q&A]: https://github.com/tulir/whatsmeow/discussions/categories/whatsapp-protocol-q-a + +## Usage +The [godoc](https://pkg.go.dev/go.mau.fi/whatsmeow) includes docs for all methods and event types. +There's also a [simple example](https://godocs.io/go.mau.fi/whatsmeow#example-package) at the top. + +Also see [mdtest](./mdtest) for a CLI tool you can easily try out whatsmeow with. + +## Features +Most core features are already present: + +* Sending messages to private chats and groups (both text and media) +* Receiving all messages +* Managing groups and receiving group change events +* Joining via invite messages, using and creating invite links +* Sending and receiving typing notifications +* Sending and receiving delivery and read receipts +* Reading app state (contact list, chat pin/mute status, etc) +* Sending and handling retry receipts if message decryption fails +* Sending status messages (experimental, may not work for large contact lists) + +Things that are not yet implemented: + +* Writing app state (contact list, chat pin/mute status, etc) +* Sending broadcast list messages (this is not supported on WhatsApp web either) +* Calls diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/appstate.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/appstate.go new file mode 100644 index 0000000..7e99b51 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/appstate.go @@ -0,0 +1,282 @@ +// Copyright (c) 2022 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package whatsmeow + +import ( + "context" + "encoding/hex" + "errors" + "fmt" + "time" + + "go.mau.fi/whatsmeow/appstate" + waBinary "go.mau.fi/whatsmeow/binary" + waProto "go.mau.fi/whatsmeow/binary/proto" + "go.mau.fi/whatsmeow/store" + "go.mau.fi/whatsmeow/types" + "go.mau.fi/whatsmeow/types/events" +) + +// FetchAppState fetches updates to the given type of app state. If fullSync is true, the current +// cached state will be removed and all app state patches will be re-fetched from the server. +func (cli *Client) FetchAppState(name appstate.WAPatchName, fullSync, onlyIfNotSynced bool) error { + cli.appStateSyncLock.Lock() + defer cli.appStateSyncLock.Unlock() + if fullSync { + err := cli.Store.AppState.DeleteAppStateVersion(string(name)) + if err != nil { + return fmt.Errorf("failed to reset app state %s version: %w", name, err) + } + } + version, hash, err := cli.Store.AppState.GetAppStateVersion(string(name)) + if err != nil { + return fmt.Errorf("failed to get app state %s version: %w", name, err) + } + if version == 0 { + fullSync = true + } else if onlyIfNotSynced { + return nil + } + + state := appstate.HashState{Version: version, Hash: hash} + + hasMore := true + wantSnapshot := fullSync + for hasMore { + patches, err := cli.fetchAppStatePatches(name, state.Version, wantSnapshot) + wantSnapshot = false + if err != nil { + return fmt.Errorf("failed to fetch app state %s patches: %w", name, err) + } + hasMore = patches.HasMorePatches + + mutations, newState, err := cli.appStateProc.DecodePatches(patches, state, true) + if err != nil { + if errors.Is(err, appstate.ErrKeyNotFound) { + go cli.requestMissingAppStateKeys(context.TODO(), patches) + } + return fmt.Errorf("failed to decode app state %s patches: %w", name, err) + } + wasFullSync := state.Version == 0 && patches.Snapshot != nil + state = newState + if name == appstate.WAPatchCriticalUnblockLow && wasFullSync && !cli.EmitAppStateEventsOnFullSync { + var contacts []store.ContactEntry + mutations, contacts = cli.filterContacts(mutations) + cli.Log.Debugf("Mass inserting app state snapshot with %d contacts into the store", len(contacts)) + err = cli.Store.Contacts.PutAllContactNames(contacts) + if err != nil { + // This is a fairly serious failure, so just abort the whole thing + return fmt.Errorf("failed to update contact store with data from snapshot: %v", err) + } + } + for _, mutation := range mutations { + cli.dispatchAppState(mutation, !fullSync || cli.EmitAppStateEventsOnFullSync) + } + } + if fullSync { + cli.Log.Debugf("Full sync of app state %s completed. Current version: %d", name, state.Version) + cli.dispatchEvent(&events.AppStateSyncComplete{Name: name}) + } else { + cli.Log.Debugf("Synced app state %s from version %d to %d", name, version, state.Version) + } + return nil +} + +func (cli *Client) filterContacts(mutations []appstate.Mutation) ([]appstate.Mutation, []store.ContactEntry) { + filteredMutations := mutations[:0] + contacts := make([]store.ContactEntry, 0, len(mutations)) + for _, mutation := range mutations { + if mutation.Index[0] == "contact" && len(mutation.Index) > 1 { + jid, _ := types.ParseJID(mutation.Index[1]) + act := mutation.Action.GetContactAction() + contacts = append(contacts, store.ContactEntry{ + JID: jid, + FirstName: act.GetFirstName(), + FullName: act.GetFullName(), + }) + } else { + filteredMutations = append(filteredMutations, mutation) + } + } + return filteredMutations, contacts +} + +func (cli *Client) dispatchAppState(mutation appstate.Mutation, dispatchEvts bool) { + if mutation.Operation != waProto.SyncdMutation_SET { + return + } + + if dispatchEvts { + cli.dispatchEvent(&events.AppState{Index: mutation.Index, SyncActionValue: mutation.Action}) + } + + var jid types.JID + if len(mutation.Index) > 1 { + jid, _ = types.ParseJID(mutation.Index[1]) + } + ts := time.Unix(mutation.Action.GetTimestamp(), 0) + + var storeUpdateError error + var eventToDispatch interface{} + switch mutation.Index[0] { + case "mute": + act := mutation.Action.GetMuteAction() + eventToDispatch = &events.Mute{JID: jid, Timestamp: ts, Action: act} + var mutedUntil time.Time + if act.GetMuted() { + mutedUntil = time.Unix(act.GetMuteEndTimestamp(), 0) + } + if cli.Store.ChatSettings != nil { + storeUpdateError = cli.Store.ChatSettings.PutMutedUntil(jid, mutedUntil) + } + case "pin_v1": + act := mutation.Action.GetPinAction() + eventToDispatch = &events.Pin{JID: jid, Timestamp: ts, Action: act} + if cli.Store.ChatSettings != nil { + storeUpdateError = cli.Store.ChatSettings.PutPinned(jid, act.GetPinned()) + } + case "archive": + act := mutation.Action.GetArchiveChatAction() + eventToDispatch = &events.Archive{JID: jid, Timestamp: ts, Action: act} + if cli.Store.ChatSettings != nil { + storeUpdateError = cli.Store.ChatSettings.PutArchived(jid, act.GetArchived()) + } + case "contact": + act := mutation.Action.GetContactAction() + eventToDispatch = &events.Contact{JID: jid, Timestamp: ts, Action: act} + if cli.Store.Contacts != nil { + storeUpdateError = cli.Store.Contacts.PutContactName(jid, act.GetFirstName(), act.GetFullName()) + } + case "deleteChat": + act := mutation.Action.GetDeleteChatAction() + eventToDispatch = &events.DeleteChat{JID: jid, Timestamp: ts, Action: act} + case "star": + if len(mutation.Index) < 5 { + return + } + evt := events.Star{ + ChatJID: jid, + MessageID: mutation.Index[2], + Timestamp: ts, + Action: mutation.Action.GetStarAction(), + IsFromMe: mutation.Index[3] == "1", + } + if mutation.Index[4] != "0" { + evt.SenderJID, _ = types.ParseJID(mutation.Index[4]) + } + eventToDispatch = &evt + case "deleteMessageForMe": + if len(mutation.Index) < 5 { + return + } + evt := events.DeleteForMe{ + ChatJID: jid, + MessageID: mutation.Index[2], + Timestamp: ts, + Action: mutation.Action.GetDeleteMessageForMeAction(), + IsFromMe: mutation.Index[3] == "1", + } + if mutation.Index[4] != "0" { + evt.SenderJID, _ = types.ParseJID(mutation.Index[4]) + } + eventToDispatch = &evt + case "markChatAsRead": + eventToDispatch = &events.MarkChatAsRead{ + JID: jid, + Timestamp: ts, + Action: mutation.Action.GetMarkChatAsReadAction(), + } + case "setting_pushName": + eventToDispatch = &events.PushNameSetting{Timestamp: ts, Action: mutation.Action.GetPushNameSetting()} + cli.Store.PushName = mutation.Action.GetPushNameSetting().GetName() + err := cli.Store.Save() + if err != nil { + cli.Log.Errorf("Failed to save device store after updating push name: %v", err) + } + case "setting_unarchiveChats": + eventToDispatch = &events.UnarchiveChatsSetting{Timestamp: ts, Action: mutation.Action.GetUnarchiveChatsSetting()} + } + if storeUpdateError != nil { + cli.Log.Errorf("Failed to update device store after app state mutation: %v", storeUpdateError) + } + if dispatchEvts && eventToDispatch != nil { + cli.dispatchEvent(eventToDispatch) + } +} + +func (cli *Client) downloadExternalAppStateBlob(ref *waProto.ExternalBlobReference) ([]byte, error) { + return cli.Download(ref) +} + +func (cli *Client) fetchAppStatePatches(name appstate.WAPatchName, fromVersion uint64, snapshot bool) (*appstate.PatchList, error) { + attrs := waBinary.Attrs{ + "name": string(name), + "return_snapshot": snapshot, + } + if !snapshot { + attrs["version"] = fromVersion + } + resp, err := cli.sendIQ(infoQuery{ + Namespace: "w:sync:app:state", + Type: "set", + To: types.ServerJID, + Content: []waBinary.Node{{ + Tag: "sync", + Content: []waBinary.Node{{ + Tag: "collection", + Attrs: attrs, + }}, + }}, + }) + if err != nil { + return nil, err + } + return appstate.ParsePatchList(resp, cli.downloadExternalAppStateBlob) +} + +func (cli *Client) requestMissingAppStateKeys(ctx context.Context, patches *appstate.PatchList) { + cli.appStateKeyRequestsLock.Lock() + rawKeyIDs := cli.appStateProc.GetMissingKeyIDs(patches) + filteredKeyIDs := make([][]byte, 0, len(rawKeyIDs)) + now := time.Now() + for _, keyID := range rawKeyIDs { + stringKeyID := hex.EncodeToString(keyID) + lastRequestTime := cli.appStateKeyRequests[stringKeyID] + if lastRequestTime.IsZero() || lastRequestTime.Add(24*time.Hour).Before(now) { + cli.appStateKeyRequests[stringKeyID] = now + filteredKeyIDs = append(filteredKeyIDs, keyID) + } + } + cli.appStateKeyRequestsLock.Unlock() + cli.requestAppStateKeys(ctx, filteredKeyIDs) +} + +func (cli *Client) requestAppStateKeys(ctx context.Context, rawKeyIDs [][]byte) { + keyIDs := make([]*waProto.AppStateSyncKeyId, len(rawKeyIDs)) + debugKeyIDs := make([]string, len(rawKeyIDs)) + for i, keyID := range rawKeyIDs { + keyIDs[i] = &waProto.AppStateSyncKeyId{KeyId: keyID} + debugKeyIDs[i] = hex.EncodeToString(keyID) + } + msg := &waProto.Message{ + ProtocolMessage: &waProto.ProtocolMessage{ + Type: waProto.ProtocolMessage_APP_STATE_SYNC_KEY_REQUEST.Enum(), + AppStateSyncKeyRequest: &waProto.AppStateSyncKeyRequest{ + KeyIds: keyIDs, + }, + }, + } + ownID := cli.getOwnID().ToNonAD() + if ownID.IsEmpty() { + return + } + cli.Log.Infof("Sending key request for app state keys %+v", debugKeyIDs) + _, err := cli.SendMessage(ctx, ownID, msg, SendRequestExtra{Peer: true}) + if err != nil { + cli.Log.Warnf("Failed to send app state key request: %v", err) + } +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/appstate/decode.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/appstate/decode.go new file mode 100644 index 0000000..5c89547 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/appstate/decode.go @@ -0,0 +1,310 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package appstate + +import ( + "bytes" + "crypto/sha256" + "encoding/json" + "fmt" + + "google.golang.org/protobuf/proto" + + waBinary "go.mau.fi/whatsmeow/binary" + waProto "go.mau.fi/whatsmeow/binary/proto" + "go.mau.fi/whatsmeow/store" + "go.mau.fi/whatsmeow/util/cbcutil" +) + +// PatchList represents a decoded response to getting app state patches from the WhatsApp servers. +type PatchList struct { + Name WAPatchName + HasMorePatches bool + Patches []*waProto.SyncdPatch + Snapshot *waProto.SyncdSnapshot +} + +// DownloadExternalFunc is a function that can download a blob of external app state patches. +type DownloadExternalFunc func(*waProto.ExternalBlobReference) ([]byte, error) + +func parseSnapshotInternal(collection *waBinary.Node, downloadExternal DownloadExternalFunc) (*waProto.SyncdSnapshot, error) { + snapshotNode := collection.GetChildByTag("snapshot") + rawSnapshot, ok := snapshotNode.Content.([]byte) + if snapshotNode.Tag != "snapshot" || !ok { + return nil, nil + } + var snapshot waProto.ExternalBlobReference + err := proto.Unmarshal(rawSnapshot, &snapshot) + if err != nil { + return nil, fmt.Errorf("failed to unmarshal snapshot: %w", err) + } + var rawData []byte + rawData, err = downloadExternal(&snapshot) + if err != nil { + return nil, fmt.Errorf("failed to download external mutations: %w", err) + } + var downloaded waProto.SyncdSnapshot + err = proto.Unmarshal(rawData, &downloaded) + if err != nil { + return nil, fmt.Errorf("failed to unmarshal mutation list: %w", err) + } + return &downloaded, nil +} + +func parsePatchListInternal(collection *waBinary.Node, downloadExternal DownloadExternalFunc) ([]*waProto.SyncdPatch, error) { + patchesNode := collection.GetChildByTag("patches") + patchNodes := patchesNode.GetChildren() + patches := make([]*waProto.SyncdPatch, 0, len(patchNodes)) + for i, patchNode := range patchNodes { + rawPatch, ok := patchNode.Content.([]byte) + if patchNode.Tag != "patch" || !ok { + continue + } + var patch waProto.SyncdPatch + err := proto.Unmarshal(rawPatch, &patch) + if err != nil { + return nil, fmt.Errorf("failed to unmarshal patch #%d: %w", i+1, err) + } + if patch.GetExternalMutations() != nil && downloadExternal != nil { + var rawData []byte + rawData, err = downloadExternal(patch.GetExternalMutations()) + if err != nil { + return nil, fmt.Errorf("failed to download external mutations: %w", err) + } + var downloaded waProto.SyncdMutations + err = proto.Unmarshal(rawData, &downloaded) + if err != nil { + return nil, fmt.Errorf("failed to unmarshal mutation list: %w", err) + } else if len(downloaded.GetMutations()) == 0 { + return nil, fmt.Errorf("didn't get any mutations from download") + } + patch.Mutations = downloaded.Mutations + } + patches = append(patches, &patch) + } + return patches, nil +} + +// ParsePatchList will decode an XML node containing app state patches, including downloading any external blobs. +func ParsePatchList(node *waBinary.Node, downloadExternal DownloadExternalFunc) (*PatchList, error) { + collection := node.GetChildByTag("sync", "collection") + ag := collection.AttrGetter() + snapshot, err := parseSnapshotInternal(&collection, downloadExternal) + if err != nil { + return nil, err + } + patches, err := parsePatchListInternal(&collection, downloadExternal) + if err != nil { + return nil, err + } + list := &PatchList{ + Name: WAPatchName(ag.String("name")), + HasMorePatches: ag.OptionalBool("has_more_patches"), + Patches: patches, + Snapshot: snapshot, + } + return list, ag.Error() +} + +type patchOutput struct { + RemovedMACs [][]byte + AddedMACs []store.AppStateMutationMAC + Mutations []Mutation +} + +func (proc *Processor) decodeMutations(mutations []*waProto.SyncdMutation, out *patchOutput, validateMACs bool) error { + for i, mutation := range mutations { + keyID := mutation.GetRecord().GetKeyId().GetId() + keys, err := proc.getAppStateKey(keyID) + if err != nil { + return fmt.Errorf("failed to get key %X to decode mutation: %w", keyID, err) + } + content := mutation.GetRecord().GetValue().GetBlob() + content, valueMAC := content[:len(content)-32], content[len(content)-32:] + if validateMACs { + expectedValueMAC := generateContentMAC(mutation.GetOperation(), content, keyID, keys.ValueMAC) + if !bytes.Equal(expectedValueMAC, valueMAC) { + return fmt.Errorf("failed to verify mutation #%d: %w", i+1, ErrMismatchingContentMAC) + } + } + iv, content := content[:16], content[16:] + plaintext, err := cbcutil.Decrypt(keys.ValueEncryption, iv, content) + if err != nil { + return fmt.Errorf("failed to decrypt mutation #%d: %w", i+1, err) + } + var syncAction waProto.SyncActionData + err = proto.Unmarshal(plaintext, &syncAction) + if err != nil { + return fmt.Errorf("failed to unmarshal mutation #%d: %w", i+1, err) + } + indexMAC := mutation.GetRecord().GetIndex().GetBlob() + if validateMACs { + expectedIndexMAC := concatAndHMAC(sha256.New, keys.Index, syncAction.Index) + if !bytes.Equal(expectedIndexMAC, indexMAC) { + return fmt.Errorf("failed to verify mutation #%d: %w", i+1, ErrMismatchingIndexMAC) + } + } + var index []string + err = json.Unmarshal(syncAction.GetIndex(), &index) + if err != nil { + return fmt.Errorf("failed to unmarshal index of mutation #%d: %w", i+1, err) + } + if mutation.GetOperation() == waProto.SyncdMutation_REMOVE { + out.RemovedMACs = append(out.RemovedMACs, indexMAC) + } else if mutation.GetOperation() == waProto.SyncdMutation_SET { + out.AddedMACs = append(out.AddedMACs, store.AppStateMutationMAC{ + IndexMAC: indexMAC, + ValueMAC: valueMAC, + }) + } + out.Mutations = append(out.Mutations, Mutation{ + Operation: mutation.GetOperation(), + Action: syncAction.GetValue(), + Index: index, + IndexMAC: indexMAC, + ValueMAC: valueMAC, + }) + } + return nil +} + +func (proc *Processor) storeMACs(name WAPatchName, currentState HashState, out *patchOutput) { + err := proc.Store.AppState.PutAppStateVersion(string(name), currentState.Version, currentState.Hash) + if err != nil { + proc.Log.Errorf("Failed to update app state version in the database: %v", err) + } + err = proc.Store.AppState.DeleteAppStateMutationMACs(string(name), out.RemovedMACs) + if err != nil { + proc.Log.Errorf("Failed to remove deleted mutation MACs from the database: %v", err) + } + err = proc.Store.AppState.PutAppStateMutationMACs(string(name), currentState.Version, out.AddedMACs) + if err != nil { + proc.Log.Errorf("Failed to insert added mutation MACs to the database: %v", err) + } +} + +func (proc *Processor) validateSnapshotMAC(name WAPatchName, currentState HashState, keyID, expectedSnapshotMAC []byte) (keys ExpandedAppStateKeys, err error) { + keys, err = proc.getAppStateKey(keyID) + if err != nil { + err = fmt.Errorf("failed to get key %X to verify patch v%d MACs: %w", keyID, currentState.Version, err) + return + } + snapshotMAC := currentState.generateSnapshotMAC(name, keys.SnapshotMAC) + if !bytes.Equal(snapshotMAC, expectedSnapshotMAC) { + err = fmt.Errorf("failed to verify patch v%d: %w", currentState.Version, ErrMismatchingLTHash) + } + return +} + +func (proc *Processor) decodeSnapshot(name WAPatchName, ss *waProto.SyncdSnapshot, initialState HashState, validateMACs bool, newMutationsInput []Mutation) (newMutations []Mutation, currentState HashState, err error) { + currentState = initialState + currentState.Version = ss.GetVersion().GetVersion() + + encryptedMutations := make([]*waProto.SyncdMutation, len(ss.GetRecords())) + for i, record := range ss.GetRecords() { + encryptedMutations[i] = &waProto.SyncdMutation{ + Operation: waProto.SyncdMutation_SET.Enum(), + Record: record, + } + } + + var warn []error + warn, err = currentState.updateHash(encryptedMutations, func(indexMAC []byte, maxIndex int) ([]byte, error) { + return nil, nil + }) + if len(warn) > 0 { + proc.Log.Warnf("Warnings while updating hash for %s: %+v", name, warn) + } + if err != nil { + err = fmt.Errorf("failed to update state hash: %w", err) + return + } + + if validateMACs { + _, err = proc.validateSnapshotMAC(name, currentState, ss.GetKeyId().GetId(), ss.GetMac()) + if err != nil { + return + } + } + + var out patchOutput + out.Mutations = newMutationsInput + err = proc.decodeMutations(encryptedMutations, &out, validateMACs) + if err != nil { + err = fmt.Errorf("failed to decode snapshot of v%d: %w", currentState.Version, err) + return + } + proc.storeMACs(name, currentState, &out) + newMutations = out.Mutations + return +} + +// DecodePatches will decode all the patches in a PatchList into a list of app state mutations. +func (proc *Processor) DecodePatches(list *PatchList, initialState HashState, validateMACs bool) (newMutations []Mutation, currentState HashState, err error) { + currentState = initialState + var expectedLength int + if list.Snapshot != nil { + expectedLength = len(list.Snapshot.GetRecords()) + } + for _, patch := range list.Patches { + expectedLength += len(patch.GetMutations()) + } + newMutations = make([]Mutation, 0, expectedLength) + + if list.Snapshot != nil { + newMutations, currentState, err = proc.decodeSnapshot(list.Name, list.Snapshot, currentState, validateMACs, newMutations) + if err != nil { + return + } + } + + for _, patch := range list.Patches { + version := patch.GetVersion().GetVersion() + currentState.Version = version + var warn []error + warn, err = currentState.updateHash(patch.GetMutations(), func(indexMAC []byte, maxIndex int) ([]byte, error) { + for i := maxIndex - 1; i >= 0; i-- { + if bytes.Equal(patch.Mutations[i].GetRecord().GetIndex().GetBlob(), indexMAC) { + value := patch.Mutations[i].GetRecord().GetValue().GetBlob() + return value[len(value)-32:], nil + } + } + // Previous value not found in current patch, look in the database + return proc.Store.AppState.GetAppStateMutationMAC(string(list.Name), indexMAC) + }) + if len(warn) > 0 { + proc.Log.Warnf("Warnings while updating hash for %s: %+v", list.Name, warn) + } + if err != nil { + err = fmt.Errorf("failed to update state hash: %w", err) + return + } + + if validateMACs { + var keys ExpandedAppStateKeys + keys, err = proc.validateSnapshotMAC(list.Name, currentState, patch.GetKeyId().GetId(), patch.GetSnapshotMac()) + if err != nil { + return + } + patchMAC := generatePatchMAC(patch, list.Name, keys.PatchMAC) + if !bytes.Equal(patchMAC, patch.GetPatchMac()) { + err = fmt.Errorf("failed to verify patch v%d: %w", version, ErrMismatchingPatchMAC) + return + } + } + + var out patchOutput + out.Mutations = newMutations + err = proc.decodeMutations(patch.GetMutations(), &out, validateMACs) + if err != nil { + return + } + proc.storeMACs(list.Name, currentState, &out) + newMutations = out.Mutations + } + return +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/appstate/errors.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/appstate/errors.go new file mode 100644 index 0000000..0668d86 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/appstate/errors.go @@ -0,0 +1,19 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package appstate + +import "errors" + +// Errors that this package can return. +var ( + ErrMissingPreviousSetValueOperation = errors.New("missing value MAC of previous SET operation") + ErrMismatchingLTHash = errors.New("mismatching LTHash") + ErrMismatchingPatchMAC = errors.New("mismatching patch MAC") + ErrMismatchingContentMAC = errors.New("mismatching content MAC") + ErrMismatchingIndexMAC = errors.New("mismatching index MAC") + ErrKeyNotFound = errors.New("didn't find app state key") +) diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/appstate/hash.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/appstate/hash.go new file mode 100644 index 0000000..bb17eea --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/appstate/hash.go @@ -0,0 +1,96 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package appstate + +import ( + "crypto/hmac" + "crypto/sha256" + "crypto/sha512" + "encoding/binary" + "fmt" + "hash" + + "go.mau.fi/whatsmeow/appstate/lthash" + waProto "go.mau.fi/whatsmeow/binary/proto" +) + +type Mutation struct { + Operation waProto.SyncdMutation_SyncdOperation + Action *waProto.SyncActionValue + Index []string + IndexMAC []byte + ValueMAC []byte +} + +type HashState struct { + Version uint64 + Hash [128]byte +} + +func (hs *HashState) updateHash(mutations []*waProto.SyncdMutation, getPrevSetValueMAC func(indexMAC []byte, maxIndex int) ([]byte, error)) ([]error, error) { + var added, removed [][]byte + var warnings []error + + for i, mutation := range mutations { + if mutation.GetOperation() == waProto.SyncdMutation_SET { + value := mutation.GetRecord().GetValue().GetBlob() + added = append(added, value[len(value)-32:]) + } + indexMAC := mutation.GetRecord().GetIndex().GetBlob() + removal, err := getPrevSetValueMAC(indexMAC, i) + if err != nil { + return warnings, fmt.Errorf("failed to get value MAC of previous SET operation: %w", err) + } else if removal != nil { + removed = append(removed, removal) + } else if mutation.GetOperation() == waProto.SyncdMutation_REMOVE { + // TODO figure out if there are certain cases that are safe to ignore and others that aren't + // At least removing contact access from WhatsApp seems to create a REMOVE op for your own JID + // that points to a non-existent index and is safe to ignore here. Other keys might not be safe to ignore. + warnings = append(warnings, fmt.Errorf("%w for %X", ErrMissingPreviousSetValueOperation, indexMAC)) + //return ErrMissingPreviousSetValueOperation + } + } + + lthash.WAPatchIntegrity.SubtractThenAddInPlace(hs.Hash[:], removed, added) + return warnings, nil +} + +func uint64ToBytes(val uint64) []byte { + data := make([]byte, 8) + binary.BigEndian.PutUint64(data, val) + return data +} + +func concatAndHMAC(alg func() hash.Hash, key []byte, data ...[]byte) []byte { + h := hmac.New(alg, key) + for _, item := range data { + h.Write(item) + } + return h.Sum(nil) +} + +func (hs *HashState) generateSnapshotMAC(name WAPatchName, key []byte) []byte { + return concatAndHMAC(sha256.New, key, hs.Hash[:], uint64ToBytes(hs.Version), []byte(name)) +} + +func generatePatchMAC(patch *waProto.SyncdPatch, name WAPatchName, key []byte) []byte { + dataToHash := make([][]byte, len(patch.GetMutations())+3) + dataToHash[0] = patch.GetSnapshotMac() + for i, mutation := range patch.Mutations { + val := mutation.GetRecord().GetValue().GetBlob() + dataToHash[i+1] = val[len(val)-32:] + } + dataToHash[len(dataToHash)-2] = uint64ToBytes(patch.GetVersion().GetVersion()) + dataToHash[len(dataToHash)-1] = []byte(name) + return concatAndHMAC(sha256.New, key, dataToHash...) +} + +func generateContentMAC(operation waProto.SyncdMutation_SyncdOperation, data, keyID, key []byte) []byte { + operationBytes := []byte{byte(operation) + 1} + keyDataLength := uint64ToBytes(uint64(len(keyID) + 1)) + return concatAndHMAC(sha512.New, key, operationBytes, keyID, data, keyDataLength)[:32] +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/appstate/keys.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/appstate/keys.go new file mode 100644 index 0000000..ec19dc2 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/appstate/keys.go @@ -0,0 +1,118 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +// Package appstate implements encoding and decoding WhatsApp's app state patches. +package appstate + +import ( + "encoding/base64" + "sync" + + "go.mau.fi/whatsmeow/store" + "go.mau.fi/whatsmeow/util/hkdfutil" + waLog "go.mau.fi/whatsmeow/util/log" +) + +// WAPatchName represents a type of app state patch. +type WAPatchName string + +const ( + // WAPatchCriticalBlock contains the user's settings like push name and locale. + WAPatchCriticalBlock WAPatchName = "critical_block" + // WAPatchCriticalUnblockLow contains the user's contact list. + WAPatchCriticalUnblockLow WAPatchName = "critical_unblock_low" + // WAPatchRegularLow contains some local chat settings like pin, archive status, and the setting of whether to unarchive chats when messages come in. + WAPatchRegularLow WAPatchName = "regular_low" + // WAPatchRegularHigh contains more local chat settings like mute status and starred messages. + WAPatchRegularHigh WAPatchName = "regular_high" + // WAPatchRegular contains protocol info about app state patches like key expiration. + WAPatchRegular WAPatchName = "regular" +) + +// AllPatchNames contains all currently known patch state names. +var AllPatchNames = [...]WAPatchName{WAPatchCriticalBlock, WAPatchCriticalUnblockLow, WAPatchRegularHigh, WAPatchRegular, WAPatchRegularLow} + +type Processor struct { + keyCache map[string]ExpandedAppStateKeys + keyCacheLock sync.Mutex + Store *store.Device + Log waLog.Logger +} + +func NewProcessor(store *store.Device, log waLog.Logger) *Processor { + return &Processor{ + keyCache: make(map[string]ExpandedAppStateKeys), + Store: store, + Log: log, + } +} + +type ExpandedAppStateKeys struct { + Index []byte + ValueEncryption []byte + ValueMAC []byte + SnapshotMAC []byte + PatchMAC []byte +} + +func expandAppStateKeys(keyData []byte) (keys ExpandedAppStateKeys) { + appStateKeyExpanded := hkdfutil.SHA256(keyData, nil, []byte("WhatsApp Mutation Keys"), 160) + return ExpandedAppStateKeys{appStateKeyExpanded[0:32], appStateKeyExpanded[32:64], appStateKeyExpanded[64:96], appStateKeyExpanded[96:128], appStateKeyExpanded[128:160]} +} + +func (proc *Processor) getAppStateKey(keyID []byte) (keys ExpandedAppStateKeys, err error) { + keyCacheID := base64.RawStdEncoding.EncodeToString(keyID) + var ok bool + + proc.keyCacheLock.Lock() + defer proc.keyCacheLock.Unlock() + + keys, ok = proc.keyCache[keyCacheID] + if !ok { + var keyData *store.AppStateSyncKey + keyData, err = proc.Store.AppStateKeys.GetAppStateSyncKey(keyID) + if keyData != nil { + keys = expandAppStateKeys(keyData.Data) + proc.keyCache[keyCacheID] = keys + } else if err == nil { + err = ErrKeyNotFound + } + } + return +} + +func (proc *Processor) GetMissingKeyIDs(pl *PatchList) [][]byte { + cache := make(map[string]bool) + var missingKeys [][]byte + checkMissing := func(keyID []byte) { + if keyID == nil { + return + } + stringKeyID := base64.RawStdEncoding.EncodeToString(keyID) + _, alreadyAdded := cache[stringKeyID] + if !alreadyAdded { + keyData, err := proc.Store.AppStateKeys.GetAppStateSyncKey(keyID) + if err != nil { + proc.Log.Warnf("Error fetching key %X while checking if it's missing: %v", keyID, err) + } + missing := keyData == nil && err == nil + cache[stringKeyID] = missing + if missing { + missingKeys = append(missingKeys, keyID) + } + } + } + if pl.Snapshot != nil { + checkMissing(pl.Snapshot.GetKeyId().GetId()) + for _, record := range pl.Snapshot.GetRecords() { + checkMissing(record.GetKeyId().GetId()) + } + } + for _, patch := range pl.Patches { + checkMissing(patch.GetKeyId().GetId()) + } + return missingKeys +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/appstate/lthash/lthash.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/appstate/lthash/lthash.go new file mode 100644 index 0000000..8d3045d --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/appstate/lthash/lthash.go @@ -0,0 +1,58 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +// Package lthash implements a summation based hash algorithm that maintains the +// integrity of a piece of data over a series of mutations. You can add/remove +// mutations, and it'll return a hash equal to if the same series of mutations +// was made sequentially. +package lthash + +import ( + "encoding/binary" + + "go.mau.fi/whatsmeow/util/hkdfutil" +) + +type LTHash struct { + HKDFInfo []byte + HKDFSize uint8 +} + +// WAPatchIntegrity is a LTHash instance initialized with the details used for verifying integrity of WhatsApp app state sync patches. +var WAPatchIntegrity = LTHash{[]byte("WhatsApp Patch Integrity"), 128} + +func (lth LTHash) SubtractThenAdd(base []byte, subtract, add [][]byte) []byte { + output := make([]byte, len(base)) + copy(output, base) + lth.SubtractThenAddInPlace(output, subtract, add) + return output +} + +func (lth LTHash) SubtractThenAddInPlace(base []byte, subtract, add [][]byte) { + lth.multipleOp(base, subtract, true) + lth.multipleOp(base, add, false) +} + +func (lth LTHash) multipleOp(base []byte, input [][]byte, subtract bool) { + for _, item := range input { + performPointwiseWithOverflow(base, hkdfutil.SHA256(item, nil, lth.HKDFInfo, lth.HKDFSize), subtract) + } +} + +func performPointwiseWithOverflow(base, input []byte, subtract bool) []byte { + for i := 0; i < len(base); i += 2 { + x := binary.LittleEndian.Uint16(base[i : i+2]) + y := binary.LittleEndian.Uint16(input[i : i+2]) + var result uint16 + if subtract { + result = x - y + } else { + result = x + y + } + binary.LittleEndian.PutUint16(base[i:i+2], result) + } + return base +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/attrs.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/attrs.go new file mode 100644 index 0000000..d7d43f0 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/attrs.go @@ -0,0 +1,198 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package binary + +import ( + "fmt" + "strconv" + "time" + + "go.mau.fi/whatsmeow/types" +) + +// AttrUtility is a helper struct for reading multiple XML attributes and checking for errors afterwards. +// +// The functions return values directly and append any decoding errors to the Errors slice. The +// slice can then be checked after all necessary attributes are read, instead of having to check +// each attribute for errors separately. +type AttrUtility struct { + Attrs Attrs + Errors []error +} + +// AttrGetter returns the AttrUtility for this Node. +func (n *Node) AttrGetter() *AttrUtility { + return &AttrUtility{Attrs: n.Attrs, Errors: make([]error, 0)} +} + +func (au *AttrUtility) GetJID(key string, require bool) (jidVal types.JID, ok bool) { + var val interface{} + if val, ok = au.Attrs[key]; !ok { + if require { + au.Errors = append(au.Errors, fmt.Errorf("didn't find required JID attribute '%s'", key)) + } + } else if jidVal, ok = val.(types.JID); !ok { + au.Errors = append(au.Errors, fmt.Errorf("expected attribute '%s' to be JID, but was %T", key, val)) + } + return +} + +// OptionalJID returns the JID under the given key. If there's no valid JID under the given key, this will return nil. +// However, if the attribute is completely missing, this will not store an error. +func (au *AttrUtility) OptionalJID(key string) *types.JID { + jid, ok := au.GetJID(key, false) + if ok { + return &jid + } + return nil +} + +// OptionalJIDOrEmpty returns the JID under the given key. If there's no valid JID under the given key, this will return an empty JID. +// However, if the attribute is completely missing, this will not store an error. +func (au *AttrUtility) OptionalJIDOrEmpty(key string) types.JID { + jid, ok := au.GetJID(key, false) + if ok { + return jid + } + return types.EmptyJID +} + +// JID returns the JID under the given key. +// If there's no valid JID under the given key, an error will be stored and a blank JID struct will be returned. +func (au *AttrUtility) JID(key string) types.JID { + jid, _ := au.GetJID(key, true) + return jid +} + +func (au *AttrUtility) GetString(key string, require bool) (strVal string, ok bool) { + var val interface{} + if val, ok = au.Attrs[key]; !ok { + if require { + au.Errors = append(au.Errors, fmt.Errorf("didn't find required attribute '%s'", key)) + } + } else if strVal, ok = val.(string); !ok { + au.Errors = append(au.Errors, fmt.Errorf("expected attribute '%s' to be string, but was %T", key, val)) + } + return +} + +func (au *AttrUtility) GetInt64(key string, require bool) (int64, bool) { + if strVal, ok := au.GetString(key, require); !ok { + return 0, false + } else if intVal, err := strconv.ParseInt(strVal, 10, 64); err != nil { + au.Errors = append(au.Errors, fmt.Errorf("failed to parse int in attribute '%s': %w", key, err)) + return 0, false + } else { + return intVal, true + } +} + +func (au *AttrUtility) GetUint64(key string, require bool) (uint64, bool) { + if strVal, ok := au.GetString(key, require); !ok { + return 0, false + } else if intVal, err := strconv.ParseUint(strVal, 10, 64); err != nil { + au.Errors = append(au.Errors, fmt.Errorf("failed to parse uint in attribute '%s': %w", key, err)) + return 0, false + } else { + return intVal, true + } +} + +func (au *AttrUtility) GetBool(key string, require bool) (bool, bool) { + if strVal, ok := au.GetString(key, require); !ok { + return false, false + } else if boolVal, err := strconv.ParseBool(strVal); err != nil { + au.Errors = append(au.Errors, fmt.Errorf("failed to parse bool in attribute '%s': %w", key, err)) + return false, false + } else { + return boolVal, true + } +} + +func (au *AttrUtility) GetUnixTime(key string, require bool) (time.Time, bool) { + if intVal, ok := au.GetInt64(key, require); !ok { + return time.Time{}, false + } else if intVal == 0 { + return time.Time{}, true + } else { + return time.Unix(intVal, 0), true + } +} + +// OptionalString returns the string under the given key. +func (au *AttrUtility) OptionalString(key string) string { + strVal, _ := au.GetString(key, false) + return strVal +} + +// String returns the string under the given key. +// If there's no valid string under the given key, an error will be stored and an empty string will be returned. +func (au *AttrUtility) String(key string) string { + strVal, _ := au.GetString(key, true) + return strVal +} + +func (au *AttrUtility) OptionalInt(key string) int { + val, _ := au.GetInt64(key, false) + return int(val) +} + +func (au *AttrUtility) Int(key string) int { + val, _ := au.GetInt64(key, true) + return int(val) +} + +func (au *AttrUtility) Int64(key string) int64 { + val, _ := au.GetInt64(key, true) + return val +} + +func (au *AttrUtility) Uint64(key string) uint64 { + val, _ := au.GetUint64(key, true) + return val +} + +func (au *AttrUtility) OptionalBool(key string) bool { + val, _ := au.GetBool(key, false) + return val +} + +func (au *AttrUtility) Bool(key string) bool { + val, _ := au.GetBool(key, true) + return val +} + +func (au *AttrUtility) OptionalUnixTime(key string) time.Time { + val, _ := au.GetUnixTime(key, false) + return val +} + +func (au *AttrUtility) UnixTime(key string) time.Time { + val, _ := au.GetUnixTime(key, true) + return val +} + +// OK returns true if there are no errors. +func (au *AttrUtility) OK() bool { + return len(au.Errors) == 0 +} + +// Error returns the list of errors as a single error interface, or nil if there are no errors. +func (au *AttrUtility) Error() error { + if au.OK() { + return nil + } + return ErrorList(au.Errors) +} + +// ErrorList is a list of errors that implements the error interface itself. +type ErrorList []error + +// Error returns all the errors in the list as a string. +func (el ErrorList) Error() string { + return fmt.Sprintf("%+v", []error(el)) +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/decoder.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/decoder.go new file mode 100644 index 0000000..f13f9b4 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/decoder.go @@ -0,0 +1,353 @@ +package binary + +import ( + "fmt" + "io" + "strings" + + "go.mau.fi/whatsmeow/binary/token" + "go.mau.fi/whatsmeow/types" +) + +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) readPacked8(tag int) (string, error) { + startByte, err := r.readByte() + if err != nil { + return "", err + } + + var build strings.Builder + + 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 + } + + build.WriteByte(lower) + build.WriteByte(upper) + } + + ret := build.String() + if startByte>>7 != 0 { + ret = ret[:len(ret)-1] + } + return ret, nil +} + +func unpackByte(tag int, value byte) (byte, error) { + switch tag { + case token.Nibble8: + return unpackNibble(value) + case token.Hex8: + return unpackHex(value) + default: + return 0, fmt.Errorf("unpackByte with unknown tag %d", tag) + } +} + +func unpackNibble(value byte) (byte, error) { + switch { + case value < 10: + return '0' + value, nil + case value == 10: + return '-', nil + case value == 11: + return '.', nil + case value == 15: + return 0, nil + default: + return 0, fmt.Errorf("unpackNibble with value %d", value) + } +} + +func unpackHex(value byte) (byte, error) { + switch { + case value < 10: + return '0' + value, nil + case value < 16: + return 'A' + value - 10, nil + default: + return 0, fmt.Errorf("unpackHex with value %d", value) + } +} + +func (r *binaryDecoder) readListSize(tag int) (int, error) { + switch tag { + case token.ListEmpty: + return 0, nil + case token.List8: + return r.readInt8(false) + case token.List16: + return r.readInt16(false) + default: + return 0, fmt.Errorf("readListSize with unknown tag %d at position %d", tag, r.index) + } +} + +func (r *binaryDecoder) read(string bool) (interface{}, error) { + tagByte, err := r.readByte() + if err != nil { + return nil, err + } + tag := int(tagByte) + switch tag { + case token.ListEmpty: + return nil, nil + case token.List8, token.List16: + return r.readList(tag) + case token.Binary8: + size, err := r.readInt8(false) + if err != nil { + return nil, err + } + + return r.readBytesOrString(size, string) + case token.Binary20: + size, err := r.readInt20() + if err != nil { + return nil, err + } + + return r.readBytesOrString(size, string) + case token.Binary32: + size, err := r.readInt32(false) + if err != nil { + return nil, err + } + + return r.readBytesOrString(size, string) + case token.Dictionary0, token.Dictionary1, token.Dictionary2, token.Dictionary3: + i, err := r.readInt8(false) + if err != nil { + return "", err + } + + return token.GetDoubleToken(tag-token.Dictionary0, i) + case token.JIDPair: + return r.readJIDPair() + case token.ADJID: + return r.readADJID() + case token.Nibble8, token.Hex8: + return r.readPacked8(tag) + default: + if tag >= 1 && tag < len(token.SingleByteTokens) { + return token.SingleByteTokens[tag], nil + } + return "", fmt.Errorf("%w %d at position %d", ErrInvalidToken, tag, r.index) + } +} + +func (r *binaryDecoder) readJIDPair() (interface{}, error) { + user, err := r.read(true) + if err != nil { + return nil, err + } + server, err := r.read(true) + if err != nil { + return nil, err + } else if server == nil { + return nil, ErrInvalidJIDType + } else if user == nil { + return types.NewJID("", server.(string)), nil + } + return types.NewJID(user.(string), server.(string)), nil +} + +func (r *binaryDecoder) readADJID() (interface{}, error) { + agent, err := r.readByte() + if err != nil { + return nil, err + } + device, err := r.readByte() + if err != nil { + return nil, err + } + user, err := r.read(true) + if err != nil { + return nil, err + } + return types.NewADJID(user.(string), agent, device), nil +} + +func (r *binaryDecoder) readAttributes(n int) (Attrs, error) { + if n == 0 { + return nil, nil + } + + ret := make(Attrs) + for i := 0; i < n; i++ { + keyIfc, err := r.read(true) + if err != nil { + return nil, err + } + + key, ok := keyIfc.(string) + if !ok { + return nil, fmt.Errorf("%[1]w at position %[3]d (%[2]T): %+[2]v", ErrNonStringKey, key, r.index) + } + + ret[key], err = r.read(true) + 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 + } + + rawDesc, err := r.read(true) + if err != nil { + return nil, err + } + ret.Tag = rawDesc.(string) + if listSize == 0 || ret.Tag == "" { + return nil, ErrInvalidNode + } + + ret.Attrs, err = r.readAttributes((listSize - 1) >> 1) + if err != nil { + return nil, err + } + + if listSize%2 == 1 { + return ret, nil + } + + ret.Content, err = r.read(false) + return ret, err +} + +func (r *binaryDecoder) readBytesOrString(length int, asString bool) (interface{}, error) { + data, err := r.readRaw(length) + if err != nil { + return nil, err + } + if asString { + return string(data), nil + } + return data, nil +} + +func (r *binaryDecoder) readRaw(length int) ([]byte, error) { + if err := r.checkEOS(length); err != nil { + return nil, err + } + + ret := r.data[r.index : r.index+length] + r.index += length + + return ret, nil +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/encoder.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/encoder.go new file mode 100644 index 0000000..7def56b --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/encoder.go @@ -0,0 +1,293 @@ +package binary + +import ( + "fmt" + "math" + "strconv" + + "go.mau.fi/whatsmeow/binary/token" + "go.mau.fi/whatsmeow/types" +) + +type binaryEncoder struct { + data []byte +} + +func newEncoder() *binaryEncoder { + return &binaryEncoder{[]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) pushString(value string) { + w.pushBytes([]byte(value)) +} + +func (w *binaryEncoder) writeByteLength(length int) { + if length < 256 { + w.pushByte(token.Binary8) + w.pushInt8(length) + } else if length < (1 << 20) { + w.pushByte(token.Binary20) + w.pushInt20(length) + } else if length < math.MaxInt32 { + w.pushByte(token.Binary32) + w.pushInt32(length) + } else { + panic(fmt.Errorf("length is too large: %d", length)) + } +} + +const tagSize = 1 + +func (w *binaryEncoder) writeNode(n Node) { + if n.Tag == "0" { + w.pushByte(token.List8) + w.pushByte(token.ListEmpty) + return + } + + hasContent := 0 + if n.Content != nil { + hasContent = 1 + } + + w.writeListStart(2*len(n.Attrs) + tagSize + hasContent) + w.writeString(n.Tag) + w.writeAttributes(n.Attrs) + if n.Content != nil { + w.write(n.Content) + } +} + +func (w *binaryEncoder) write(data interface{}) { + switch typedData := data.(type) { + case nil: + w.pushByte(token.ListEmpty) + case types.JID: + w.writeJID(typedData) + case string: + w.writeString(typedData) + case int: + w.writeString(strconv.Itoa(typedData)) + case int32: + w.writeString(strconv.FormatInt(int64(typedData), 10)) + case uint: + w.writeString(strconv.FormatUint(uint64(typedData), 10)) + case uint32: + w.writeString(strconv.FormatUint(uint64(typedData), 10)) + case int64: + w.writeString(strconv.FormatInt(typedData, 10)) + case uint64: + w.writeString(strconv.FormatUint(typedData, 10)) + case bool: + w.writeString(strconv.FormatBool(typedData)) + case []byte: + w.writeBytes(typedData) + case []Node: + w.writeListStart(len(typedData)) + for _, n := range typedData { + w.writeNode(n) + } + default: + panic(fmt.Errorf("%w: %T", ErrInvalidType, typedData)) + } +} + +func (w *binaryEncoder) writeString(data string) { + var dictIndex byte + if tokenIndex, ok := token.IndexOfSingleToken(data); ok { + w.pushByte(tokenIndex) + } else if dictIndex, tokenIndex, ok = token.IndexOfDoubleByteToken(data); ok { + w.pushByte(token.Dictionary0 + dictIndex) + w.pushByte(tokenIndex) + } else if validateNibble(data) { + w.writePackedBytes(data, token.Nibble8) + } else if validateHex(data) { + w.writePackedBytes(data, token.Hex8) + } else { + w.writeStringRaw(data) + } +} + +func (w *binaryEncoder) writeBytes(value []byte) { + w.writeByteLength(len(value)) + w.pushBytes(value) +} + +func (w *binaryEncoder) writeStringRaw(value string) { + w.writeByteLength(len(value)) + w.pushString(value) +} + +func (w *binaryEncoder) writeJID(jid types.JID) { + if jid.AD { + w.pushByte(token.ADJID) + w.pushByte(jid.Agent) + w.pushByte(jid.Device) + w.writeString(jid.User) + } else { + w.pushByte(token.JIDPair) + if len(jid.User) == 0 { + w.pushByte(token.ListEmpty) + } else { + w.write(jid.User) + } + w.write(jid.Server) + } +} + +func (w *binaryEncoder) writeAttributes(attributes Attrs) { + if attributes == nil { + return + } + + for key, val := range attributes { + if val == "" || val == nil { + continue + } + + w.writeString(key) + w.write(val) + } +} + +func (w *binaryEncoder) writeListStart(listSize int) { + if listSize == 0 { + w.pushByte(byte(token.ListEmpty)) + } else if listSize < 256 { + w.pushByte(byte(token.List8)) + w.pushInt8(listSize) + } else { + w.pushByte(byte(token.List16)) + w.pushInt16(listSize) + } +} + +func (w *binaryEncoder) writePackedBytes(value string, dataType int) { + if len(value) > token.PackedMax { + panic(fmt.Errorf("too many bytes to pack: %d", len(value))) + } + + w.pushByte(byte(dataType)) + + roundedLength := byte(math.Ceil(float64(len(value)) / 2.0)) + if len(value)%2 != 0 { + roundedLength |= 128 + } + w.pushByte(roundedLength) + var packer func(byte) byte + if dataType == token.Nibble8 { + packer = packNibble + } else if dataType == token.Hex8 { + packer = packHex + } else { + // This should only be called with the correct values + panic(fmt.Errorf("invalid packed byte data type %v", dataType)) + } + for i, l := 0, len(value)/2; i < l; i++ { + w.pushByte(w.packBytePair(packer, value[2*i], value[2*i+1])) + } + if len(value)%2 != 0 { + w.pushByte(w.packBytePair(packer, value[len(value)-1], '\x00')) + } +} + +func (w *binaryEncoder) packBytePair(packer func(byte) byte, part1, part2 byte) byte { + return (packer(part1) << 4) | packer(part2) +} + +func validateNibble(value string) bool { + if len(value) > token.PackedMax { + return false + } + for _, char := range value { + if !(char >= '0' && char <= '9') && char != '-' && char != '.' { + return false + } + } + return true +} + +func packNibble(value byte) byte { + switch value { + case '-': + return 10 + case '.': + return 11 + case 0: + return 15 + default: + if value >= '0' && value <= '9' { + return value - '0' + } + // This should be validated beforehand + panic(fmt.Errorf("invalid string to pack as nibble: %d / '%s'", value, string(value))) + } +} + +func validateHex(value string) bool { + if len(value) > token.PackedMax { + return false + } + for _, char := range value { + if !(char >= '0' && char <= '9') && !(char >= 'A' && char <= 'F') && !(char >= 'a' && char <= 'f') { + return false + } + } + return true +} + +func packHex(value byte) byte { + switch { + case value >= '0' && value <= '9': + return value - '0' + case value >= 'A' && value <= 'F': + return 10 + value - 'A' + case value >= 'a' && value <= 'f': + return 10 + value - 'a' + case value == 0: + return 15 + default: + // This should be validated beforehand + panic(fmt.Errorf("invalid string to pack as hex: %d / '%s'", value, string(value))) + } +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/errors.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/errors.go new file mode 100644 index 0000000..2be2d72 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/errors.go @@ -0,0 +1,12 @@ +package binary + +import "errors" + +// Errors returned by the binary XML decoder. +var ( + ErrInvalidType = errors.New("unsupported payload type") + ErrInvalidJIDType = errors.New("invalid JID type") + ErrInvalidNode = errors.New("invalid node") + ErrInvalidToken = errors.New("invalid token with tag") + ErrNonStringKey = errors.New("non-string key") +) diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/node.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/node.go new file mode 100644 index 0000000..f227320 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/node.go @@ -0,0 +1,89 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +// Package binary implements encoding and decoding documents in WhatsApp's binary XML format. +package binary + +import ( + "fmt" +) + +// Attrs is a type alias for the attributes of an XML element (Node). +type Attrs = map[string]interface{} + +// Node represents an XML element. +type Node struct { + Tag string // The tag of the element. + Attrs Attrs // The attributes of the element. + Content interface{} // The content inside the element. Can be nil, a list of Nodes, or a byte array. +} + +// GetChildren returns the Content of the node as a list of nodes. If the content is not a list of nodes, this returns nil. +func (n *Node) GetChildren() []Node { + if n.Content == nil { + return nil + } + children, ok := n.Content.([]Node) + if !ok { + return nil + } + return children +} + +// GetChildrenByTag returns the same list as GetChildren, but filters it by tag first. +func (n *Node) GetChildrenByTag(tag string) (children []Node) { + for _, node := range n.GetChildren() { + if node.Tag == tag { + children = append(children, node) + } + } + return +} + +// GetOptionalChildByTag finds the first child with the given tag and returns it. +// Each provided tag will recurse in, so this is useful for getting a specific nested element. +func (n *Node) GetOptionalChildByTag(tags ...string) (val Node, ok bool) { + val = *n +Outer: + for _, tag := range tags { + for _, child := range val.GetChildren() { + if child.Tag == tag { + val = child + continue Outer + } + } + // If no matching children are found, return false + return + } + // All iterations of loop found a matching child, return it + ok = true + return +} + +// GetChildByTag does the same thing as GetOptionalChildByTag, but returns the Node directly without the ok boolean. +func (n *Node) GetChildByTag(tags ...string) Node { + node, _ := n.GetOptionalChildByTag(tags...) + return node +} + +// Marshal encodes an XML element (Node) into WhatsApp's binary XML representation. +func Marshal(n Node) ([]byte, error) { + w := newEncoder() + w.writeNode(n) + return w.getData(), nil +} + +// Unmarshal decodes WhatsApp's binary XML representation into a Node. +func Unmarshal(data []byte) (*Node, error) { + r := newDecoder(data) + n, err := r.readNode() + if err != nil { + return nil, err + } else if r.index != len(r.data) { + return n, fmt.Errorf("%d leftover bytes after decoding", len(r.data)-r.index) + } + return n, nil +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/proto/def.pb.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/proto/def.pb.go new file mode 100644 index 0000000..046bebe --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/proto/def.pb.go @@ -0,0 +1,25606 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.12 +// source: binary/proto/def.proto + +package proto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +import _ "embed" + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type PeerDataOperationRequestType int32 + +const ( + PeerDataOperationRequestType_UPLOAD_STICKER PeerDataOperationRequestType = 0 + PeerDataOperationRequestType_SEND_RECENT_STICKER_BOOTSTRAP PeerDataOperationRequestType = 1 + PeerDataOperationRequestType_GENERATE_LINK_PREVIEW PeerDataOperationRequestType = 2 +) + +// Enum value maps for PeerDataOperationRequestType. +var ( + PeerDataOperationRequestType_name = map[int32]string{ + 0: "UPLOAD_STICKER", + 1: "SEND_RECENT_STICKER_BOOTSTRAP", + 2: "GENERATE_LINK_PREVIEW", + } + PeerDataOperationRequestType_value = map[string]int32{ + "UPLOAD_STICKER": 0, + "SEND_RECENT_STICKER_BOOTSTRAP": 1, + "GENERATE_LINK_PREVIEW": 2, + } +) + +func (x PeerDataOperationRequestType) Enum() *PeerDataOperationRequestType { + p := new(PeerDataOperationRequestType) + *p = x + return p +} + +func (x PeerDataOperationRequestType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (PeerDataOperationRequestType) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[0].Descriptor() +} + +func (PeerDataOperationRequestType) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[0] +} + +func (x PeerDataOperationRequestType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *PeerDataOperationRequestType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = PeerDataOperationRequestType(num) + return nil +} + +// Deprecated: Use PeerDataOperationRequestType.Descriptor instead. +func (PeerDataOperationRequestType) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{0} +} + +type KeepType int32 + +const ( + KeepType_UNKNOWN KeepType = 0 + KeepType_KEEP_FOR_ALL KeepType = 1 + KeepType_UNDO_KEEP_FOR_ALL KeepType = 2 +) + +// Enum value maps for KeepType. +var ( + KeepType_name = map[int32]string{ + 0: "UNKNOWN", + 1: "KEEP_FOR_ALL", + 2: "UNDO_KEEP_FOR_ALL", + } + KeepType_value = map[string]int32{ + "UNKNOWN": 0, + "KEEP_FOR_ALL": 1, + "UNDO_KEEP_FOR_ALL": 2, + } +) + +func (x KeepType) Enum() *KeepType { + p := new(KeepType) + *p = x + return p +} + +func (x KeepType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (KeepType) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[1].Descriptor() +} + +func (KeepType) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[1] +} + +func (x KeepType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *KeepType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = KeepType(num) + return nil +} + +// Deprecated: Use KeepType.Descriptor instead. +func (KeepType) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{1} +} + +type MediaVisibility int32 + +const ( + MediaVisibility_DEFAULT MediaVisibility = 0 + MediaVisibility_OFF MediaVisibility = 1 + MediaVisibility_ON MediaVisibility = 2 +) + +// Enum value maps for MediaVisibility. +var ( + MediaVisibility_name = map[int32]string{ + 0: "DEFAULT", + 1: "OFF", + 2: "ON", + } + MediaVisibility_value = map[string]int32{ + "DEFAULT": 0, + "OFF": 1, + "ON": 2, + } +) + +func (x MediaVisibility) Enum() *MediaVisibility { + p := new(MediaVisibility) + *p = x + return p +} + +func (x MediaVisibility) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (MediaVisibility) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[2].Descriptor() +} + +func (MediaVisibility) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[2] +} + +func (x MediaVisibility) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *MediaVisibility) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = MediaVisibility(num) + return nil +} + +// Deprecated: Use MediaVisibility.Descriptor instead. +func (MediaVisibility) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{2} +} + +type DeviceProps_PlatformType int32 + +const ( + DeviceProps_UNKNOWN DeviceProps_PlatformType = 0 + DeviceProps_CHROME DeviceProps_PlatformType = 1 + DeviceProps_FIREFOX DeviceProps_PlatformType = 2 + DeviceProps_IE DeviceProps_PlatformType = 3 + DeviceProps_OPERA DeviceProps_PlatformType = 4 + DeviceProps_SAFARI DeviceProps_PlatformType = 5 + DeviceProps_EDGE DeviceProps_PlatformType = 6 + DeviceProps_DESKTOP DeviceProps_PlatformType = 7 + DeviceProps_IPAD DeviceProps_PlatformType = 8 + DeviceProps_ANDROID_TABLET DeviceProps_PlatformType = 9 + DeviceProps_OHANA DeviceProps_PlatformType = 10 + DeviceProps_ALOHA DeviceProps_PlatformType = 11 + DeviceProps_CATALINA DeviceProps_PlatformType = 12 + DeviceProps_TCL_TV DeviceProps_PlatformType = 13 +) + +// Enum value maps for DeviceProps_PlatformType. +var ( + DeviceProps_PlatformType_name = map[int32]string{ + 0: "UNKNOWN", + 1: "CHROME", + 2: "FIREFOX", + 3: "IE", + 4: "OPERA", + 5: "SAFARI", + 6: "EDGE", + 7: "DESKTOP", + 8: "IPAD", + 9: "ANDROID_TABLET", + 10: "OHANA", + 11: "ALOHA", + 12: "CATALINA", + 13: "TCL_TV", + } + DeviceProps_PlatformType_value = map[string]int32{ + "UNKNOWN": 0, + "CHROME": 1, + "FIREFOX": 2, + "IE": 3, + "OPERA": 4, + "SAFARI": 5, + "EDGE": 6, + "DESKTOP": 7, + "IPAD": 8, + "ANDROID_TABLET": 9, + "OHANA": 10, + "ALOHA": 11, + "CATALINA": 12, + "TCL_TV": 13, + } +) + +func (x DeviceProps_PlatformType) Enum() *DeviceProps_PlatformType { + p := new(DeviceProps_PlatformType) + *p = x + return p +} + +func (x DeviceProps_PlatformType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (DeviceProps_PlatformType) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[3].Descriptor() +} + +func (DeviceProps_PlatformType) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[3] +} + +func (x DeviceProps_PlatformType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *DeviceProps_PlatformType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = DeviceProps_PlatformType(num) + return nil +} + +// Deprecated: Use DeviceProps_PlatformType.Descriptor instead. +func (DeviceProps_PlatformType) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{5, 0} +} + +type PaymentInviteMessage_ServiceType int32 + +const ( + PaymentInviteMessage_UNKNOWN PaymentInviteMessage_ServiceType = 0 + PaymentInviteMessage_FBPAY PaymentInviteMessage_ServiceType = 1 + PaymentInviteMessage_NOVI PaymentInviteMessage_ServiceType = 2 + PaymentInviteMessage_UPI PaymentInviteMessage_ServiceType = 3 +) + +// Enum value maps for PaymentInviteMessage_ServiceType. +var ( + PaymentInviteMessage_ServiceType_name = map[int32]string{ + 0: "UNKNOWN", + 1: "FBPAY", + 2: "NOVI", + 3: "UPI", + } + PaymentInviteMessage_ServiceType_value = map[string]int32{ + "UNKNOWN": 0, + "FBPAY": 1, + "NOVI": 2, + "UPI": 3, + } +) + +func (x PaymentInviteMessage_ServiceType) Enum() *PaymentInviteMessage_ServiceType { + p := new(PaymentInviteMessage_ServiceType) + *p = x + return p +} + +func (x PaymentInviteMessage_ServiceType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (PaymentInviteMessage_ServiceType) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[4].Descriptor() +} + +func (PaymentInviteMessage_ServiceType) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[4] +} + +func (x PaymentInviteMessage_ServiceType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *PaymentInviteMessage_ServiceType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = PaymentInviteMessage_ServiceType(num) + return nil +} + +// Deprecated: Use PaymentInviteMessage_ServiceType.Descriptor instead. +func (PaymentInviteMessage_ServiceType) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{8, 0} +} + +type OrderMessage_OrderSurface int32 + +const ( + OrderMessage_CATALOG OrderMessage_OrderSurface = 1 +) + +// Enum value maps for OrderMessage_OrderSurface. +var ( + OrderMessage_OrderSurface_name = map[int32]string{ + 1: "CATALOG", + } + OrderMessage_OrderSurface_value = map[string]int32{ + "CATALOG": 1, + } +) + +func (x OrderMessage_OrderSurface) Enum() *OrderMessage_OrderSurface { + p := new(OrderMessage_OrderSurface) + *p = x + return p +} + +func (x OrderMessage_OrderSurface) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (OrderMessage_OrderSurface) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[5].Descriptor() +} + +func (OrderMessage_OrderSurface) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[5] +} + +func (x OrderMessage_OrderSurface) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *OrderMessage_OrderSurface) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = OrderMessage_OrderSurface(num) + return nil +} + +// Deprecated: Use OrderMessage_OrderSurface.Descriptor instead. +func (OrderMessage_OrderSurface) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{9, 0} +} + +type OrderMessage_OrderStatus int32 + +const ( + OrderMessage_INQUIRY OrderMessage_OrderStatus = 1 +) + +// Enum value maps for OrderMessage_OrderStatus. +var ( + OrderMessage_OrderStatus_name = map[int32]string{ + 1: "INQUIRY", + } + OrderMessage_OrderStatus_value = map[string]int32{ + "INQUIRY": 1, + } +) + +func (x OrderMessage_OrderStatus) Enum() *OrderMessage_OrderStatus { + p := new(OrderMessage_OrderStatus) + *p = x + return p +} + +func (x OrderMessage_OrderStatus) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (OrderMessage_OrderStatus) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[6].Descriptor() +} + +func (OrderMessage_OrderStatus) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[6] +} + +func (x OrderMessage_OrderStatus) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *OrderMessage_OrderStatus) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = OrderMessage_OrderStatus(num) + return nil +} + +// Deprecated: Use OrderMessage_OrderStatus.Descriptor instead. +func (OrderMessage_OrderStatus) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{9, 1} +} + +type ListResponseMessage_ListType int32 + +const ( + ListResponseMessage_UNKNOWN ListResponseMessage_ListType = 0 + ListResponseMessage_SINGLE_SELECT ListResponseMessage_ListType = 1 +) + +// Enum value maps for ListResponseMessage_ListType. +var ( + ListResponseMessage_ListType_name = map[int32]string{ + 0: "UNKNOWN", + 1: "SINGLE_SELECT", + } + ListResponseMessage_ListType_value = map[string]int32{ + "UNKNOWN": 0, + "SINGLE_SELECT": 1, + } +) + +func (x ListResponseMessage_ListType) Enum() *ListResponseMessage_ListType { + p := new(ListResponseMessage_ListType) + *p = x + return p +} + +func (x ListResponseMessage_ListType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ListResponseMessage_ListType) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[7].Descriptor() +} + +func (ListResponseMessage_ListType) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[7] +} + +func (x ListResponseMessage_ListType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *ListResponseMessage_ListType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = ListResponseMessage_ListType(num) + return nil +} + +// Deprecated: Use ListResponseMessage_ListType.Descriptor instead. +func (ListResponseMessage_ListType) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{12, 0} +} + +type ListMessage_ListType int32 + +const ( + ListMessage_UNKNOWN ListMessage_ListType = 0 + ListMessage_SINGLE_SELECT ListMessage_ListType = 1 + ListMessage_PRODUCT_LIST ListMessage_ListType = 2 +) + +// Enum value maps for ListMessage_ListType. +var ( + ListMessage_ListType_name = map[int32]string{ + 0: "UNKNOWN", + 1: "SINGLE_SELECT", + 2: "PRODUCT_LIST", + } + ListMessage_ListType_value = map[string]int32{ + "UNKNOWN": 0, + "SINGLE_SELECT": 1, + "PRODUCT_LIST": 2, + } +) + +func (x ListMessage_ListType) Enum() *ListMessage_ListType { + p := new(ListMessage_ListType) + *p = x + return p +} + +func (x ListMessage_ListType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ListMessage_ListType) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[8].Descriptor() +} + +func (ListMessage_ListType) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[8] +} + +func (x ListMessage_ListType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *ListMessage_ListType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = ListMessage_ListType(num) + return nil +} + +// Deprecated: Use ListMessage_ListType.Descriptor instead. +func (ListMessage_ListType) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{13, 0} +} + +type InvoiceMessage_AttachmentType int32 + +const ( + InvoiceMessage_IMAGE InvoiceMessage_AttachmentType = 0 + InvoiceMessage_PDF InvoiceMessage_AttachmentType = 1 +) + +// Enum value maps for InvoiceMessage_AttachmentType. +var ( + InvoiceMessage_AttachmentType_name = map[int32]string{ + 0: "IMAGE", + 1: "PDF", + } + InvoiceMessage_AttachmentType_value = map[string]int32{ + "IMAGE": 0, + "PDF": 1, + } +) + +func (x InvoiceMessage_AttachmentType) Enum() *InvoiceMessage_AttachmentType { + p := new(InvoiceMessage_AttachmentType) + *p = x + return p +} + +func (x InvoiceMessage_AttachmentType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (InvoiceMessage_AttachmentType) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[9].Descriptor() +} + +func (InvoiceMessage_AttachmentType) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[9] +} + +func (x InvoiceMessage_AttachmentType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *InvoiceMessage_AttachmentType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = InvoiceMessage_AttachmentType(num) + return nil +} + +// Deprecated: Use InvoiceMessage_AttachmentType.Descriptor instead. +func (InvoiceMessage_AttachmentType) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{15, 0} +} + +type InteractiveMessage_ShopMessage_Surface int32 + +const ( + InteractiveMessage_ShopMessage_UNKNOWN_SURFACE InteractiveMessage_ShopMessage_Surface = 0 + InteractiveMessage_ShopMessage_FB InteractiveMessage_ShopMessage_Surface = 1 + InteractiveMessage_ShopMessage_IG InteractiveMessage_ShopMessage_Surface = 2 + InteractiveMessage_ShopMessage_WA InteractiveMessage_ShopMessage_Surface = 3 +) + +// Enum value maps for InteractiveMessage_ShopMessage_Surface. +var ( + InteractiveMessage_ShopMessage_Surface_name = map[int32]string{ + 0: "UNKNOWN_SURFACE", + 1: "FB", + 2: "IG", + 3: "WA", + } + InteractiveMessage_ShopMessage_Surface_value = map[string]int32{ + "UNKNOWN_SURFACE": 0, + "FB": 1, + "IG": 2, + "WA": 3, + } +) + +func (x InteractiveMessage_ShopMessage_Surface) Enum() *InteractiveMessage_ShopMessage_Surface { + p := new(InteractiveMessage_ShopMessage_Surface) + *p = x + return p +} + +func (x InteractiveMessage_ShopMessage_Surface) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (InteractiveMessage_ShopMessage_Surface) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[10].Descriptor() +} + +func (InteractiveMessage_ShopMessage_Surface) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[10] +} + +func (x InteractiveMessage_ShopMessage_Surface) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *InteractiveMessage_ShopMessage_Surface) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = InteractiveMessage_ShopMessage_Surface(num) + return nil +} + +// Deprecated: Use InteractiveMessage_ShopMessage_Surface.Descriptor instead. +func (InteractiveMessage_ShopMessage_Surface) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{17, 0, 0} +} + +type HistorySyncNotification_HistorySyncType int32 + +const ( + HistorySyncNotification_INITIAL_BOOTSTRAP HistorySyncNotification_HistorySyncType = 0 + HistorySyncNotification_INITIAL_STATUS_V3 HistorySyncNotification_HistorySyncType = 1 + HistorySyncNotification_FULL HistorySyncNotification_HistorySyncType = 2 + HistorySyncNotification_RECENT HistorySyncNotification_HistorySyncType = 3 + HistorySyncNotification_PUSH_NAME HistorySyncNotification_HistorySyncType = 4 + HistorySyncNotification_NON_BLOCKING_DATA HistorySyncNotification_HistorySyncType = 5 +) + +// Enum value maps for HistorySyncNotification_HistorySyncType. +var ( + HistorySyncNotification_HistorySyncType_name = map[int32]string{ + 0: "INITIAL_BOOTSTRAP", + 1: "INITIAL_STATUS_V3", + 2: "FULL", + 3: "RECENT", + 4: "PUSH_NAME", + 5: "NON_BLOCKING_DATA", + } + HistorySyncNotification_HistorySyncType_value = map[string]int32{ + "INITIAL_BOOTSTRAP": 0, + "INITIAL_STATUS_V3": 1, + "FULL": 2, + "RECENT": 3, + "PUSH_NAME": 4, + "NON_BLOCKING_DATA": 5, + } +) + +func (x HistorySyncNotification_HistorySyncType) Enum() *HistorySyncNotification_HistorySyncType { + p := new(HistorySyncNotification_HistorySyncType) + *p = x + return p +} + +func (x HistorySyncNotification_HistorySyncType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (HistorySyncNotification_HistorySyncType) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[11].Descriptor() +} + +func (HistorySyncNotification_HistorySyncType) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[11] +} + +func (x HistorySyncNotification_HistorySyncType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *HistorySyncNotification_HistorySyncType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = HistorySyncNotification_HistorySyncType(num) + return nil +} + +// Deprecated: Use HistorySyncNotification_HistorySyncType.Descriptor instead. +func (HistorySyncNotification_HistorySyncType) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{20, 0} +} + +type HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType int32 + +const ( + HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_MONDAY HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType = 1 + HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_TUESDAY HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType = 2 + HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_WEDNESDAY HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType = 3 + HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_THURSDAY HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType = 4 + HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_FRIDAY HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType = 5 + HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_SATURDAY HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType = 6 + HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_SUNDAY HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType = 7 +) + +// Enum value maps for HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType. +var ( + HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType_name = map[int32]string{ + 1: "MONDAY", + 2: "TUESDAY", + 3: "WEDNESDAY", + 4: "THURSDAY", + 5: "FRIDAY", + 6: "SATURDAY", + 7: "SUNDAY", + } + HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType_value = map[string]int32{ + "MONDAY": 1, + "TUESDAY": 2, + "WEDNESDAY": 3, + "THURSDAY": 4, + "FRIDAY": 5, + "SATURDAY": 6, + "SUNDAY": 7, + } +) + +func (x HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType) Enum() *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType { + p := new(HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType) + *p = x + return p +} + +func (x HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[12].Descriptor() +} + +func (HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[12] +} + +func (x HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType(num) + return nil +} + +// Deprecated: Use HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType.Descriptor instead. +func (HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{21, 0, 0, 1, 0} +} + +type HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType int32 + +const ( + HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_GREGORIAN HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType = 1 + HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_SOLAR_HIJRI HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType = 2 +) + +// Enum value maps for HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType. +var ( + HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType_name = map[int32]string{ + 1: "GREGORIAN", + 2: "SOLAR_HIJRI", + } + HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType_value = map[string]int32{ + "GREGORIAN": 1, + "SOLAR_HIJRI": 2, + } +) + +func (x HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType) Enum() *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType { + p := new(HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType) + *p = x + return p +} + +func (x HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[13].Descriptor() +} + +func (HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[13] +} + +func (x HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType(num) + return nil +} + +// Deprecated: Use HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType.Descriptor instead. +func (HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{21, 0, 0, 1, 1} +} + +type GroupInviteMessage_GroupType int32 + +const ( + GroupInviteMessage_DEFAULT GroupInviteMessage_GroupType = 0 + GroupInviteMessage_PARENT GroupInviteMessage_GroupType = 1 +) + +// Enum value maps for GroupInviteMessage_GroupType. +var ( + GroupInviteMessage_GroupType_name = map[int32]string{ + 0: "DEFAULT", + 1: "PARENT", + } + GroupInviteMessage_GroupType_value = map[string]int32{ + "DEFAULT": 0, + "PARENT": 1, + } +) + +func (x GroupInviteMessage_GroupType) Enum() *GroupInviteMessage_GroupType { + p := new(GroupInviteMessage_GroupType) + *p = x + return p +} + +func (x GroupInviteMessage_GroupType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (GroupInviteMessage_GroupType) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[14].Descriptor() +} + +func (GroupInviteMessage_GroupType) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[14] +} + +func (x GroupInviteMessage_GroupType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *GroupInviteMessage_GroupType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = GroupInviteMessage_GroupType(num) + return nil +} + +// Deprecated: Use GroupInviteMessage_GroupType.Descriptor instead. +func (GroupInviteMessage_GroupType) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{22, 0} +} + +type ExtendedTextMessage_PreviewType int32 + +const ( + ExtendedTextMessage_NONE ExtendedTextMessage_PreviewType = 0 + ExtendedTextMessage_VIDEO ExtendedTextMessage_PreviewType = 1 +) + +// Enum value maps for ExtendedTextMessage_PreviewType. +var ( + ExtendedTextMessage_PreviewType_name = map[int32]string{ + 0: "NONE", + 1: "VIDEO", + } + ExtendedTextMessage_PreviewType_value = map[string]int32{ + "NONE": 0, + "VIDEO": 1, + } +) + +func (x ExtendedTextMessage_PreviewType) Enum() *ExtendedTextMessage_PreviewType { + p := new(ExtendedTextMessage_PreviewType) + *p = x + return p +} + +func (x ExtendedTextMessage_PreviewType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ExtendedTextMessage_PreviewType) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[15].Descriptor() +} + +func (ExtendedTextMessage_PreviewType) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[15] +} + +func (x ExtendedTextMessage_PreviewType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *ExtendedTextMessage_PreviewType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = ExtendedTextMessage_PreviewType(num) + return nil +} + +// Deprecated: Use ExtendedTextMessage_PreviewType.Descriptor instead. +func (ExtendedTextMessage_PreviewType) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{24, 0} +} + +type ExtendedTextMessage_InviteLinkGroupType int32 + +const ( + ExtendedTextMessage_DEFAULT ExtendedTextMessage_InviteLinkGroupType = 0 + ExtendedTextMessage_PARENT ExtendedTextMessage_InviteLinkGroupType = 1 + ExtendedTextMessage_SUB ExtendedTextMessage_InviteLinkGroupType = 2 + ExtendedTextMessage_DEFAULT_SUB ExtendedTextMessage_InviteLinkGroupType = 3 +) + +// Enum value maps for ExtendedTextMessage_InviteLinkGroupType. +var ( + ExtendedTextMessage_InviteLinkGroupType_name = map[int32]string{ + 0: "DEFAULT", + 1: "PARENT", + 2: "SUB", + 3: "DEFAULT_SUB", + } + ExtendedTextMessage_InviteLinkGroupType_value = map[string]int32{ + "DEFAULT": 0, + "PARENT": 1, + "SUB": 2, + "DEFAULT_SUB": 3, + } +) + +func (x ExtendedTextMessage_InviteLinkGroupType) Enum() *ExtendedTextMessage_InviteLinkGroupType { + p := new(ExtendedTextMessage_InviteLinkGroupType) + *p = x + return p +} + +func (x ExtendedTextMessage_InviteLinkGroupType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ExtendedTextMessage_InviteLinkGroupType) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[16].Descriptor() +} + +func (ExtendedTextMessage_InviteLinkGroupType) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[16] +} + +func (x ExtendedTextMessage_InviteLinkGroupType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *ExtendedTextMessage_InviteLinkGroupType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = ExtendedTextMessage_InviteLinkGroupType(num) + return nil +} + +// Deprecated: Use ExtendedTextMessage_InviteLinkGroupType.Descriptor instead. +func (ExtendedTextMessage_InviteLinkGroupType) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{24, 1} +} + +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 +) + +// Enum value maps for ExtendedTextMessage_FontType. +var ( + ExtendedTextMessage_FontType_name = map[int32]string{ + 0: "SANS_SERIF", + 1: "SERIF", + 2: "NORICAN_REGULAR", + 3: "BRYNDAN_WRITE", + 4: "BEBASNEUE_REGULAR", + 5: "OSWALD_HEAVY", + } + 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 protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ExtendedTextMessage_FontType) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[17].Descriptor() +} + +func (ExtendedTextMessage_FontType) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[17] +} + +func (x ExtendedTextMessage_FontType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *ExtendedTextMessage_FontType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = ExtendedTextMessage_FontType(num) + return nil +} + +// Deprecated: Use ExtendedTextMessage_FontType.Descriptor instead. +func (ExtendedTextMessage_FontType) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{24, 2} +} + +type ButtonsResponseMessage_Type int32 + +const ( + ButtonsResponseMessage_UNKNOWN ButtonsResponseMessage_Type = 0 + ButtonsResponseMessage_DISPLAY_TEXT ButtonsResponseMessage_Type = 1 +) + +// Enum value maps for ButtonsResponseMessage_Type. +var ( + ButtonsResponseMessage_Type_name = map[int32]string{ + 0: "UNKNOWN", + 1: "DISPLAY_TEXT", + } + ButtonsResponseMessage_Type_value = map[string]int32{ + "UNKNOWN": 0, + "DISPLAY_TEXT": 1, + } +) + +func (x ButtonsResponseMessage_Type) Enum() *ButtonsResponseMessage_Type { + p := new(ButtonsResponseMessage_Type) + *p = x + return p +} + +func (x ButtonsResponseMessage_Type) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ButtonsResponseMessage_Type) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[18].Descriptor() +} + +func (ButtonsResponseMessage_Type) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[18] +} + +func (x ButtonsResponseMessage_Type) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *ButtonsResponseMessage_Type) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = ButtonsResponseMessage_Type(num) + return nil +} + +// Deprecated: Use ButtonsResponseMessage_Type.Descriptor instead. +func (ButtonsResponseMessage_Type) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{34, 0} +} + +type ButtonsMessage_HeaderType int32 + +const ( + ButtonsMessage_UNKNOWN ButtonsMessage_HeaderType = 0 + ButtonsMessage_EMPTY ButtonsMessage_HeaderType = 1 + ButtonsMessage_TEXT ButtonsMessage_HeaderType = 2 + ButtonsMessage_DOCUMENT ButtonsMessage_HeaderType = 3 + ButtonsMessage_IMAGE ButtonsMessage_HeaderType = 4 + ButtonsMessage_VIDEO ButtonsMessage_HeaderType = 5 + ButtonsMessage_LOCATION ButtonsMessage_HeaderType = 6 +) + +// Enum value maps for ButtonsMessage_HeaderType. +var ( + ButtonsMessage_HeaderType_name = map[int32]string{ + 0: "UNKNOWN", + 1: "EMPTY", + 2: "TEXT", + 3: "DOCUMENT", + 4: "IMAGE", + 5: "VIDEO", + 6: "LOCATION", + } + ButtonsMessage_HeaderType_value = map[string]int32{ + "UNKNOWN": 0, + "EMPTY": 1, + "TEXT": 2, + "DOCUMENT": 3, + "IMAGE": 4, + "VIDEO": 5, + "LOCATION": 6, + } +) + +func (x ButtonsMessage_HeaderType) Enum() *ButtonsMessage_HeaderType { + p := new(ButtonsMessage_HeaderType) + *p = x + return p +} + +func (x ButtonsMessage_HeaderType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ButtonsMessage_HeaderType) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[19].Descriptor() +} + +func (ButtonsMessage_HeaderType) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[19] +} + +func (x ButtonsMessage_HeaderType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *ButtonsMessage_HeaderType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = ButtonsMessage_HeaderType(num) + return nil +} + +// Deprecated: Use ButtonsMessage_HeaderType.Descriptor instead. +func (ButtonsMessage_HeaderType) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{35, 0} +} + +type ButtonsMessage_Button_Type int32 + +const ( + ButtonsMessage_Button_UNKNOWN ButtonsMessage_Button_Type = 0 + ButtonsMessage_Button_RESPONSE ButtonsMessage_Button_Type = 1 + ButtonsMessage_Button_NATIVE_FLOW ButtonsMessage_Button_Type = 2 +) + +// Enum value maps for ButtonsMessage_Button_Type. +var ( + ButtonsMessage_Button_Type_name = map[int32]string{ + 0: "UNKNOWN", + 1: "RESPONSE", + 2: "NATIVE_FLOW", + } + ButtonsMessage_Button_Type_value = map[string]int32{ + "UNKNOWN": 0, + "RESPONSE": 1, + "NATIVE_FLOW": 2, + } +) + +func (x ButtonsMessage_Button_Type) Enum() *ButtonsMessage_Button_Type { + p := new(ButtonsMessage_Button_Type) + *p = x + return p +} + +func (x ButtonsMessage_Button_Type) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ButtonsMessage_Button_Type) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[20].Descriptor() +} + +func (ButtonsMessage_Button_Type) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[20] +} + +func (x ButtonsMessage_Button_Type) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *ButtonsMessage_Button_Type) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = ButtonsMessage_Button_Type(num) + return nil +} + +// Deprecated: Use ButtonsMessage_Button_Type.Descriptor instead. +func (ButtonsMessage_Button_Type) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{35, 0, 0} +} + +type DisappearingMode_Initiator int32 + +const ( + DisappearingMode_CHANGED_IN_CHAT DisappearingMode_Initiator = 0 + DisappearingMode_INITIATED_BY_ME DisappearingMode_Initiator = 1 + DisappearingMode_INITIATED_BY_OTHER DisappearingMode_Initiator = 2 +) + +// Enum value maps for DisappearingMode_Initiator. +var ( + DisappearingMode_Initiator_name = map[int32]string{ + 0: "CHANGED_IN_CHAT", + 1: "INITIATED_BY_ME", + 2: "INITIATED_BY_OTHER", + } + DisappearingMode_Initiator_value = map[string]int32{ + "CHANGED_IN_CHAT": 0, + "INITIATED_BY_ME": 1, + "INITIATED_BY_OTHER": 2, + } +) + +func (x DisappearingMode_Initiator) Enum() *DisappearingMode_Initiator { + p := new(DisappearingMode_Initiator) + *p = x + return p +} + +func (x DisappearingMode_Initiator) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (DisappearingMode_Initiator) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[21].Descriptor() +} + +func (DisappearingMode_Initiator) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[21] +} + +func (x DisappearingMode_Initiator) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *DisappearingMode_Initiator) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = DisappearingMode_Initiator(num) + return nil +} + +// Deprecated: Use DisappearingMode_Initiator.Descriptor instead. +func (DisappearingMode_Initiator) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{47, 0} +} + +type ContextInfo_ExternalAdReplyInfo_MediaType int32 + +const ( + ContextInfo_ExternalAdReplyInfo_NONE ContextInfo_ExternalAdReplyInfo_MediaType = 0 + ContextInfo_ExternalAdReplyInfo_IMAGE ContextInfo_ExternalAdReplyInfo_MediaType = 1 + ContextInfo_ExternalAdReplyInfo_VIDEO ContextInfo_ExternalAdReplyInfo_MediaType = 2 +) + +// Enum value maps for ContextInfo_ExternalAdReplyInfo_MediaType. +var ( + ContextInfo_ExternalAdReplyInfo_MediaType_name = map[int32]string{ + 0: "NONE", + 1: "IMAGE", + 2: "VIDEO", + } + ContextInfo_ExternalAdReplyInfo_MediaType_value = map[string]int32{ + "NONE": 0, + "IMAGE": 1, + "VIDEO": 2, + } +) + +func (x ContextInfo_ExternalAdReplyInfo_MediaType) Enum() *ContextInfo_ExternalAdReplyInfo_MediaType { + p := new(ContextInfo_ExternalAdReplyInfo_MediaType) + *p = x + return p +} + +func (x ContextInfo_ExternalAdReplyInfo_MediaType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ContextInfo_ExternalAdReplyInfo_MediaType) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[22].Descriptor() +} + +func (ContextInfo_ExternalAdReplyInfo_MediaType) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[22] +} + +func (x ContextInfo_ExternalAdReplyInfo_MediaType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *ContextInfo_ExternalAdReplyInfo_MediaType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = ContextInfo_ExternalAdReplyInfo_MediaType(num) + return nil +} + +// Deprecated: Use ContextInfo_ExternalAdReplyInfo_MediaType.Descriptor instead. +func (ContextInfo_ExternalAdReplyInfo_MediaType) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{49, 0, 0} +} + +type ContextInfo_AdReplyInfo_MediaType int32 + +const ( + ContextInfo_AdReplyInfo_NONE ContextInfo_AdReplyInfo_MediaType = 0 + ContextInfo_AdReplyInfo_IMAGE ContextInfo_AdReplyInfo_MediaType = 1 + ContextInfo_AdReplyInfo_VIDEO ContextInfo_AdReplyInfo_MediaType = 2 +) + +// Enum value maps for ContextInfo_AdReplyInfo_MediaType. +var ( + ContextInfo_AdReplyInfo_MediaType_name = map[int32]string{ + 0: "NONE", + 1: "IMAGE", + 2: "VIDEO", + } + ContextInfo_AdReplyInfo_MediaType_value = map[string]int32{ + "NONE": 0, + "IMAGE": 1, + "VIDEO": 2, + } +) + +func (x ContextInfo_AdReplyInfo_MediaType) Enum() *ContextInfo_AdReplyInfo_MediaType { + p := new(ContextInfo_AdReplyInfo_MediaType) + *p = x + return p +} + +func (x ContextInfo_AdReplyInfo_MediaType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ContextInfo_AdReplyInfo_MediaType) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[23].Descriptor() +} + +func (ContextInfo_AdReplyInfo_MediaType) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[23] +} + +func (x ContextInfo_AdReplyInfo_MediaType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *ContextInfo_AdReplyInfo_MediaType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = ContextInfo_AdReplyInfo_MediaType(num) + return nil +} + +// Deprecated: Use ContextInfo_AdReplyInfo_MediaType.Descriptor instead. +func (ContextInfo_AdReplyInfo_MediaType) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{49, 1, 0} +} + +type PaymentBackground_Type int32 + +const ( + PaymentBackground_UNKNOWN PaymentBackground_Type = 0 + PaymentBackground_DEFAULT PaymentBackground_Type = 1 +) + +// Enum value maps for PaymentBackground_Type. +var ( + PaymentBackground_Type_name = map[int32]string{ + 0: "UNKNOWN", + 1: "DEFAULT", + } + PaymentBackground_Type_value = map[string]int32{ + "UNKNOWN": 0, + "DEFAULT": 1, + } +) + +func (x PaymentBackground_Type) Enum() *PaymentBackground_Type { + p := new(PaymentBackground_Type) + *p = x + return p +} + +func (x PaymentBackground_Type) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (PaymentBackground_Type) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[24].Descriptor() +} + +func (PaymentBackground_Type) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[24] +} + +func (x PaymentBackground_Type) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *PaymentBackground_Type) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = PaymentBackground_Type(num) + return nil +} + +// Deprecated: Use PaymentBackground_Type.Descriptor instead. +func (PaymentBackground_Type) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{53, 0} +} + +type VideoMessage_Attribution int32 + +const ( + VideoMessage_NONE VideoMessage_Attribution = 0 + VideoMessage_GIPHY VideoMessage_Attribution = 1 + VideoMessage_TENOR VideoMessage_Attribution = 2 +) + +// Enum value maps for VideoMessage_Attribution. +var ( + VideoMessage_Attribution_name = map[int32]string{ + 0: "NONE", + 1: "GIPHY", + 2: "TENOR", + } + 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 protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (VideoMessage_Attribution) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[25].Descriptor() +} + +func (VideoMessage_Attribution) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[25] +} + +func (x VideoMessage_Attribution) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *VideoMessage_Attribution) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = VideoMessage_Attribution(num) + return nil +} + +// Deprecated: Use VideoMessage_Attribution.Descriptor instead. +func (VideoMessage_Attribution) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{57, 0} +} + +type ProtocolMessage_Type int32 + +const ( + ProtocolMessage_REVOKE ProtocolMessage_Type = 0 + ProtocolMessage_EPHEMERAL_SETTING ProtocolMessage_Type = 3 + ProtocolMessage_EPHEMERAL_SYNC_RESPONSE ProtocolMessage_Type = 4 + ProtocolMessage_HISTORY_SYNC_NOTIFICATION ProtocolMessage_Type = 5 + ProtocolMessage_APP_STATE_SYNC_KEY_SHARE ProtocolMessage_Type = 6 + ProtocolMessage_APP_STATE_SYNC_KEY_REQUEST ProtocolMessage_Type = 7 + ProtocolMessage_MSG_FANOUT_BACKFILL_REQUEST ProtocolMessage_Type = 8 + ProtocolMessage_INITIAL_SECURITY_NOTIFICATION_SETTING_SYNC ProtocolMessage_Type = 9 + ProtocolMessage_APP_STATE_FATAL_EXCEPTION_NOTIFICATION ProtocolMessage_Type = 10 + ProtocolMessage_SHARE_PHONE_NUMBER ProtocolMessage_Type = 11 + ProtocolMessage_MESSAGE_EDIT ProtocolMessage_Type = 14 + ProtocolMessage_PEER_DATA_OPERATION_REQUEST_MESSAGE ProtocolMessage_Type = 16 + ProtocolMessage_PEER_DATA_OPERATION_REQUEST_RESPONSE_MESSAGE ProtocolMessage_Type = 17 +) + +// Enum value maps for ProtocolMessage_Type. +var ( + ProtocolMessage_Type_name = map[int32]string{ + 0: "REVOKE", + 3: "EPHEMERAL_SETTING", + 4: "EPHEMERAL_SYNC_RESPONSE", + 5: "HISTORY_SYNC_NOTIFICATION", + 6: "APP_STATE_SYNC_KEY_SHARE", + 7: "APP_STATE_SYNC_KEY_REQUEST", + 8: "MSG_FANOUT_BACKFILL_REQUEST", + 9: "INITIAL_SECURITY_NOTIFICATION_SETTING_SYNC", + 10: "APP_STATE_FATAL_EXCEPTION_NOTIFICATION", + 11: "SHARE_PHONE_NUMBER", + 14: "MESSAGE_EDIT", + 16: "PEER_DATA_OPERATION_REQUEST_MESSAGE", + 17: "PEER_DATA_OPERATION_REQUEST_RESPONSE_MESSAGE", + } + ProtocolMessage_Type_value = map[string]int32{ + "REVOKE": 0, + "EPHEMERAL_SETTING": 3, + "EPHEMERAL_SYNC_RESPONSE": 4, + "HISTORY_SYNC_NOTIFICATION": 5, + "APP_STATE_SYNC_KEY_SHARE": 6, + "APP_STATE_SYNC_KEY_REQUEST": 7, + "MSG_FANOUT_BACKFILL_REQUEST": 8, + "INITIAL_SECURITY_NOTIFICATION_SETTING_SYNC": 9, + "APP_STATE_FATAL_EXCEPTION_NOTIFICATION": 10, + "SHARE_PHONE_NUMBER": 11, + "MESSAGE_EDIT": 14, + "PEER_DATA_OPERATION_REQUEST_MESSAGE": 16, + "PEER_DATA_OPERATION_REQUEST_RESPONSE_MESSAGE": 17, + } +) + +func (x ProtocolMessage_Type) Enum() *ProtocolMessage_Type { + p := new(ProtocolMessage_Type) + *p = x + return p +} + +func (x ProtocolMessage_Type) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ProtocolMessage_Type) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[26].Descriptor() +} + +func (ProtocolMessage_Type) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[26] +} + +func (x ProtocolMessage_Type) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *ProtocolMessage_Type) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = ProtocolMessage_Type(num) + return nil +} + +// Deprecated: Use ProtocolMessage_Type.Descriptor instead. +func (ProtocolMessage_Type) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{67, 0} +} + +type PastParticipant_LeaveReason int32 + +const ( + PastParticipant_LEFT PastParticipant_LeaveReason = 0 + PastParticipant_REMOVED PastParticipant_LeaveReason = 1 +) + +// Enum value maps for PastParticipant_LeaveReason. +var ( + PastParticipant_LeaveReason_name = map[int32]string{ + 0: "LEFT", + 1: "REMOVED", + } + PastParticipant_LeaveReason_value = map[string]int32{ + "LEFT": 0, + "REMOVED": 1, + } +) + +func (x PastParticipant_LeaveReason) Enum() *PastParticipant_LeaveReason { + p := new(PastParticipant_LeaveReason) + *p = x + return p +} + +func (x PastParticipant_LeaveReason) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (PastParticipant_LeaveReason) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[27].Descriptor() +} + +func (PastParticipant_LeaveReason) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[27] +} + +func (x PastParticipant_LeaveReason) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *PastParticipant_LeaveReason) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = PastParticipant_LeaveReason(num) + return nil +} + +// Deprecated: Use PastParticipant_LeaveReason.Descriptor instead. +func (PastParticipant_LeaveReason) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{79, 0} +} + +type HistorySync_HistorySyncType int32 + +const ( + HistorySync_INITIAL_BOOTSTRAP HistorySync_HistorySyncType = 0 + HistorySync_INITIAL_STATUS_V3 HistorySync_HistorySyncType = 1 + HistorySync_FULL HistorySync_HistorySyncType = 2 + HistorySync_RECENT HistorySync_HistorySyncType = 3 + HistorySync_PUSH_NAME HistorySync_HistorySyncType = 4 + HistorySync_NON_BLOCKING_DATA HistorySync_HistorySyncType = 5 +) + +// Enum value maps for HistorySync_HistorySyncType. +var ( + HistorySync_HistorySyncType_name = map[int32]string{ + 0: "INITIAL_BOOTSTRAP", + 1: "INITIAL_STATUS_V3", + 2: "FULL", + 3: "RECENT", + 4: "PUSH_NAME", + 5: "NON_BLOCKING_DATA", + } + HistorySync_HistorySyncType_value = map[string]int32{ + "INITIAL_BOOTSTRAP": 0, + "INITIAL_STATUS_V3": 1, + "FULL": 2, + "RECENT": 3, + "PUSH_NAME": 4, + "NON_BLOCKING_DATA": 5, + } +) + +func (x HistorySync_HistorySyncType) Enum() *HistorySync_HistorySyncType { + p := new(HistorySync_HistorySyncType) + *p = x + return p +} + +func (x HistorySync_HistorySyncType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (HistorySync_HistorySyncType) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[28].Descriptor() +} + +func (HistorySync_HistorySyncType) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[28] +} + +func (x HistorySync_HistorySyncType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *HistorySync_HistorySyncType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = HistorySync_HistorySyncType(num) + return nil +} + +// Deprecated: Use HistorySync_HistorySyncType.Descriptor instead. +func (HistorySync_HistorySyncType) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{80, 0} +} + +type GroupParticipant_Rank int32 + +const ( + GroupParticipant_REGULAR GroupParticipant_Rank = 0 + GroupParticipant_ADMIN GroupParticipant_Rank = 1 + GroupParticipant_SUPERADMIN GroupParticipant_Rank = 2 +) + +// Enum value maps for GroupParticipant_Rank. +var ( + GroupParticipant_Rank_name = map[int32]string{ + 0: "REGULAR", + 1: "ADMIN", + 2: "SUPERADMIN", + } + GroupParticipant_Rank_value = map[string]int32{ + "REGULAR": 0, + "ADMIN": 1, + "SUPERADMIN": 2, + } +) + +func (x GroupParticipant_Rank) Enum() *GroupParticipant_Rank { + p := new(GroupParticipant_Rank) + *p = x + return p +} + +func (x GroupParticipant_Rank) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (GroupParticipant_Rank) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[29].Descriptor() +} + +func (GroupParticipant_Rank) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[29] +} + +func (x GroupParticipant_Rank) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *GroupParticipant_Rank) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = GroupParticipant_Rank(num) + return nil +} + +// Deprecated: Use GroupParticipant_Rank.Descriptor instead. +func (GroupParticipant_Rank) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{82, 0} +} + +type Conversation_EndOfHistoryTransferType int32 + +const ( + Conversation_COMPLETE_BUT_MORE_MESSAGES_REMAIN_ON_PRIMARY Conversation_EndOfHistoryTransferType = 0 + Conversation_COMPLETE_AND_NO_MORE_MESSAGE_REMAIN_ON_PRIMARY Conversation_EndOfHistoryTransferType = 1 +) + +// Enum value maps for Conversation_EndOfHistoryTransferType. +var ( + Conversation_EndOfHistoryTransferType_name = map[int32]string{ + 0: "COMPLETE_BUT_MORE_MESSAGES_REMAIN_ON_PRIMARY", + 1: "COMPLETE_AND_NO_MORE_MESSAGE_REMAIN_ON_PRIMARY", + } + Conversation_EndOfHistoryTransferType_value = map[string]int32{ + "COMPLETE_BUT_MORE_MESSAGES_REMAIN_ON_PRIMARY": 0, + "COMPLETE_AND_NO_MORE_MESSAGE_REMAIN_ON_PRIMARY": 1, + } +) + +func (x Conversation_EndOfHistoryTransferType) Enum() *Conversation_EndOfHistoryTransferType { + p := new(Conversation_EndOfHistoryTransferType) + *p = x + return p +} + +func (x Conversation_EndOfHistoryTransferType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Conversation_EndOfHistoryTransferType) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[30].Descriptor() +} + +func (Conversation_EndOfHistoryTransferType) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[30] +} + +func (x Conversation_EndOfHistoryTransferType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *Conversation_EndOfHistoryTransferType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = Conversation_EndOfHistoryTransferType(num) + return nil +} + +// Deprecated: Use Conversation_EndOfHistoryTransferType.Descriptor instead. +func (Conversation_EndOfHistoryTransferType) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{84, 0} +} + +type MediaRetryNotification_ResultType int32 + +const ( + MediaRetryNotification_GENERAL_ERROR MediaRetryNotification_ResultType = 0 + MediaRetryNotification_SUCCESS MediaRetryNotification_ResultType = 1 + MediaRetryNotification_NOT_FOUND MediaRetryNotification_ResultType = 2 + MediaRetryNotification_DECRYPTION_ERROR MediaRetryNotification_ResultType = 3 +) + +// Enum value maps for MediaRetryNotification_ResultType. +var ( + MediaRetryNotification_ResultType_name = map[int32]string{ + 0: "GENERAL_ERROR", + 1: "SUCCESS", + 2: "NOT_FOUND", + 3: "DECRYPTION_ERROR", + } + MediaRetryNotification_ResultType_value = map[string]int32{ + "GENERAL_ERROR": 0, + "SUCCESS": 1, + "NOT_FOUND": 2, + "DECRYPTION_ERROR": 3, + } +) + +func (x MediaRetryNotification_ResultType) Enum() *MediaRetryNotification_ResultType { + p := new(MediaRetryNotification_ResultType) + *p = x + return p +} + +func (x MediaRetryNotification_ResultType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (MediaRetryNotification_ResultType) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[31].Descriptor() +} + +func (MediaRetryNotification_ResultType) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[31] +} + +func (x MediaRetryNotification_ResultType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *MediaRetryNotification_ResultType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = MediaRetryNotification_ResultType(num) + return nil +} + +// Deprecated: Use MediaRetryNotification_ResultType.Descriptor instead. +func (MediaRetryNotification_ResultType) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{90, 0} +} + +type SyncdMutation_SyncdOperation int32 + +const ( + SyncdMutation_SET SyncdMutation_SyncdOperation = 0 + SyncdMutation_REMOVE SyncdMutation_SyncdOperation = 1 +) + +// Enum value maps for SyncdMutation_SyncdOperation. +var ( + SyncdMutation_SyncdOperation_name = map[int32]string{ + 0: "SET", + 1: "REMOVE", + } + SyncdMutation_SyncdOperation_value = map[string]int32{ + "SET": 0, + "REMOVE": 1, + } +) + +func (x SyncdMutation_SyncdOperation) Enum() *SyncdMutation_SyncdOperation { + p := new(SyncdMutation_SyncdOperation) + *p = x + return p +} + +func (x SyncdMutation_SyncdOperation) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SyncdMutation_SyncdOperation) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[32].Descriptor() +} + +func (SyncdMutation_SyncdOperation) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[32] +} + +func (x SyncdMutation_SyncdOperation) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *SyncdMutation_SyncdOperation) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = SyncdMutation_SyncdOperation(num) + return nil +} + +// Deprecated: Use SyncdMutation_SyncdOperation.Descriptor instead. +func (SyncdMutation_SyncdOperation) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{98, 0} +} + +type BizIdentityInfo_VerifiedLevelValue int32 + +const ( + BizIdentityInfo_UNKNOWN BizIdentityInfo_VerifiedLevelValue = 0 + BizIdentityInfo_LOW BizIdentityInfo_VerifiedLevelValue = 1 + BizIdentityInfo_HIGH BizIdentityInfo_VerifiedLevelValue = 2 +) + +// Enum value maps for BizIdentityInfo_VerifiedLevelValue. +var ( + BizIdentityInfo_VerifiedLevelValue_name = map[int32]string{ + 0: "UNKNOWN", + 1: "LOW", + 2: "HIGH", + } + BizIdentityInfo_VerifiedLevelValue_value = map[string]int32{ + "UNKNOWN": 0, + "LOW": 1, + "HIGH": 2, + } +) + +func (x BizIdentityInfo_VerifiedLevelValue) Enum() *BizIdentityInfo_VerifiedLevelValue { + p := new(BizIdentityInfo_VerifiedLevelValue) + *p = x + return p +} + +func (x BizIdentityInfo_VerifiedLevelValue) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (BizIdentityInfo_VerifiedLevelValue) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[33].Descriptor() +} + +func (BizIdentityInfo_VerifiedLevelValue) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[33] +} + +func (x BizIdentityInfo_VerifiedLevelValue) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *BizIdentityInfo_VerifiedLevelValue) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = BizIdentityInfo_VerifiedLevelValue(num) + return nil +} + +// Deprecated: Use BizIdentityInfo_VerifiedLevelValue.Descriptor instead. +func (BizIdentityInfo_VerifiedLevelValue) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{141, 0} +} + +type BizIdentityInfo_HostStorageType int32 + +const ( + BizIdentityInfo_ON_PREMISE BizIdentityInfo_HostStorageType = 0 + BizIdentityInfo_FACEBOOK BizIdentityInfo_HostStorageType = 1 +) + +// Enum value maps for BizIdentityInfo_HostStorageType. +var ( + BizIdentityInfo_HostStorageType_name = map[int32]string{ + 0: "ON_PREMISE", + 1: "FACEBOOK", + } + BizIdentityInfo_HostStorageType_value = map[string]int32{ + "ON_PREMISE": 0, + "FACEBOOK": 1, + } +) + +func (x BizIdentityInfo_HostStorageType) Enum() *BizIdentityInfo_HostStorageType { + p := new(BizIdentityInfo_HostStorageType) + *p = x + return p +} + +func (x BizIdentityInfo_HostStorageType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (BizIdentityInfo_HostStorageType) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[34].Descriptor() +} + +func (BizIdentityInfo_HostStorageType) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[34] +} + +func (x BizIdentityInfo_HostStorageType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *BizIdentityInfo_HostStorageType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = BizIdentityInfo_HostStorageType(num) + return nil +} + +// Deprecated: Use BizIdentityInfo_HostStorageType.Descriptor instead. +func (BizIdentityInfo_HostStorageType) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{141, 1} +} + +type BizIdentityInfo_ActualActorsType int32 + +const ( + BizIdentityInfo_SELF BizIdentityInfo_ActualActorsType = 0 + BizIdentityInfo_BSP BizIdentityInfo_ActualActorsType = 1 +) + +// Enum value maps for BizIdentityInfo_ActualActorsType. +var ( + BizIdentityInfo_ActualActorsType_name = map[int32]string{ + 0: "SELF", + 1: "BSP", + } + BizIdentityInfo_ActualActorsType_value = map[string]int32{ + "SELF": 0, + "BSP": 1, + } +) + +func (x BizIdentityInfo_ActualActorsType) Enum() *BizIdentityInfo_ActualActorsType { + p := new(BizIdentityInfo_ActualActorsType) + *p = x + return p +} + +func (x BizIdentityInfo_ActualActorsType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (BizIdentityInfo_ActualActorsType) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[35].Descriptor() +} + +func (BizIdentityInfo_ActualActorsType) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[35] +} + +func (x BizIdentityInfo_ActualActorsType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *BizIdentityInfo_ActualActorsType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = BizIdentityInfo_ActualActorsType(num) + return nil +} + +// Deprecated: Use BizIdentityInfo_ActualActorsType.Descriptor instead. +func (BizIdentityInfo_ActualActorsType) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{141, 2} +} + +type BizAccountLinkInfo_HostStorageType int32 + +const ( + BizAccountLinkInfo_ON_PREMISE BizAccountLinkInfo_HostStorageType = 0 + BizAccountLinkInfo_FACEBOOK BizAccountLinkInfo_HostStorageType = 1 +) + +// Enum value maps for BizAccountLinkInfo_HostStorageType. +var ( + BizAccountLinkInfo_HostStorageType_name = map[int32]string{ + 0: "ON_PREMISE", + 1: "FACEBOOK", + } + BizAccountLinkInfo_HostStorageType_value = map[string]int32{ + "ON_PREMISE": 0, + "FACEBOOK": 1, + } +) + +func (x BizAccountLinkInfo_HostStorageType) Enum() *BizAccountLinkInfo_HostStorageType { + p := new(BizAccountLinkInfo_HostStorageType) + *p = x + return p +} + +func (x BizAccountLinkInfo_HostStorageType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (BizAccountLinkInfo_HostStorageType) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[36].Descriptor() +} + +func (BizAccountLinkInfo_HostStorageType) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[36] +} + +func (x BizAccountLinkInfo_HostStorageType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *BizAccountLinkInfo_HostStorageType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = BizAccountLinkInfo_HostStorageType(num) + return nil +} + +// Deprecated: Use BizAccountLinkInfo_HostStorageType.Descriptor instead. +func (BizAccountLinkInfo_HostStorageType) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{143, 0} +} + +type BizAccountLinkInfo_AccountType int32 + +const ( + BizAccountLinkInfo_ENTERPRISE BizAccountLinkInfo_AccountType = 0 +) + +// Enum value maps for BizAccountLinkInfo_AccountType. +var ( + BizAccountLinkInfo_AccountType_name = map[int32]string{ + 0: "ENTERPRISE", + } + BizAccountLinkInfo_AccountType_value = map[string]int32{ + "ENTERPRISE": 0, + } +) + +func (x BizAccountLinkInfo_AccountType) Enum() *BizAccountLinkInfo_AccountType { + p := new(BizAccountLinkInfo_AccountType) + *p = x + return p +} + +func (x BizAccountLinkInfo_AccountType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (BizAccountLinkInfo_AccountType) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[37].Descriptor() +} + +func (BizAccountLinkInfo_AccountType) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[37] +} + +func (x BizAccountLinkInfo_AccountType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *BizAccountLinkInfo_AccountType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = BizAccountLinkInfo_AccountType(num) + return nil +} + +// Deprecated: Use BizAccountLinkInfo_AccountType.Descriptor instead. +func (BizAccountLinkInfo_AccountType) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{143, 1} +} + +type ClientPayload_Product int32 + +const ( + ClientPayload_WHATSAPP ClientPayload_Product = 0 + ClientPayload_MESSENGER ClientPayload_Product = 1 +) + +// Enum value maps for ClientPayload_Product. +var ( + ClientPayload_Product_name = map[int32]string{ + 0: "WHATSAPP", + 1: "MESSENGER", + } + ClientPayload_Product_value = map[string]int32{ + "WHATSAPP": 0, + "MESSENGER": 1, + } +) + +func (x ClientPayload_Product) Enum() *ClientPayload_Product { + p := new(ClientPayload_Product) + *p = x + return p +} + +func (x ClientPayload_Product) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ClientPayload_Product) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[38].Descriptor() +} + +func (ClientPayload_Product) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[38] +} + +func (x ClientPayload_Product) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *ClientPayload_Product) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = ClientPayload_Product(num) + return nil +} + +// Deprecated: Use ClientPayload_Product.Descriptor instead. +func (ClientPayload_Product) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{148, 0} +} + +type ClientPayload_IOSAppExtension int32 + +const ( + ClientPayload_SHARE_EXTENSION ClientPayload_IOSAppExtension = 0 + ClientPayload_SERVICE_EXTENSION ClientPayload_IOSAppExtension = 1 + ClientPayload_INTENTS_EXTENSION ClientPayload_IOSAppExtension = 2 +) + +// Enum value maps for ClientPayload_IOSAppExtension. +var ( + ClientPayload_IOSAppExtension_name = map[int32]string{ + 0: "SHARE_EXTENSION", + 1: "SERVICE_EXTENSION", + 2: "INTENTS_EXTENSION", + } + ClientPayload_IOSAppExtension_value = map[string]int32{ + "SHARE_EXTENSION": 0, + "SERVICE_EXTENSION": 1, + "INTENTS_EXTENSION": 2, + } +) + +func (x ClientPayload_IOSAppExtension) Enum() *ClientPayload_IOSAppExtension { + p := new(ClientPayload_IOSAppExtension) + *p = x + return p +} + +func (x ClientPayload_IOSAppExtension) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ClientPayload_IOSAppExtension) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[39].Descriptor() +} + +func (ClientPayload_IOSAppExtension) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[39] +} + +func (x ClientPayload_IOSAppExtension) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *ClientPayload_IOSAppExtension) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = ClientPayload_IOSAppExtension(num) + return nil +} + +// Deprecated: Use ClientPayload_IOSAppExtension.Descriptor instead. +func (ClientPayload_IOSAppExtension) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{148, 1} +} + +type ClientPayload_ConnectType int32 + +const ( + ClientPayload_CELLULAR_UNKNOWN ClientPayload_ConnectType = 0 + ClientPayload_WIFI_UNKNOWN ClientPayload_ConnectType = 1 + ClientPayload_CELLULAR_EDGE ClientPayload_ConnectType = 100 + ClientPayload_CELLULAR_IDEN ClientPayload_ConnectType = 101 + ClientPayload_CELLULAR_UMTS ClientPayload_ConnectType = 102 + ClientPayload_CELLULAR_EVDO ClientPayload_ConnectType = 103 + ClientPayload_CELLULAR_GPRS ClientPayload_ConnectType = 104 + ClientPayload_CELLULAR_HSDPA ClientPayload_ConnectType = 105 + ClientPayload_CELLULAR_HSUPA ClientPayload_ConnectType = 106 + ClientPayload_CELLULAR_HSPA ClientPayload_ConnectType = 107 + ClientPayload_CELLULAR_CDMA ClientPayload_ConnectType = 108 + ClientPayload_CELLULAR_1XRTT ClientPayload_ConnectType = 109 + ClientPayload_CELLULAR_EHRPD ClientPayload_ConnectType = 110 + ClientPayload_CELLULAR_LTE ClientPayload_ConnectType = 111 + ClientPayload_CELLULAR_HSPAP ClientPayload_ConnectType = 112 +) + +// Enum value maps for ClientPayload_ConnectType. +var ( + ClientPayload_ConnectType_name = map[int32]string{ + 0: "CELLULAR_UNKNOWN", + 1: "WIFI_UNKNOWN", + 100: "CELLULAR_EDGE", + 101: "CELLULAR_IDEN", + 102: "CELLULAR_UMTS", + 103: "CELLULAR_EVDO", + 104: "CELLULAR_GPRS", + 105: "CELLULAR_HSDPA", + 106: "CELLULAR_HSUPA", + 107: "CELLULAR_HSPA", + 108: "CELLULAR_CDMA", + 109: "CELLULAR_1XRTT", + 110: "CELLULAR_EHRPD", + 111: "CELLULAR_LTE", + 112: "CELLULAR_HSPAP", + } + ClientPayload_ConnectType_value = map[string]int32{ + "CELLULAR_UNKNOWN": 0, + "WIFI_UNKNOWN": 1, + "CELLULAR_EDGE": 100, + "CELLULAR_IDEN": 101, + "CELLULAR_UMTS": 102, + "CELLULAR_EVDO": 103, + "CELLULAR_GPRS": 104, + "CELLULAR_HSDPA": 105, + "CELLULAR_HSUPA": 106, + "CELLULAR_HSPA": 107, + "CELLULAR_CDMA": 108, + "CELLULAR_1XRTT": 109, + "CELLULAR_EHRPD": 110, + "CELLULAR_LTE": 111, + "CELLULAR_HSPAP": 112, + } +) + +func (x ClientPayload_ConnectType) Enum() *ClientPayload_ConnectType { + p := new(ClientPayload_ConnectType) + *p = x + return p +} + +func (x ClientPayload_ConnectType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ClientPayload_ConnectType) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[40].Descriptor() +} + +func (ClientPayload_ConnectType) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[40] +} + +func (x ClientPayload_ConnectType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *ClientPayload_ConnectType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = ClientPayload_ConnectType(num) + return nil +} + +// Deprecated: Use ClientPayload_ConnectType.Descriptor instead. +func (ClientPayload_ConnectType) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{148, 2} +} + +type ClientPayload_ConnectReason int32 + +const ( + ClientPayload_PUSH ClientPayload_ConnectReason = 0 + ClientPayload_USER_ACTIVATED ClientPayload_ConnectReason = 1 + ClientPayload_SCHEDULED ClientPayload_ConnectReason = 2 + ClientPayload_ERROR_RECONNECT ClientPayload_ConnectReason = 3 + ClientPayload_NETWORK_SWITCH ClientPayload_ConnectReason = 4 + ClientPayload_PING_RECONNECT ClientPayload_ConnectReason = 5 +) + +// Enum value maps for ClientPayload_ConnectReason. +var ( + ClientPayload_ConnectReason_name = map[int32]string{ + 0: "PUSH", + 1: "USER_ACTIVATED", + 2: "SCHEDULED", + 3: "ERROR_RECONNECT", + 4: "NETWORK_SWITCH", + 5: "PING_RECONNECT", + } + ClientPayload_ConnectReason_value = map[string]int32{ + "PUSH": 0, + "USER_ACTIVATED": 1, + "SCHEDULED": 2, + "ERROR_RECONNECT": 3, + "NETWORK_SWITCH": 4, + "PING_RECONNECT": 5, + } +) + +func (x ClientPayload_ConnectReason) Enum() *ClientPayload_ConnectReason { + p := new(ClientPayload_ConnectReason) + *p = x + return p +} + +func (x ClientPayload_ConnectReason) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ClientPayload_ConnectReason) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[41].Descriptor() +} + +func (ClientPayload_ConnectReason) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[41] +} + +func (x ClientPayload_ConnectReason) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *ClientPayload_ConnectReason) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = ClientPayload_ConnectReason(num) + return nil +} + +// Deprecated: Use ClientPayload_ConnectReason.Descriptor instead. +func (ClientPayload_ConnectReason) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{148, 3} +} + +type ClientPayload_BizMarketSegment int32 + +const ( + ClientPayload_DEFAULT ClientPayload_BizMarketSegment = 0 + ClientPayload_DEVX ClientPayload_BizMarketSegment = 1 + ClientPayload_INBOX ClientPayload_BizMarketSegment = 2 +) + +// Enum value maps for ClientPayload_BizMarketSegment. +var ( + ClientPayload_BizMarketSegment_name = map[int32]string{ + 0: "DEFAULT", + 1: "DEVX", + 2: "INBOX", + } + ClientPayload_BizMarketSegment_value = map[string]int32{ + "DEFAULT": 0, + "DEVX": 1, + "INBOX": 2, + } +) + +func (x ClientPayload_BizMarketSegment) Enum() *ClientPayload_BizMarketSegment { + p := new(ClientPayload_BizMarketSegment) + *p = x + return p +} + +func (x ClientPayload_BizMarketSegment) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ClientPayload_BizMarketSegment) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[42].Descriptor() +} + +func (ClientPayload_BizMarketSegment) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[42] +} + +func (x ClientPayload_BizMarketSegment) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *ClientPayload_BizMarketSegment) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = ClientPayload_BizMarketSegment(num) + return nil +} + +// Deprecated: Use ClientPayload_BizMarketSegment.Descriptor instead. +func (ClientPayload_BizMarketSegment) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{148, 4} +} + +type ClientPayload_WebInfo_WebSubPlatform int32 + +const ( + ClientPayload_WebInfo_WEB_BROWSER ClientPayload_WebInfo_WebSubPlatform = 0 + ClientPayload_WebInfo_APP_STORE ClientPayload_WebInfo_WebSubPlatform = 1 + ClientPayload_WebInfo_WIN_STORE ClientPayload_WebInfo_WebSubPlatform = 2 + ClientPayload_WebInfo_DARWIN ClientPayload_WebInfo_WebSubPlatform = 3 + ClientPayload_WebInfo_WIN32 ClientPayload_WebInfo_WebSubPlatform = 4 +) + +// Enum value maps for ClientPayload_WebInfo_WebSubPlatform. +var ( + ClientPayload_WebInfo_WebSubPlatform_name = map[int32]string{ + 0: "WEB_BROWSER", + 1: "APP_STORE", + 2: "WIN_STORE", + 3: "DARWIN", + 4: "WIN32", + } + ClientPayload_WebInfo_WebSubPlatform_value = map[string]int32{ + "WEB_BROWSER": 0, + "APP_STORE": 1, + "WIN_STORE": 2, + "DARWIN": 3, + "WIN32": 4, + } +) + +func (x ClientPayload_WebInfo_WebSubPlatform) Enum() *ClientPayload_WebInfo_WebSubPlatform { + p := new(ClientPayload_WebInfo_WebSubPlatform) + *p = x + return p +} + +func (x ClientPayload_WebInfo_WebSubPlatform) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ClientPayload_WebInfo_WebSubPlatform) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[43].Descriptor() +} + +func (ClientPayload_WebInfo_WebSubPlatform) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[43] +} + +func (x ClientPayload_WebInfo_WebSubPlatform) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *ClientPayload_WebInfo_WebSubPlatform) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = ClientPayload_WebInfo_WebSubPlatform(num) + return nil +} + +// Deprecated: Use ClientPayload_WebInfo_WebSubPlatform.Descriptor instead. +func (ClientPayload_WebInfo_WebSubPlatform) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{148, 0, 0} +} + +type ClientPayload_UserAgent_ReleaseChannel int32 + +const ( + ClientPayload_UserAgent_RELEASE ClientPayload_UserAgent_ReleaseChannel = 0 + ClientPayload_UserAgent_BETA ClientPayload_UserAgent_ReleaseChannel = 1 + ClientPayload_UserAgent_ALPHA ClientPayload_UserAgent_ReleaseChannel = 2 + ClientPayload_UserAgent_DEBUG ClientPayload_UserAgent_ReleaseChannel = 3 +) + +// Enum value maps for ClientPayload_UserAgent_ReleaseChannel. +var ( + ClientPayload_UserAgent_ReleaseChannel_name = map[int32]string{ + 0: "RELEASE", + 1: "BETA", + 2: "ALPHA", + 3: "DEBUG", + } + ClientPayload_UserAgent_ReleaseChannel_value = map[string]int32{ + "RELEASE": 0, + "BETA": 1, + "ALPHA": 2, + "DEBUG": 3, + } +) + +func (x ClientPayload_UserAgent_ReleaseChannel) Enum() *ClientPayload_UserAgent_ReleaseChannel { + p := new(ClientPayload_UserAgent_ReleaseChannel) + *p = x + return p +} + +func (x ClientPayload_UserAgent_ReleaseChannel) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ClientPayload_UserAgent_ReleaseChannel) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[44].Descriptor() +} + +func (ClientPayload_UserAgent_ReleaseChannel) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[44] +} + +func (x ClientPayload_UserAgent_ReleaseChannel) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *ClientPayload_UserAgent_ReleaseChannel) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = ClientPayload_UserAgent_ReleaseChannel(num) + return nil +} + +// Deprecated: Use ClientPayload_UserAgent_ReleaseChannel.Descriptor instead. +func (ClientPayload_UserAgent_ReleaseChannel) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{148, 1, 0} +} + +type ClientPayload_UserAgent_Platform int32 + +const ( + ClientPayload_UserAgent_ANDROID ClientPayload_UserAgent_Platform = 0 + ClientPayload_UserAgent_IOS ClientPayload_UserAgent_Platform = 1 + ClientPayload_UserAgent_WINDOWS_PHONE ClientPayload_UserAgent_Platform = 2 + ClientPayload_UserAgent_BLACKBERRY ClientPayload_UserAgent_Platform = 3 + ClientPayload_UserAgent_BLACKBERRYX ClientPayload_UserAgent_Platform = 4 + ClientPayload_UserAgent_S40 ClientPayload_UserAgent_Platform = 5 + ClientPayload_UserAgent_S60 ClientPayload_UserAgent_Platform = 6 + ClientPayload_UserAgent_PYTHON_CLIENT ClientPayload_UserAgent_Platform = 7 + ClientPayload_UserAgent_TIZEN ClientPayload_UserAgent_Platform = 8 + ClientPayload_UserAgent_ENTERPRISE ClientPayload_UserAgent_Platform = 9 + ClientPayload_UserAgent_SMB_ANDROID ClientPayload_UserAgent_Platform = 10 + ClientPayload_UserAgent_KAIOS ClientPayload_UserAgent_Platform = 11 + ClientPayload_UserAgent_SMB_IOS ClientPayload_UserAgent_Platform = 12 + ClientPayload_UserAgent_WINDOWS ClientPayload_UserAgent_Platform = 13 + ClientPayload_UserAgent_WEB ClientPayload_UserAgent_Platform = 14 + ClientPayload_UserAgent_PORTAL ClientPayload_UserAgent_Platform = 15 + ClientPayload_UserAgent_GREEN_ANDROID ClientPayload_UserAgent_Platform = 16 + ClientPayload_UserAgent_GREEN_IPHONE ClientPayload_UserAgent_Platform = 17 + ClientPayload_UserAgent_BLUE_ANDROID ClientPayload_UserAgent_Platform = 18 + ClientPayload_UserAgent_BLUE_IPHONE ClientPayload_UserAgent_Platform = 19 + ClientPayload_UserAgent_FBLITE_ANDROID ClientPayload_UserAgent_Platform = 20 + ClientPayload_UserAgent_MLITE_ANDROID ClientPayload_UserAgent_Platform = 21 + ClientPayload_UserAgent_IGLITE_ANDROID ClientPayload_UserAgent_Platform = 22 + ClientPayload_UserAgent_PAGE ClientPayload_UserAgent_Platform = 23 + ClientPayload_UserAgent_MACOS ClientPayload_UserAgent_Platform = 24 + ClientPayload_UserAgent_OCULUS_MSG ClientPayload_UserAgent_Platform = 25 + ClientPayload_UserAgent_OCULUS_CALL ClientPayload_UserAgent_Platform = 26 + ClientPayload_UserAgent_MILAN ClientPayload_UserAgent_Platform = 27 + ClientPayload_UserAgent_CAPI ClientPayload_UserAgent_Platform = 28 + ClientPayload_UserAgent_WEAROS ClientPayload_UserAgent_Platform = 29 + ClientPayload_UserAgent_ARDEVICE ClientPayload_UserAgent_Platform = 30 + ClientPayload_UserAgent_VRDEVICE ClientPayload_UserAgent_Platform = 31 +) + +// Enum value maps for ClientPayload_UserAgent_Platform. +var ( + ClientPayload_UserAgent_Platform_name = map[int32]string{ + 0: "ANDROID", + 1: "IOS", + 2: "WINDOWS_PHONE", + 3: "BLACKBERRY", + 4: "BLACKBERRYX", + 5: "S40", + 6: "S60", + 7: "PYTHON_CLIENT", + 8: "TIZEN", + 9: "ENTERPRISE", + 10: "SMB_ANDROID", + 11: "KAIOS", + 12: "SMB_IOS", + 13: "WINDOWS", + 14: "WEB", + 15: "PORTAL", + 16: "GREEN_ANDROID", + 17: "GREEN_IPHONE", + 18: "BLUE_ANDROID", + 19: "BLUE_IPHONE", + 20: "FBLITE_ANDROID", + 21: "MLITE_ANDROID", + 22: "IGLITE_ANDROID", + 23: "PAGE", + 24: "MACOS", + 25: "OCULUS_MSG", + 26: "OCULUS_CALL", + 27: "MILAN", + 28: "CAPI", + 29: "WEAROS", + 30: "ARDEVICE", + 31: "VRDEVICE", + } + ClientPayload_UserAgent_Platform_value = map[string]int32{ + "ANDROID": 0, + "IOS": 1, + "WINDOWS_PHONE": 2, + "BLACKBERRY": 3, + "BLACKBERRYX": 4, + "S40": 5, + "S60": 6, + "PYTHON_CLIENT": 7, + "TIZEN": 8, + "ENTERPRISE": 9, + "SMB_ANDROID": 10, + "KAIOS": 11, + "SMB_IOS": 12, + "WINDOWS": 13, + "WEB": 14, + "PORTAL": 15, + "GREEN_ANDROID": 16, + "GREEN_IPHONE": 17, + "BLUE_ANDROID": 18, + "BLUE_IPHONE": 19, + "FBLITE_ANDROID": 20, + "MLITE_ANDROID": 21, + "IGLITE_ANDROID": 22, + "PAGE": 23, + "MACOS": 24, + "OCULUS_MSG": 25, + "OCULUS_CALL": 26, + "MILAN": 27, + "CAPI": 28, + "WEAROS": 29, + "ARDEVICE": 30, + "VRDEVICE": 31, + } +) + +func (x ClientPayload_UserAgent_Platform) Enum() *ClientPayload_UserAgent_Platform { + p := new(ClientPayload_UserAgent_Platform) + *p = x + return p +} + +func (x ClientPayload_UserAgent_Platform) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ClientPayload_UserAgent_Platform) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[45].Descriptor() +} + +func (ClientPayload_UserAgent_Platform) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[45] +} + +func (x ClientPayload_UserAgent_Platform) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *ClientPayload_UserAgent_Platform) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = ClientPayload_UserAgent_Platform(num) + return nil +} + +// Deprecated: Use ClientPayload_UserAgent_Platform.Descriptor instead. +func (ClientPayload_UserAgent_Platform) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{148, 1, 1} +} + +type ClientPayload_DNSSource_DNSResolutionMethod int32 + +const ( + ClientPayload_DNSSource_SYSTEM ClientPayload_DNSSource_DNSResolutionMethod = 0 + ClientPayload_DNSSource_GOOGLE ClientPayload_DNSSource_DNSResolutionMethod = 1 + ClientPayload_DNSSource_HARDCODED ClientPayload_DNSSource_DNSResolutionMethod = 2 + ClientPayload_DNSSource_OVERRIDE ClientPayload_DNSSource_DNSResolutionMethod = 3 + ClientPayload_DNSSource_FALLBACK ClientPayload_DNSSource_DNSResolutionMethod = 4 +) + +// Enum value maps for ClientPayload_DNSSource_DNSResolutionMethod. +var ( + ClientPayload_DNSSource_DNSResolutionMethod_name = map[int32]string{ + 0: "SYSTEM", + 1: "GOOGLE", + 2: "HARDCODED", + 3: "OVERRIDE", + 4: "FALLBACK", + } + ClientPayload_DNSSource_DNSResolutionMethod_value = map[string]int32{ + "SYSTEM": 0, + "GOOGLE": 1, + "HARDCODED": 2, + "OVERRIDE": 3, + "FALLBACK": 4, + } +) + +func (x ClientPayload_DNSSource_DNSResolutionMethod) Enum() *ClientPayload_DNSSource_DNSResolutionMethod { + p := new(ClientPayload_DNSSource_DNSResolutionMethod) + *p = x + return p +} + +func (x ClientPayload_DNSSource_DNSResolutionMethod) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ClientPayload_DNSSource_DNSResolutionMethod) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[46].Descriptor() +} + +func (ClientPayload_DNSSource_DNSResolutionMethod) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[46] +} + +func (x ClientPayload_DNSSource_DNSResolutionMethod) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *ClientPayload_DNSSource_DNSResolutionMethod) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = ClientPayload_DNSSource_DNSResolutionMethod(num) + return nil +} + +// Deprecated: Use ClientPayload_DNSSource_DNSResolutionMethod.Descriptor instead. +func (ClientPayload_DNSSource_DNSResolutionMethod) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{148, 3, 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 + WebMessageInfo_GROUP_ANNOUNCE_MODE_MESSAGE_BOUNCE WebMessageInfo_StubType = 44 + WebMessageInfo_CALL_MISSED_GROUP_VOICE WebMessageInfo_StubType = 45 + WebMessageInfo_CALL_MISSED_GROUP_VIDEO WebMessageInfo_StubType = 46 + WebMessageInfo_PAYMENT_CIPHERTEXT WebMessageInfo_StubType = 47 + WebMessageInfo_PAYMENT_FUTUREPROOF WebMessageInfo_StubType = 48 + WebMessageInfo_PAYMENT_TRANSACTION_STATUS_UPDATE_FAILED WebMessageInfo_StubType = 49 + WebMessageInfo_PAYMENT_TRANSACTION_STATUS_UPDATE_REFUNDED WebMessageInfo_StubType = 50 + WebMessageInfo_PAYMENT_TRANSACTION_STATUS_UPDATE_REFUND_FAILED WebMessageInfo_StubType = 51 + WebMessageInfo_PAYMENT_TRANSACTION_STATUS_RECEIVER_PENDING_SETUP WebMessageInfo_StubType = 52 + WebMessageInfo_PAYMENT_TRANSACTION_STATUS_RECEIVER_SUCCESS_AFTER_HICCUP WebMessageInfo_StubType = 53 + WebMessageInfo_PAYMENT_ACTION_ACCOUNT_SETUP_REMINDER WebMessageInfo_StubType = 54 + WebMessageInfo_PAYMENT_ACTION_SEND_PAYMENT_REMINDER WebMessageInfo_StubType = 55 + WebMessageInfo_PAYMENT_ACTION_SEND_PAYMENT_INVITATION WebMessageInfo_StubType = 56 + WebMessageInfo_PAYMENT_ACTION_REQUEST_DECLINED WebMessageInfo_StubType = 57 + WebMessageInfo_PAYMENT_ACTION_REQUEST_EXPIRED WebMessageInfo_StubType = 58 + WebMessageInfo_PAYMENT_ACTION_REQUEST_CANCELLED WebMessageInfo_StubType = 59 + WebMessageInfo_BIZ_VERIFIED_TRANSITION_TOP_TO_BOTTOM WebMessageInfo_StubType = 60 + WebMessageInfo_BIZ_VERIFIED_TRANSITION_BOTTOM_TO_TOP WebMessageInfo_StubType = 61 + WebMessageInfo_BIZ_INTRO_TOP WebMessageInfo_StubType = 62 + WebMessageInfo_BIZ_INTRO_BOTTOM WebMessageInfo_StubType = 63 + WebMessageInfo_BIZ_NAME_CHANGE WebMessageInfo_StubType = 64 + WebMessageInfo_BIZ_MOVE_TO_CONSUMER_APP WebMessageInfo_StubType = 65 + WebMessageInfo_BIZ_TWO_TIER_MIGRATION_TOP WebMessageInfo_StubType = 66 + WebMessageInfo_BIZ_TWO_TIER_MIGRATION_BOTTOM WebMessageInfo_StubType = 67 + WebMessageInfo_OVERSIZED WebMessageInfo_StubType = 68 + WebMessageInfo_GROUP_CHANGE_NO_FREQUENTLY_FORWARDED WebMessageInfo_StubType = 69 + WebMessageInfo_GROUP_V4_ADD_INVITE_SENT WebMessageInfo_StubType = 70 + WebMessageInfo_GROUP_PARTICIPANT_ADD_REQUEST_JOIN WebMessageInfo_StubType = 71 + WebMessageInfo_CHANGE_EPHEMERAL_SETTING WebMessageInfo_StubType = 72 + WebMessageInfo_E2E_DEVICE_CHANGED WebMessageInfo_StubType = 73 + WebMessageInfo_VIEWED_ONCE WebMessageInfo_StubType = 74 + WebMessageInfo_E2E_ENCRYPTED_NOW WebMessageInfo_StubType = 75 + WebMessageInfo_BLUE_MSG_BSP_FB_TO_BSP_PREMISE WebMessageInfo_StubType = 76 + WebMessageInfo_BLUE_MSG_BSP_FB_TO_SELF_FB WebMessageInfo_StubType = 77 + WebMessageInfo_BLUE_MSG_BSP_FB_TO_SELF_PREMISE WebMessageInfo_StubType = 78 + WebMessageInfo_BLUE_MSG_BSP_FB_UNVERIFIED WebMessageInfo_StubType = 79 + WebMessageInfo_BLUE_MSG_BSP_FB_UNVERIFIED_TO_SELF_PREMISE_VERIFIED WebMessageInfo_StubType = 80 + WebMessageInfo_BLUE_MSG_BSP_FB_VERIFIED WebMessageInfo_StubType = 81 + WebMessageInfo_BLUE_MSG_BSP_FB_VERIFIED_TO_SELF_PREMISE_UNVERIFIED WebMessageInfo_StubType = 82 + WebMessageInfo_BLUE_MSG_BSP_PREMISE_TO_SELF_PREMISE WebMessageInfo_StubType = 83 + WebMessageInfo_BLUE_MSG_BSP_PREMISE_UNVERIFIED WebMessageInfo_StubType = 84 + WebMessageInfo_BLUE_MSG_BSP_PREMISE_UNVERIFIED_TO_SELF_PREMISE_VERIFIED WebMessageInfo_StubType = 85 + WebMessageInfo_BLUE_MSG_BSP_PREMISE_VERIFIED WebMessageInfo_StubType = 86 + WebMessageInfo_BLUE_MSG_BSP_PREMISE_VERIFIED_TO_SELF_PREMISE_UNVERIFIED WebMessageInfo_StubType = 87 + WebMessageInfo_BLUE_MSG_CONSUMER_TO_BSP_FB_UNVERIFIED WebMessageInfo_StubType = 88 + WebMessageInfo_BLUE_MSG_CONSUMER_TO_BSP_PREMISE_UNVERIFIED WebMessageInfo_StubType = 89 + WebMessageInfo_BLUE_MSG_CONSUMER_TO_SELF_FB_UNVERIFIED WebMessageInfo_StubType = 90 + WebMessageInfo_BLUE_MSG_CONSUMER_TO_SELF_PREMISE_UNVERIFIED WebMessageInfo_StubType = 91 + WebMessageInfo_BLUE_MSG_SELF_FB_TO_BSP_PREMISE WebMessageInfo_StubType = 92 + WebMessageInfo_BLUE_MSG_SELF_FB_TO_SELF_PREMISE WebMessageInfo_StubType = 93 + WebMessageInfo_BLUE_MSG_SELF_FB_UNVERIFIED WebMessageInfo_StubType = 94 + WebMessageInfo_BLUE_MSG_SELF_FB_UNVERIFIED_TO_SELF_PREMISE_VERIFIED WebMessageInfo_StubType = 95 + WebMessageInfo_BLUE_MSG_SELF_FB_VERIFIED WebMessageInfo_StubType = 96 + WebMessageInfo_BLUE_MSG_SELF_FB_VERIFIED_TO_SELF_PREMISE_UNVERIFIED WebMessageInfo_StubType = 97 + WebMessageInfo_BLUE_MSG_SELF_PREMISE_TO_BSP_PREMISE WebMessageInfo_StubType = 98 + WebMessageInfo_BLUE_MSG_SELF_PREMISE_UNVERIFIED WebMessageInfo_StubType = 99 + WebMessageInfo_BLUE_MSG_SELF_PREMISE_VERIFIED WebMessageInfo_StubType = 100 + WebMessageInfo_BLUE_MSG_TO_BSP_FB WebMessageInfo_StubType = 101 + WebMessageInfo_BLUE_MSG_TO_CONSUMER WebMessageInfo_StubType = 102 + WebMessageInfo_BLUE_MSG_TO_SELF_FB WebMessageInfo_StubType = 103 + WebMessageInfo_BLUE_MSG_UNVERIFIED_TO_BSP_FB_VERIFIED WebMessageInfo_StubType = 104 + WebMessageInfo_BLUE_MSG_UNVERIFIED_TO_BSP_PREMISE_VERIFIED WebMessageInfo_StubType = 105 + WebMessageInfo_BLUE_MSG_UNVERIFIED_TO_SELF_FB_VERIFIED WebMessageInfo_StubType = 106 + WebMessageInfo_BLUE_MSG_UNVERIFIED_TO_VERIFIED WebMessageInfo_StubType = 107 + WebMessageInfo_BLUE_MSG_VERIFIED_TO_BSP_FB_UNVERIFIED WebMessageInfo_StubType = 108 + WebMessageInfo_BLUE_MSG_VERIFIED_TO_BSP_PREMISE_UNVERIFIED WebMessageInfo_StubType = 109 + WebMessageInfo_BLUE_MSG_VERIFIED_TO_SELF_FB_UNVERIFIED WebMessageInfo_StubType = 110 + WebMessageInfo_BLUE_MSG_VERIFIED_TO_UNVERIFIED WebMessageInfo_StubType = 111 + WebMessageInfo_BLUE_MSG_BSP_FB_UNVERIFIED_TO_BSP_PREMISE_VERIFIED WebMessageInfo_StubType = 112 + WebMessageInfo_BLUE_MSG_BSP_FB_UNVERIFIED_TO_SELF_FB_VERIFIED WebMessageInfo_StubType = 113 + WebMessageInfo_BLUE_MSG_BSP_FB_VERIFIED_TO_BSP_PREMISE_UNVERIFIED WebMessageInfo_StubType = 114 + WebMessageInfo_BLUE_MSG_BSP_FB_VERIFIED_TO_SELF_FB_UNVERIFIED WebMessageInfo_StubType = 115 + WebMessageInfo_BLUE_MSG_SELF_FB_UNVERIFIED_TO_BSP_PREMISE_VERIFIED WebMessageInfo_StubType = 116 + WebMessageInfo_BLUE_MSG_SELF_FB_VERIFIED_TO_BSP_PREMISE_UNVERIFIED WebMessageInfo_StubType = 117 + WebMessageInfo_E2E_IDENTITY_UNAVAILABLE WebMessageInfo_StubType = 118 + WebMessageInfo_GROUP_CREATING WebMessageInfo_StubType = 119 + WebMessageInfo_GROUP_CREATE_FAILED WebMessageInfo_StubType = 120 + WebMessageInfo_GROUP_BOUNCED WebMessageInfo_StubType = 121 + WebMessageInfo_BLOCK_CONTACT WebMessageInfo_StubType = 122 + WebMessageInfo_EPHEMERAL_SETTING_NOT_APPLIED WebMessageInfo_StubType = 123 + WebMessageInfo_SYNC_FAILED WebMessageInfo_StubType = 124 + WebMessageInfo_SYNCING WebMessageInfo_StubType = 125 + WebMessageInfo_BIZ_PRIVACY_MODE_INIT_FB WebMessageInfo_StubType = 126 + WebMessageInfo_BIZ_PRIVACY_MODE_INIT_BSP WebMessageInfo_StubType = 127 + WebMessageInfo_BIZ_PRIVACY_MODE_TO_FB WebMessageInfo_StubType = 128 + WebMessageInfo_BIZ_PRIVACY_MODE_TO_BSP WebMessageInfo_StubType = 129 + WebMessageInfo_DISAPPEARING_MODE WebMessageInfo_StubType = 130 + WebMessageInfo_E2E_DEVICE_FETCH_FAILED WebMessageInfo_StubType = 131 + WebMessageInfo_ADMIN_REVOKE WebMessageInfo_StubType = 132 + WebMessageInfo_GROUP_INVITE_LINK_GROWTH_LOCKED WebMessageInfo_StubType = 133 + WebMessageInfo_COMMUNITY_LINK_PARENT_GROUP WebMessageInfo_StubType = 134 + WebMessageInfo_COMMUNITY_LINK_SIBLING_GROUP WebMessageInfo_StubType = 135 + WebMessageInfo_COMMUNITY_LINK_SUB_GROUP WebMessageInfo_StubType = 136 + WebMessageInfo_COMMUNITY_UNLINK_PARENT_GROUP WebMessageInfo_StubType = 137 + WebMessageInfo_COMMUNITY_UNLINK_SIBLING_GROUP WebMessageInfo_StubType = 138 + WebMessageInfo_COMMUNITY_UNLINK_SUB_GROUP WebMessageInfo_StubType = 139 + WebMessageInfo_GROUP_PARTICIPANT_ACCEPT WebMessageInfo_StubType = 140 + WebMessageInfo_GROUP_PARTICIPANT_LINKED_GROUP_JOIN WebMessageInfo_StubType = 141 + WebMessageInfo_COMMUNITY_CREATE WebMessageInfo_StubType = 142 + WebMessageInfo_EPHEMERAL_KEEP_IN_CHAT WebMessageInfo_StubType = 143 + WebMessageInfo_GROUP_MEMBERSHIP_JOIN_APPROVAL_REQUEST WebMessageInfo_StubType = 144 + WebMessageInfo_GROUP_MEMBERSHIP_JOIN_APPROVAL_MODE WebMessageInfo_StubType = 145 + WebMessageInfo_INTEGRITY_UNLINK_PARENT_GROUP WebMessageInfo_StubType = 146 + WebMessageInfo_COMMUNITY_PARTICIPANT_PROMOTE WebMessageInfo_StubType = 147 + WebMessageInfo_COMMUNITY_PARTICIPANT_DEMOTE WebMessageInfo_StubType = 148 + WebMessageInfo_COMMUNITY_PARENT_GROUP_DELETED WebMessageInfo_StubType = 149 + WebMessageInfo_COMMUNITY_LINK_PARENT_GROUP_MEMBERSHIP_APPROVAL WebMessageInfo_StubType = 150 + WebMessageInfo_GROUP_PARTICIPANT_JOINED_GROUP_AND_PARENT_GROUP WebMessageInfo_StubType = 151 + WebMessageInfo_MASKED_THREAD_CREATED WebMessageInfo_StubType = 152 + WebMessageInfo_MASKED_THREAD_UNMASKED WebMessageInfo_StubType = 153 + WebMessageInfo_BIZ_CHAT_ASSIGNMENT WebMessageInfo_StubType = 154 + WebMessageInfo_CHAT_PSA WebMessageInfo_StubType = 155 + WebMessageInfo_CHAT_POLL_CREATION_MESSAGE WebMessageInfo_StubType = 156 + WebMessageInfo_CAG_MASKED_THREAD_CREATED WebMessageInfo_StubType = 157 + WebMessageInfo_COMMUNITY_PARENT_GROUP_SUBJECT_CHANGED WebMessageInfo_StubType = 158 + WebMessageInfo_CAG_INVITE_AUTO_ADD WebMessageInfo_StubType = 159 + WebMessageInfo_BIZ_CHAT_ASSIGNMENT_UNASSIGN WebMessageInfo_StubType = 160 + WebMessageInfo_CAG_INVITE_AUTO_JOINED WebMessageInfo_StubType = 161 +) + +// Enum value maps for WebMessageInfo_StubType. +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", + 44: "GROUP_ANNOUNCE_MODE_MESSAGE_BOUNCE", + 45: "CALL_MISSED_GROUP_VOICE", + 46: "CALL_MISSED_GROUP_VIDEO", + 47: "PAYMENT_CIPHERTEXT", + 48: "PAYMENT_FUTUREPROOF", + 49: "PAYMENT_TRANSACTION_STATUS_UPDATE_FAILED", + 50: "PAYMENT_TRANSACTION_STATUS_UPDATE_REFUNDED", + 51: "PAYMENT_TRANSACTION_STATUS_UPDATE_REFUND_FAILED", + 52: "PAYMENT_TRANSACTION_STATUS_RECEIVER_PENDING_SETUP", + 53: "PAYMENT_TRANSACTION_STATUS_RECEIVER_SUCCESS_AFTER_HICCUP", + 54: "PAYMENT_ACTION_ACCOUNT_SETUP_REMINDER", + 55: "PAYMENT_ACTION_SEND_PAYMENT_REMINDER", + 56: "PAYMENT_ACTION_SEND_PAYMENT_INVITATION", + 57: "PAYMENT_ACTION_REQUEST_DECLINED", + 58: "PAYMENT_ACTION_REQUEST_EXPIRED", + 59: "PAYMENT_ACTION_REQUEST_CANCELLED", + 60: "BIZ_VERIFIED_TRANSITION_TOP_TO_BOTTOM", + 61: "BIZ_VERIFIED_TRANSITION_BOTTOM_TO_TOP", + 62: "BIZ_INTRO_TOP", + 63: "BIZ_INTRO_BOTTOM", + 64: "BIZ_NAME_CHANGE", + 65: "BIZ_MOVE_TO_CONSUMER_APP", + 66: "BIZ_TWO_TIER_MIGRATION_TOP", + 67: "BIZ_TWO_TIER_MIGRATION_BOTTOM", + 68: "OVERSIZED", + 69: "GROUP_CHANGE_NO_FREQUENTLY_FORWARDED", + 70: "GROUP_V4_ADD_INVITE_SENT", + 71: "GROUP_PARTICIPANT_ADD_REQUEST_JOIN", + 72: "CHANGE_EPHEMERAL_SETTING", + 73: "E2E_DEVICE_CHANGED", + 74: "VIEWED_ONCE", + 75: "E2E_ENCRYPTED_NOW", + 76: "BLUE_MSG_BSP_FB_TO_BSP_PREMISE", + 77: "BLUE_MSG_BSP_FB_TO_SELF_FB", + 78: "BLUE_MSG_BSP_FB_TO_SELF_PREMISE", + 79: "BLUE_MSG_BSP_FB_UNVERIFIED", + 80: "BLUE_MSG_BSP_FB_UNVERIFIED_TO_SELF_PREMISE_VERIFIED", + 81: "BLUE_MSG_BSP_FB_VERIFIED", + 82: "BLUE_MSG_BSP_FB_VERIFIED_TO_SELF_PREMISE_UNVERIFIED", + 83: "BLUE_MSG_BSP_PREMISE_TO_SELF_PREMISE", + 84: "BLUE_MSG_BSP_PREMISE_UNVERIFIED", + 85: "BLUE_MSG_BSP_PREMISE_UNVERIFIED_TO_SELF_PREMISE_VERIFIED", + 86: "BLUE_MSG_BSP_PREMISE_VERIFIED", + 87: "BLUE_MSG_BSP_PREMISE_VERIFIED_TO_SELF_PREMISE_UNVERIFIED", + 88: "BLUE_MSG_CONSUMER_TO_BSP_FB_UNVERIFIED", + 89: "BLUE_MSG_CONSUMER_TO_BSP_PREMISE_UNVERIFIED", + 90: "BLUE_MSG_CONSUMER_TO_SELF_FB_UNVERIFIED", + 91: "BLUE_MSG_CONSUMER_TO_SELF_PREMISE_UNVERIFIED", + 92: "BLUE_MSG_SELF_FB_TO_BSP_PREMISE", + 93: "BLUE_MSG_SELF_FB_TO_SELF_PREMISE", + 94: "BLUE_MSG_SELF_FB_UNVERIFIED", + 95: "BLUE_MSG_SELF_FB_UNVERIFIED_TO_SELF_PREMISE_VERIFIED", + 96: "BLUE_MSG_SELF_FB_VERIFIED", + 97: "BLUE_MSG_SELF_FB_VERIFIED_TO_SELF_PREMISE_UNVERIFIED", + 98: "BLUE_MSG_SELF_PREMISE_TO_BSP_PREMISE", + 99: "BLUE_MSG_SELF_PREMISE_UNVERIFIED", + 100: "BLUE_MSG_SELF_PREMISE_VERIFIED", + 101: "BLUE_MSG_TO_BSP_FB", + 102: "BLUE_MSG_TO_CONSUMER", + 103: "BLUE_MSG_TO_SELF_FB", + 104: "BLUE_MSG_UNVERIFIED_TO_BSP_FB_VERIFIED", + 105: "BLUE_MSG_UNVERIFIED_TO_BSP_PREMISE_VERIFIED", + 106: "BLUE_MSG_UNVERIFIED_TO_SELF_FB_VERIFIED", + 107: "BLUE_MSG_UNVERIFIED_TO_VERIFIED", + 108: "BLUE_MSG_VERIFIED_TO_BSP_FB_UNVERIFIED", + 109: "BLUE_MSG_VERIFIED_TO_BSP_PREMISE_UNVERIFIED", + 110: "BLUE_MSG_VERIFIED_TO_SELF_FB_UNVERIFIED", + 111: "BLUE_MSG_VERIFIED_TO_UNVERIFIED", + 112: "BLUE_MSG_BSP_FB_UNVERIFIED_TO_BSP_PREMISE_VERIFIED", + 113: "BLUE_MSG_BSP_FB_UNVERIFIED_TO_SELF_FB_VERIFIED", + 114: "BLUE_MSG_BSP_FB_VERIFIED_TO_BSP_PREMISE_UNVERIFIED", + 115: "BLUE_MSG_BSP_FB_VERIFIED_TO_SELF_FB_UNVERIFIED", + 116: "BLUE_MSG_SELF_FB_UNVERIFIED_TO_BSP_PREMISE_VERIFIED", + 117: "BLUE_MSG_SELF_FB_VERIFIED_TO_BSP_PREMISE_UNVERIFIED", + 118: "E2E_IDENTITY_UNAVAILABLE", + 119: "GROUP_CREATING", + 120: "GROUP_CREATE_FAILED", + 121: "GROUP_BOUNCED", + 122: "BLOCK_CONTACT", + 123: "EPHEMERAL_SETTING_NOT_APPLIED", + 124: "SYNC_FAILED", + 125: "SYNCING", + 126: "BIZ_PRIVACY_MODE_INIT_FB", + 127: "BIZ_PRIVACY_MODE_INIT_BSP", + 128: "BIZ_PRIVACY_MODE_TO_FB", + 129: "BIZ_PRIVACY_MODE_TO_BSP", + 130: "DISAPPEARING_MODE", + 131: "E2E_DEVICE_FETCH_FAILED", + 132: "ADMIN_REVOKE", + 133: "GROUP_INVITE_LINK_GROWTH_LOCKED", + 134: "COMMUNITY_LINK_PARENT_GROUP", + 135: "COMMUNITY_LINK_SIBLING_GROUP", + 136: "COMMUNITY_LINK_SUB_GROUP", + 137: "COMMUNITY_UNLINK_PARENT_GROUP", + 138: "COMMUNITY_UNLINK_SIBLING_GROUP", + 139: "COMMUNITY_UNLINK_SUB_GROUP", + 140: "GROUP_PARTICIPANT_ACCEPT", + 141: "GROUP_PARTICIPANT_LINKED_GROUP_JOIN", + 142: "COMMUNITY_CREATE", + 143: "EPHEMERAL_KEEP_IN_CHAT", + 144: "GROUP_MEMBERSHIP_JOIN_APPROVAL_REQUEST", + 145: "GROUP_MEMBERSHIP_JOIN_APPROVAL_MODE", + 146: "INTEGRITY_UNLINK_PARENT_GROUP", + 147: "COMMUNITY_PARTICIPANT_PROMOTE", + 148: "COMMUNITY_PARTICIPANT_DEMOTE", + 149: "COMMUNITY_PARENT_GROUP_DELETED", + 150: "COMMUNITY_LINK_PARENT_GROUP_MEMBERSHIP_APPROVAL", + 151: "GROUP_PARTICIPANT_JOINED_GROUP_AND_PARENT_GROUP", + 152: "MASKED_THREAD_CREATED", + 153: "MASKED_THREAD_UNMASKED", + 154: "BIZ_CHAT_ASSIGNMENT", + 155: "CHAT_PSA", + 156: "CHAT_POLL_CREATION_MESSAGE", + 157: "CAG_MASKED_THREAD_CREATED", + 158: "COMMUNITY_PARENT_GROUP_SUBJECT_CHANGED", + 159: "CAG_INVITE_AUTO_ADD", + 160: "BIZ_CHAT_ASSIGNMENT_UNASSIGN", + 161: "CAG_INVITE_AUTO_JOINED", + } + 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, + "GROUP_ANNOUNCE_MODE_MESSAGE_BOUNCE": 44, + "CALL_MISSED_GROUP_VOICE": 45, + "CALL_MISSED_GROUP_VIDEO": 46, + "PAYMENT_CIPHERTEXT": 47, + "PAYMENT_FUTUREPROOF": 48, + "PAYMENT_TRANSACTION_STATUS_UPDATE_FAILED": 49, + "PAYMENT_TRANSACTION_STATUS_UPDATE_REFUNDED": 50, + "PAYMENT_TRANSACTION_STATUS_UPDATE_REFUND_FAILED": 51, + "PAYMENT_TRANSACTION_STATUS_RECEIVER_PENDING_SETUP": 52, + "PAYMENT_TRANSACTION_STATUS_RECEIVER_SUCCESS_AFTER_HICCUP": 53, + "PAYMENT_ACTION_ACCOUNT_SETUP_REMINDER": 54, + "PAYMENT_ACTION_SEND_PAYMENT_REMINDER": 55, + "PAYMENT_ACTION_SEND_PAYMENT_INVITATION": 56, + "PAYMENT_ACTION_REQUEST_DECLINED": 57, + "PAYMENT_ACTION_REQUEST_EXPIRED": 58, + "PAYMENT_ACTION_REQUEST_CANCELLED": 59, + "BIZ_VERIFIED_TRANSITION_TOP_TO_BOTTOM": 60, + "BIZ_VERIFIED_TRANSITION_BOTTOM_TO_TOP": 61, + "BIZ_INTRO_TOP": 62, + "BIZ_INTRO_BOTTOM": 63, + "BIZ_NAME_CHANGE": 64, + "BIZ_MOVE_TO_CONSUMER_APP": 65, + "BIZ_TWO_TIER_MIGRATION_TOP": 66, + "BIZ_TWO_TIER_MIGRATION_BOTTOM": 67, + "OVERSIZED": 68, + "GROUP_CHANGE_NO_FREQUENTLY_FORWARDED": 69, + "GROUP_V4_ADD_INVITE_SENT": 70, + "GROUP_PARTICIPANT_ADD_REQUEST_JOIN": 71, + "CHANGE_EPHEMERAL_SETTING": 72, + "E2E_DEVICE_CHANGED": 73, + "VIEWED_ONCE": 74, + "E2E_ENCRYPTED_NOW": 75, + "BLUE_MSG_BSP_FB_TO_BSP_PREMISE": 76, + "BLUE_MSG_BSP_FB_TO_SELF_FB": 77, + "BLUE_MSG_BSP_FB_TO_SELF_PREMISE": 78, + "BLUE_MSG_BSP_FB_UNVERIFIED": 79, + "BLUE_MSG_BSP_FB_UNVERIFIED_TO_SELF_PREMISE_VERIFIED": 80, + "BLUE_MSG_BSP_FB_VERIFIED": 81, + "BLUE_MSG_BSP_FB_VERIFIED_TO_SELF_PREMISE_UNVERIFIED": 82, + "BLUE_MSG_BSP_PREMISE_TO_SELF_PREMISE": 83, + "BLUE_MSG_BSP_PREMISE_UNVERIFIED": 84, + "BLUE_MSG_BSP_PREMISE_UNVERIFIED_TO_SELF_PREMISE_VERIFIED": 85, + "BLUE_MSG_BSP_PREMISE_VERIFIED": 86, + "BLUE_MSG_BSP_PREMISE_VERIFIED_TO_SELF_PREMISE_UNVERIFIED": 87, + "BLUE_MSG_CONSUMER_TO_BSP_FB_UNVERIFIED": 88, + "BLUE_MSG_CONSUMER_TO_BSP_PREMISE_UNVERIFIED": 89, + "BLUE_MSG_CONSUMER_TO_SELF_FB_UNVERIFIED": 90, + "BLUE_MSG_CONSUMER_TO_SELF_PREMISE_UNVERIFIED": 91, + "BLUE_MSG_SELF_FB_TO_BSP_PREMISE": 92, + "BLUE_MSG_SELF_FB_TO_SELF_PREMISE": 93, + "BLUE_MSG_SELF_FB_UNVERIFIED": 94, + "BLUE_MSG_SELF_FB_UNVERIFIED_TO_SELF_PREMISE_VERIFIED": 95, + "BLUE_MSG_SELF_FB_VERIFIED": 96, + "BLUE_MSG_SELF_FB_VERIFIED_TO_SELF_PREMISE_UNVERIFIED": 97, + "BLUE_MSG_SELF_PREMISE_TO_BSP_PREMISE": 98, + "BLUE_MSG_SELF_PREMISE_UNVERIFIED": 99, + "BLUE_MSG_SELF_PREMISE_VERIFIED": 100, + "BLUE_MSG_TO_BSP_FB": 101, + "BLUE_MSG_TO_CONSUMER": 102, + "BLUE_MSG_TO_SELF_FB": 103, + "BLUE_MSG_UNVERIFIED_TO_BSP_FB_VERIFIED": 104, + "BLUE_MSG_UNVERIFIED_TO_BSP_PREMISE_VERIFIED": 105, + "BLUE_MSG_UNVERIFIED_TO_SELF_FB_VERIFIED": 106, + "BLUE_MSG_UNVERIFIED_TO_VERIFIED": 107, + "BLUE_MSG_VERIFIED_TO_BSP_FB_UNVERIFIED": 108, + "BLUE_MSG_VERIFIED_TO_BSP_PREMISE_UNVERIFIED": 109, + "BLUE_MSG_VERIFIED_TO_SELF_FB_UNVERIFIED": 110, + "BLUE_MSG_VERIFIED_TO_UNVERIFIED": 111, + "BLUE_MSG_BSP_FB_UNVERIFIED_TO_BSP_PREMISE_VERIFIED": 112, + "BLUE_MSG_BSP_FB_UNVERIFIED_TO_SELF_FB_VERIFIED": 113, + "BLUE_MSG_BSP_FB_VERIFIED_TO_BSP_PREMISE_UNVERIFIED": 114, + "BLUE_MSG_BSP_FB_VERIFIED_TO_SELF_FB_UNVERIFIED": 115, + "BLUE_MSG_SELF_FB_UNVERIFIED_TO_BSP_PREMISE_VERIFIED": 116, + "BLUE_MSG_SELF_FB_VERIFIED_TO_BSP_PREMISE_UNVERIFIED": 117, + "E2E_IDENTITY_UNAVAILABLE": 118, + "GROUP_CREATING": 119, + "GROUP_CREATE_FAILED": 120, + "GROUP_BOUNCED": 121, + "BLOCK_CONTACT": 122, + "EPHEMERAL_SETTING_NOT_APPLIED": 123, + "SYNC_FAILED": 124, + "SYNCING": 125, + "BIZ_PRIVACY_MODE_INIT_FB": 126, + "BIZ_PRIVACY_MODE_INIT_BSP": 127, + "BIZ_PRIVACY_MODE_TO_FB": 128, + "BIZ_PRIVACY_MODE_TO_BSP": 129, + "DISAPPEARING_MODE": 130, + "E2E_DEVICE_FETCH_FAILED": 131, + "ADMIN_REVOKE": 132, + "GROUP_INVITE_LINK_GROWTH_LOCKED": 133, + "COMMUNITY_LINK_PARENT_GROUP": 134, + "COMMUNITY_LINK_SIBLING_GROUP": 135, + "COMMUNITY_LINK_SUB_GROUP": 136, + "COMMUNITY_UNLINK_PARENT_GROUP": 137, + "COMMUNITY_UNLINK_SIBLING_GROUP": 138, + "COMMUNITY_UNLINK_SUB_GROUP": 139, + "GROUP_PARTICIPANT_ACCEPT": 140, + "GROUP_PARTICIPANT_LINKED_GROUP_JOIN": 141, + "COMMUNITY_CREATE": 142, + "EPHEMERAL_KEEP_IN_CHAT": 143, + "GROUP_MEMBERSHIP_JOIN_APPROVAL_REQUEST": 144, + "GROUP_MEMBERSHIP_JOIN_APPROVAL_MODE": 145, + "INTEGRITY_UNLINK_PARENT_GROUP": 146, + "COMMUNITY_PARTICIPANT_PROMOTE": 147, + "COMMUNITY_PARTICIPANT_DEMOTE": 148, + "COMMUNITY_PARENT_GROUP_DELETED": 149, + "COMMUNITY_LINK_PARENT_GROUP_MEMBERSHIP_APPROVAL": 150, + "GROUP_PARTICIPANT_JOINED_GROUP_AND_PARENT_GROUP": 151, + "MASKED_THREAD_CREATED": 152, + "MASKED_THREAD_UNMASKED": 153, + "BIZ_CHAT_ASSIGNMENT": 154, + "CHAT_PSA": 155, + "CHAT_POLL_CREATION_MESSAGE": 156, + "CAG_MASKED_THREAD_CREATED": 157, + "COMMUNITY_PARENT_GROUP_SUBJECT_CHANGED": 158, + "CAG_INVITE_AUTO_ADD": 159, + "BIZ_CHAT_ASSIGNMENT_UNASSIGN": 160, + "CAG_INVITE_AUTO_JOINED": 161, + } +) + +func (x WebMessageInfo_StubType) Enum() *WebMessageInfo_StubType { + p := new(WebMessageInfo_StubType) + *p = x + return p +} + +func (x WebMessageInfo_StubType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (WebMessageInfo_StubType) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[47].Descriptor() +} + +func (WebMessageInfo_StubType) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[47] +} + +func (x WebMessageInfo_StubType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *WebMessageInfo_StubType) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = WebMessageInfo_StubType(num) + return nil +} + +// Deprecated: Use WebMessageInfo_StubType.Descriptor instead. +func (WebMessageInfo_StubType) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{150, 0} +} + +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 +) + +// Enum value maps for WebMessageInfo_Status. +var ( + WebMessageInfo_Status_name = map[int32]string{ + 0: "ERROR", + 1: "PENDING", + 2: "SERVER_ACK", + 3: "DELIVERY_ACK", + 4: "READ", + 5: "PLAYED", + } + 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 protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (WebMessageInfo_Status) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[48].Descriptor() +} + +func (WebMessageInfo_Status) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[48] +} + +func (x WebMessageInfo_Status) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *WebMessageInfo_Status) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = WebMessageInfo_Status(num) + return nil +} + +// Deprecated: Use WebMessageInfo_Status.Descriptor instead. +func (WebMessageInfo_Status) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{150, 1} +} + +type WebMessageInfo_BizPrivacyStatus int32 + +const ( + WebMessageInfo_E2EE WebMessageInfo_BizPrivacyStatus = 0 + WebMessageInfo_FB WebMessageInfo_BizPrivacyStatus = 2 + WebMessageInfo_BSP WebMessageInfo_BizPrivacyStatus = 1 + WebMessageInfo_BSP_AND_FB WebMessageInfo_BizPrivacyStatus = 3 +) + +// Enum value maps for WebMessageInfo_BizPrivacyStatus. +var ( + WebMessageInfo_BizPrivacyStatus_name = map[int32]string{ + 0: "E2EE", + 2: "FB", + 1: "BSP", + 3: "BSP_AND_FB", + } + WebMessageInfo_BizPrivacyStatus_value = map[string]int32{ + "E2EE": 0, + "FB": 2, + "BSP": 1, + "BSP_AND_FB": 3, + } +) + +func (x WebMessageInfo_BizPrivacyStatus) Enum() *WebMessageInfo_BizPrivacyStatus { + p := new(WebMessageInfo_BizPrivacyStatus) + *p = x + return p +} + +func (x WebMessageInfo_BizPrivacyStatus) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (WebMessageInfo_BizPrivacyStatus) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[49].Descriptor() +} + +func (WebMessageInfo_BizPrivacyStatus) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[49] +} + +func (x WebMessageInfo_BizPrivacyStatus) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *WebMessageInfo_BizPrivacyStatus) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = WebMessageInfo_BizPrivacyStatus(num) + return nil +} + +// Deprecated: Use WebMessageInfo_BizPrivacyStatus.Descriptor instead. +func (WebMessageInfo_BizPrivacyStatus) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{150, 2} +} + +type WebFeatures_Flag int32 + +const ( + WebFeatures_NOT_STARTED WebFeatures_Flag = 0 + WebFeatures_FORCE_UPGRADE WebFeatures_Flag = 1 + WebFeatures_DEVELOPMENT WebFeatures_Flag = 2 + WebFeatures_PRODUCTION WebFeatures_Flag = 3 +) + +// Enum value maps for WebFeatures_Flag. +var ( + WebFeatures_Flag_name = map[int32]string{ + 0: "NOT_STARTED", + 1: "FORCE_UPGRADE", + 2: "DEVELOPMENT", + 3: "PRODUCTION", + } + WebFeatures_Flag_value = map[string]int32{ + "NOT_STARTED": 0, + "FORCE_UPGRADE": 1, + "DEVELOPMENT": 2, + "PRODUCTION": 3, + } +) + +func (x WebFeatures_Flag) Enum() *WebFeatures_Flag { + p := new(WebFeatures_Flag) + *p = x + return p +} + +func (x WebFeatures_Flag) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (WebFeatures_Flag) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[50].Descriptor() +} + +func (WebFeatures_Flag) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[50] +} + +func (x WebFeatures_Flag) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *WebFeatures_Flag) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = WebFeatures_Flag(num) + return nil +} + +// Deprecated: Use WebFeatures_Flag.Descriptor instead. +func (WebFeatures_Flag) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{151, 0} +} + +type PaymentInfo_TxnStatus int32 + +const ( + PaymentInfo_UNKNOWN PaymentInfo_TxnStatus = 0 + PaymentInfo_PENDING_SETUP PaymentInfo_TxnStatus = 1 + PaymentInfo_PENDING_RECEIVER_SETUP PaymentInfo_TxnStatus = 2 + PaymentInfo_INIT PaymentInfo_TxnStatus = 3 + PaymentInfo_SUCCESS PaymentInfo_TxnStatus = 4 + PaymentInfo_COMPLETED PaymentInfo_TxnStatus = 5 + PaymentInfo_FAILED PaymentInfo_TxnStatus = 6 + PaymentInfo_FAILED_RISK PaymentInfo_TxnStatus = 7 + PaymentInfo_FAILED_PROCESSING PaymentInfo_TxnStatus = 8 + PaymentInfo_FAILED_RECEIVER_PROCESSING PaymentInfo_TxnStatus = 9 + PaymentInfo_FAILED_DA PaymentInfo_TxnStatus = 10 + PaymentInfo_FAILED_DA_FINAL PaymentInfo_TxnStatus = 11 + PaymentInfo_REFUNDED_TXN PaymentInfo_TxnStatus = 12 + PaymentInfo_REFUND_FAILED PaymentInfo_TxnStatus = 13 + PaymentInfo_REFUND_FAILED_PROCESSING PaymentInfo_TxnStatus = 14 + PaymentInfo_REFUND_FAILED_DA PaymentInfo_TxnStatus = 15 + PaymentInfo_EXPIRED_TXN PaymentInfo_TxnStatus = 16 + PaymentInfo_AUTH_CANCELED PaymentInfo_TxnStatus = 17 + PaymentInfo_AUTH_CANCEL_FAILED_PROCESSING PaymentInfo_TxnStatus = 18 + PaymentInfo_AUTH_CANCEL_FAILED PaymentInfo_TxnStatus = 19 + PaymentInfo_COLLECT_INIT PaymentInfo_TxnStatus = 20 + PaymentInfo_COLLECT_SUCCESS PaymentInfo_TxnStatus = 21 + PaymentInfo_COLLECT_FAILED PaymentInfo_TxnStatus = 22 + PaymentInfo_COLLECT_FAILED_RISK PaymentInfo_TxnStatus = 23 + PaymentInfo_COLLECT_REJECTED PaymentInfo_TxnStatus = 24 + PaymentInfo_COLLECT_EXPIRED PaymentInfo_TxnStatus = 25 + PaymentInfo_COLLECT_CANCELED PaymentInfo_TxnStatus = 26 + PaymentInfo_COLLECT_CANCELLING PaymentInfo_TxnStatus = 27 + PaymentInfo_IN_REVIEW PaymentInfo_TxnStatus = 28 + PaymentInfo_REVERSAL_SUCCESS PaymentInfo_TxnStatus = 29 + PaymentInfo_REVERSAL_PENDING PaymentInfo_TxnStatus = 30 + PaymentInfo_REFUND_PENDING PaymentInfo_TxnStatus = 31 +) + +// Enum value maps for PaymentInfo_TxnStatus. +var ( + PaymentInfo_TxnStatus_name = map[int32]string{ + 0: "UNKNOWN", + 1: "PENDING_SETUP", + 2: "PENDING_RECEIVER_SETUP", + 3: "INIT", + 4: "SUCCESS", + 5: "COMPLETED", + 6: "FAILED", + 7: "FAILED_RISK", + 8: "FAILED_PROCESSING", + 9: "FAILED_RECEIVER_PROCESSING", + 10: "FAILED_DA", + 11: "FAILED_DA_FINAL", + 12: "REFUNDED_TXN", + 13: "REFUND_FAILED", + 14: "REFUND_FAILED_PROCESSING", + 15: "REFUND_FAILED_DA", + 16: "EXPIRED_TXN", + 17: "AUTH_CANCELED", + 18: "AUTH_CANCEL_FAILED_PROCESSING", + 19: "AUTH_CANCEL_FAILED", + 20: "COLLECT_INIT", + 21: "COLLECT_SUCCESS", + 22: "COLLECT_FAILED", + 23: "COLLECT_FAILED_RISK", + 24: "COLLECT_REJECTED", + 25: "COLLECT_EXPIRED", + 26: "COLLECT_CANCELED", + 27: "COLLECT_CANCELLING", + 28: "IN_REVIEW", + 29: "REVERSAL_SUCCESS", + 30: "REVERSAL_PENDING", + 31: "REFUND_PENDING", + } + PaymentInfo_TxnStatus_value = map[string]int32{ + "UNKNOWN": 0, + "PENDING_SETUP": 1, + "PENDING_RECEIVER_SETUP": 2, + "INIT": 3, + "SUCCESS": 4, + "COMPLETED": 5, + "FAILED": 6, + "FAILED_RISK": 7, + "FAILED_PROCESSING": 8, + "FAILED_RECEIVER_PROCESSING": 9, + "FAILED_DA": 10, + "FAILED_DA_FINAL": 11, + "REFUNDED_TXN": 12, + "REFUND_FAILED": 13, + "REFUND_FAILED_PROCESSING": 14, + "REFUND_FAILED_DA": 15, + "EXPIRED_TXN": 16, + "AUTH_CANCELED": 17, + "AUTH_CANCEL_FAILED_PROCESSING": 18, + "AUTH_CANCEL_FAILED": 19, + "COLLECT_INIT": 20, + "COLLECT_SUCCESS": 21, + "COLLECT_FAILED": 22, + "COLLECT_FAILED_RISK": 23, + "COLLECT_REJECTED": 24, + "COLLECT_EXPIRED": 25, + "COLLECT_CANCELED": 26, + "COLLECT_CANCELLING": 27, + "IN_REVIEW": 28, + "REVERSAL_SUCCESS": 29, + "REVERSAL_PENDING": 30, + "REFUND_PENDING": 31, + } +) + +func (x PaymentInfo_TxnStatus) Enum() *PaymentInfo_TxnStatus { + p := new(PaymentInfo_TxnStatus) + *p = x + return p +} + +func (x PaymentInfo_TxnStatus) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (PaymentInfo_TxnStatus) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[51].Descriptor() +} + +func (PaymentInfo_TxnStatus) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[51] +} + +func (x PaymentInfo_TxnStatus) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *PaymentInfo_TxnStatus) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = PaymentInfo_TxnStatus(num) + return nil +} + +// Deprecated: Use PaymentInfo_TxnStatus.Descriptor instead. +func (PaymentInfo_TxnStatus) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{158, 0} +} + +type PaymentInfo_Status int32 + +const ( + PaymentInfo_UNKNOWN_STATUS PaymentInfo_Status = 0 + PaymentInfo_PROCESSING PaymentInfo_Status = 1 + PaymentInfo_SENT PaymentInfo_Status = 2 + PaymentInfo_NEED_TO_ACCEPT PaymentInfo_Status = 3 + PaymentInfo_COMPLETE PaymentInfo_Status = 4 + PaymentInfo_COULD_NOT_COMPLETE PaymentInfo_Status = 5 + PaymentInfo_REFUNDED PaymentInfo_Status = 6 + PaymentInfo_EXPIRED PaymentInfo_Status = 7 + PaymentInfo_REJECTED PaymentInfo_Status = 8 + PaymentInfo_CANCELLED PaymentInfo_Status = 9 + PaymentInfo_WAITING_FOR_PAYER PaymentInfo_Status = 10 + PaymentInfo_WAITING PaymentInfo_Status = 11 +) + +// Enum value maps for PaymentInfo_Status. +var ( + PaymentInfo_Status_name = map[int32]string{ + 0: "UNKNOWN_STATUS", + 1: "PROCESSING", + 2: "SENT", + 3: "NEED_TO_ACCEPT", + 4: "COMPLETE", + 5: "COULD_NOT_COMPLETE", + 6: "REFUNDED", + 7: "EXPIRED", + 8: "REJECTED", + 9: "CANCELLED", + 10: "WAITING_FOR_PAYER", + 11: "WAITING", + } + PaymentInfo_Status_value = map[string]int32{ + "UNKNOWN_STATUS": 0, + "PROCESSING": 1, + "SENT": 2, + "NEED_TO_ACCEPT": 3, + "COMPLETE": 4, + "COULD_NOT_COMPLETE": 5, + "REFUNDED": 6, + "EXPIRED": 7, + "REJECTED": 8, + "CANCELLED": 9, + "WAITING_FOR_PAYER": 10, + "WAITING": 11, + } +) + +func (x PaymentInfo_Status) Enum() *PaymentInfo_Status { + p := new(PaymentInfo_Status) + *p = x + return p +} + +func (x PaymentInfo_Status) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (PaymentInfo_Status) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[52].Descriptor() +} + +func (PaymentInfo_Status) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[52] +} + +func (x PaymentInfo_Status) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *PaymentInfo_Status) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = PaymentInfo_Status(num) + return nil +} + +// Deprecated: Use PaymentInfo_Status.Descriptor instead. +func (PaymentInfo_Status) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{158, 1} +} + +type PaymentInfo_Currency int32 + +const ( + PaymentInfo_UNKNOWN_CURRENCY PaymentInfo_Currency = 0 + PaymentInfo_INR PaymentInfo_Currency = 1 +) + +// Enum value maps for PaymentInfo_Currency. +var ( + PaymentInfo_Currency_name = map[int32]string{ + 0: "UNKNOWN_CURRENCY", + 1: "INR", + } + PaymentInfo_Currency_value = map[string]int32{ + "UNKNOWN_CURRENCY": 0, + "INR": 1, + } +) + +func (x PaymentInfo_Currency) Enum() *PaymentInfo_Currency { + p := new(PaymentInfo_Currency) + *p = x + return p +} + +func (x PaymentInfo_Currency) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (PaymentInfo_Currency) Descriptor() protoreflect.EnumDescriptor { + return file_binary_proto_def_proto_enumTypes[53].Descriptor() +} + +func (PaymentInfo_Currency) Type() protoreflect.EnumType { + return &file_binary_proto_def_proto_enumTypes[53] +} + +func (x PaymentInfo_Currency) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Do not use. +func (x *PaymentInfo_Currency) UnmarshalJSON(b []byte) error { + num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b) + if err != nil { + return err + } + *x = PaymentInfo_Currency(num) + return nil +} + +// Deprecated: Use PaymentInfo_Currency.Descriptor instead. +func (PaymentInfo_Currency) EnumDescriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{158, 2} +} + +type ADVSignedKeyIndexList struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Details []byte `protobuf:"bytes,1,opt,name=details" json:"details,omitempty"` + AccountSignature []byte `protobuf:"bytes,2,opt,name=accountSignature" json:"accountSignature,omitempty"` +} + +func (x *ADVSignedKeyIndexList) Reset() { + *x = ADVSignedKeyIndexList{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ADVSignedKeyIndexList) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ADVSignedKeyIndexList) ProtoMessage() {} + +func (x *ADVSignedKeyIndexList) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ADVSignedKeyIndexList.ProtoReflect.Descriptor instead. +func (*ADVSignedKeyIndexList) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{0} +} + +func (x *ADVSignedKeyIndexList) GetDetails() []byte { + if x != nil { + return x.Details + } + return nil +} + +func (x *ADVSignedKeyIndexList) GetAccountSignature() []byte { + if x != nil { + return x.AccountSignature + } + return nil +} + +type ADVSignedDeviceIdentity struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Details []byte `protobuf:"bytes,1,opt,name=details" json:"details,omitempty"` + AccountSignatureKey []byte `protobuf:"bytes,2,opt,name=accountSignatureKey" json:"accountSignatureKey,omitempty"` + AccountSignature []byte `protobuf:"bytes,3,opt,name=accountSignature" json:"accountSignature,omitempty"` + DeviceSignature []byte `protobuf:"bytes,4,opt,name=deviceSignature" json:"deviceSignature,omitempty"` +} + +func (x *ADVSignedDeviceIdentity) Reset() { + *x = ADVSignedDeviceIdentity{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ADVSignedDeviceIdentity) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ADVSignedDeviceIdentity) ProtoMessage() {} + +func (x *ADVSignedDeviceIdentity) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ADVSignedDeviceIdentity.ProtoReflect.Descriptor instead. +func (*ADVSignedDeviceIdentity) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{1} +} + +func (x *ADVSignedDeviceIdentity) GetDetails() []byte { + if x != nil { + return x.Details + } + return nil +} + +func (x *ADVSignedDeviceIdentity) GetAccountSignatureKey() []byte { + if x != nil { + return x.AccountSignatureKey + } + return nil +} + +func (x *ADVSignedDeviceIdentity) GetAccountSignature() []byte { + if x != nil { + return x.AccountSignature + } + return nil +} + +func (x *ADVSignedDeviceIdentity) GetDeviceSignature() []byte { + if x != nil { + return x.DeviceSignature + } + return nil +} + +type ADVSignedDeviceIdentityHMAC struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Details []byte `protobuf:"bytes,1,opt,name=details" json:"details,omitempty"` + Hmac []byte `protobuf:"bytes,2,opt,name=hmac" json:"hmac,omitempty"` +} + +func (x *ADVSignedDeviceIdentityHMAC) Reset() { + *x = ADVSignedDeviceIdentityHMAC{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ADVSignedDeviceIdentityHMAC) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ADVSignedDeviceIdentityHMAC) ProtoMessage() {} + +func (x *ADVSignedDeviceIdentityHMAC) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ADVSignedDeviceIdentityHMAC.ProtoReflect.Descriptor instead. +func (*ADVSignedDeviceIdentityHMAC) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{2} +} + +func (x *ADVSignedDeviceIdentityHMAC) GetDetails() []byte { + if x != nil { + return x.Details + } + return nil +} + +func (x *ADVSignedDeviceIdentityHMAC) GetHmac() []byte { + if x != nil { + return x.Hmac + } + return nil +} + +type ADVKeyIndexList struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RawId *uint32 `protobuf:"varint,1,opt,name=rawId" json:"rawId,omitempty"` + Timestamp *uint64 `protobuf:"varint,2,opt,name=timestamp" json:"timestamp,omitempty"` + CurrentIndex *uint32 `protobuf:"varint,3,opt,name=currentIndex" json:"currentIndex,omitempty"` + ValidIndexes []uint32 `protobuf:"varint,4,rep,packed,name=validIndexes" json:"validIndexes,omitempty"` +} + +func (x *ADVKeyIndexList) Reset() { + *x = ADVKeyIndexList{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ADVKeyIndexList) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ADVKeyIndexList) ProtoMessage() {} + +func (x *ADVKeyIndexList) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ADVKeyIndexList.ProtoReflect.Descriptor instead. +func (*ADVKeyIndexList) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{3} +} + +func (x *ADVKeyIndexList) GetRawId() uint32 { + if x != nil && x.RawId != nil { + return *x.RawId + } + return 0 +} + +func (x *ADVKeyIndexList) GetTimestamp() uint64 { + if x != nil && x.Timestamp != nil { + return *x.Timestamp + } + return 0 +} + +func (x *ADVKeyIndexList) GetCurrentIndex() uint32 { + if x != nil && x.CurrentIndex != nil { + return *x.CurrentIndex + } + return 0 +} + +func (x *ADVKeyIndexList) GetValidIndexes() []uint32 { + if x != nil { + return x.ValidIndexes + } + return nil +} + +type ADVDeviceIdentity struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RawId *uint32 `protobuf:"varint,1,opt,name=rawId" json:"rawId,omitempty"` + Timestamp *uint64 `protobuf:"varint,2,opt,name=timestamp" json:"timestamp,omitempty"` + KeyIndex *uint32 `protobuf:"varint,3,opt,name=keyIndex" json:"keyIndex,omitempty"` +} + +func (x *ADVDeviceIdentity) Reset() { + *x = ADVDeviceIdentity{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ADVDeviceIdentity) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ADVDeviceIdentity) ProtoMessage() {} + +func (x *ADVDeviceIdentity) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ADVDeviceIdentity.ProtoReflect.Descriptor instead. +func (*ADVDeviceIdentity) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{4} +} + +func (x *ADVDeviceIdentity) GetRawId() uint32 { + if x != nil && x.RawId != nil { + return *x.RawId + } + return 0 +} + +func (x *ADVDeviceIdentity) GetTimestamp() uint64 { + if x != nil && x.Timestamp != nil { + return *x.Timestamp + } + return 0 +} + +func (x *ADVDeviceIdentity) GetKeyIndex() uint32 { + if x != nil && x.KeyIndex != nil { + return *x.KeyIndex + } + return 0 +} + +type DeviceProps struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Os *string `protobuf:"bytes,1,opt,name=os" json:"os,omitempty"` + Version *DeviceProps_AppVersion `protobuf:"bytes,2,opt,name=version" json:"version,omitempty"` + PlatformType *DeviceProps_PlatformType `protobuf:"varint,3,opt,name=platformType,enum=proto.DeviceProps_PlatformType" json:"platformType,omitempty"` + RequireFullSync *bool `protobuf:"varint,4,opt,name=requireFullSync" json:"requireFullSync,omitempty"` + HistorySyncConfig *DeviceProps_HistorySyncConfig `protobuf:"bytes,5,opt,name=historySyncConfig" json:"historySyncConfig,omitempty"` +} + +func (x *DeviceProps) Reset() { + *x = DeviceProps{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeviceProps) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeviceProps) ProtoMessage() {} + +func (x *DeviceProps) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeviceProps.ProtoReflect.Descriptor instead. +func (*DeviceProps) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{5} +} + +func (x *DeviceProps) GetOs() string { + if x != nil && x.Os != nil { + return *x.Os + } + return "" +} + +func (x *DeviceProps) GetVersion() *DeviceProps_AppVersion { + if x != nil { + return x.Version + } + return nil +} + +func (x *DeviceProps) GetPlatformType() DeviceProps_PlatformType { + if x != nil && x.PlatformType != nil { + return *x.PlatformType + } + return DeviceProps_UNKNOWN +} + +func (x *DeviceProps) GetRequireFullSync() bool { + if x != nil && x.RequireFullSync != nil { + return *x.RequireFullSync + } + return false +} + +func (x *DeviceProps) GetHistorySyncConfig() *DeviceProps_HistorySyncConfig { + if x != nil { + return x.HistorySyncConfig + } + return nil +} + +type PeerDataOperationRequestResponseMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PeerDataOperationRequestType *PeerDataOperationRequestType `protobuf:"varint,1,opt,name=peerDataOperationRequestType,enum=proto.PeerDataOperationRequestType" json:"peerDataOperationRequestType,omitempty"` + StanzaId *string `protobuf:"bytes,2,opt,name=stanzaId" json:"stanzaId,omitempty"` + PeerDataOperationResult []*PeerDataOperationRequestResponseMessage_PeerDataOperationResult `protobuf:"bytes,3,rep,name=peerDataOperationResult" json:"peerDataOperationResult,omitempty"` +} + +func (x *PeerDataOperationRequestResponseMessage) Reset() { + *x = PeerDataOperationRequestResponseMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PeerDataOperationRequestResponseMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PeerDataOperationRequestResponseMessage) ProtoMessage() {} + +func (x *PeerDataOperationRequestResponseMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PeerDataOperationRequestResponseMessage.ProtoReflect.Descriptor instead. +func (*PeerDataOperationRequestResponseMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{6} +} + +func (x *PeerDataOperationRequestResponseMessage) GetPeerDataOperationRequestType() PeerDataOperationRequestType { + if x != nil && x.PeerDataOperationRequestType != nil { + return *x.PeerDataOperationRequestType + } + return PeerDataOperationRequestType_UPLOAD_STICKER +} + +func (x *PeerDataOperationRequestResponseMessage) GetStanzaId() string { + if x != nil && x.StanzaId != nil { + return *x.StanzaId + } + return "" +} + +func (x *PeerDataOperationRequestResponseMessage) GetPeerDataOperationResult() []*PeerDataOperationRequestResponseMessage_PeerDataOperationResult { + if x != nil { + return x.PeerDataOperationResult + } + return nil +} + +type PeerDataOperationRequestMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PeerDataOperationRequestType *PeerDataOperationRequestType `protobuf:"varint,1,opt,name=peerDataOperationRequestType,enum=proto.PeerDataOperationRequestType" json:"peerDataOperationRequestType,omitempty"` + RequestStickerReupload []*PeerDataOperationRequestMessage_RequestStickerReupload `protobuf:"bytes,2,rep,name=requestStickerReupload" json:"requestStickerReupload,omitempty"` + RequestUrlPreview []*PeerDataOperationRequestMessage_RequestUrlPreview `protobuf:"bytes,3,rep,name=requestUrlPreview" json:"requestUrlPreview,omitempty"` +} + +func (x *PeerDataOperationRequestMessage) Reset() { + *x = PeerDataOperationRequestMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PeerDataOperationRequestMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PeerDataOperationRequestMessage) ProtoMessage() {} + +func (x *PeerDataOperationRequestMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PeerDataOperationRequestMessage.ProtoReflect.Descriptor instead. +func (*PeerDataOperationRequestMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{7} +} + +func (x *PeerDataOperationRequestMessage) GetPeerDataOperationRequestType() PeerDataOperationRequestType { + if x != nil && x.PeerDataOperationRequestType != nil { + return *x.PeerDataOperationRequestType + } + return PeerDataOperationRequestType_UPLOAD_STICKER +} + +func (x *PeerDataOperationRequestMessage) GetRequestStickerReupload() []*PeerDataOperationRequestMessage_RequestStickerReupload { + if x != nil { + return x.RequestStickerReupload + } + return nil +} + +func (x *PeerDataOperationRequestMessage) GetRequestUrlPreview() []*PeerDataOperationRequestMessage_RequestUrlPreview { + if x != nil { + return x.RequestUrlPreview + } + return nil +} + +type PaymentInviteMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ServiceType *PaymentInviteMessage_ServiceType `protobuf:"varint,1,opt,name=serviceType,enum=proto.PaymentInviteMessage_ServiceType" json:"serviceType,omitempty"` + ExpiryTimestamp *int64 `protobuf:"varint,2,opt,name=expiryTimestamp" json:"expiryTimestamp,omitempty"` +} + +func (x *PaymentInviteMessage) Reset() { + *x = PaymentInviteMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PaymentInviteMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PaymentInviteMessage) ProtoMessage() {} + +func (x *PaymentInviteMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PaymentInviteMessage.ProtoReflect.Descriptor instead. +func (*PaymentInviteMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{8} +} + +func (x *PaymentInviteMessage) GetServiceType() PaymentInviteMessage_ServiceType { + if x != nil && x.ServiceType != nil { + return *x.ServiceType + } + return PaymentInviteMessage_UNKNOWN +} + +func (x *PaymentInviteMessage) GetExpiryTimestamp() int64 { + if x != nil && x.ExpiryTimestamp != nil { + return *x.ExpiryTimestamp + } + return 0 +} + +type OrderMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + OrderId *string `protobuf:"bytes,1,opt,name=orderId" json:"orderId,omitempty"` + Thumbnail []byte `protobuf:"bytes,2,opt,name=thumbnail" json:"thumbnail,omitempty"` + ItemCount *int32 `protobuf:"varint,3,opt,name=itemCount" json:"itemCount,omitempty"` + Status *OrderMessage_OrderStatus `protobuf:"varint,4,opt,name=status,enum=proto.OrderMessage_OrderStatus" json:"status,omitempty"` + Surface *OrderMessage_OrderSurface `protobuf:"varint,5,opt,name=surface,enum=proto.OrderMessage_OrderSurface" json:"surface,omitempty"` + Message *string `protobuf:"bytes,6,opt,name=message" json:"message,omitempty"` + OrderTitle *string `protobuf:"bytes,7,opt,name=orderTitle" json:"orderTitle,omitempty"` + SellerJid *string `protobuf:"bytes,8,opt,name=sellerJid" json:"sellerJid,omitempty"` + Token *string `protobuf:"bytes,9,opt,name=token" json:"token,omitempty"` + TotalAmount1000 *int64 `protobuf:"varint,10,opt,name=totalAmount1000" json:"totalAmount1000,omitempty"` + TotalCurrencyCode *string `protobuf:"bytes,11,opt,name=totalCurrencyCode" json:"totalCurrencyCode,omitempty"` + ContextInfo *ContextInfo `protobuf:"bytes,17,opt,name=contextInfo" json:"contextInfo,omitempty"` +} + +func (x *OrderMessage) Reset() { + *x = OrderMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OrderMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OrderMessage) ProtoMessage() {} + +func (x *OrderMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OrderMessage.ProtoReflect.Descriptor instead. +func (*OrderMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{9} +} + +func (x *OrderMessage) GetOrderId() string { + if x != nil && x.OrderId != nil { + return *x.OrderId + } + return "" +} + +func (x *OrderMessage) GetThumbnail() []byte { + if x != nil { + return x.Thumbnail + } + return nil +} + +func (x *OrderMessage) GetItemCount() int32 { + if x != nil && x.ItemCount != nil { + return *x.ItemCount + } + return 0 +} + +func (x *OrderMessage) GetStatus() OrderMessage_OrderStatus { + if x != nil && x.Status != nil { + return *x.Status + } + return OrderMessage_INQUIRY +} + +func (x *OrderMessage) GetSurface() OrderMessage_OrderSurface { + if x != nil && x.Surface != nil { + return *x.Surface + } + return OrderMessage_CATALOG +} + +func (x *OrderMessage) GetMessage() string { + if x != nil && x.Message != nil { + return *x.Message + } + return "" +} + +func (x *OrderMessage) GetOrderTitle() string { + if x != nil && x.OrderTitle != nil { + return *x.OrderTitle + } + return "" +} + +func (x *OrderMessage) GetSellerJid() string { + if x != nil && x.SellerJid != nil { + return *x.SellerJid + } + return "" +} + +func (x *OrderMessage) GetToken() string { + if x != nil && x.Token != nil { + return *x.Token + } + return "" +} + +func (x *OrderMessage) GetTotalAmount1000() int64 { + if x != nil && x.TotalAmount1000 != nil { + return *x.TotalAmount1000 + } + return 0 +} + +func (x *OrderMessage) GetTotalCurrencyCode() string { + if x != nil && x.TotalCurrencyCode != nil { + return *x.TotalCurrencyCode + } + return "" +} + +func (x *OrderMessage) GetContextInfo() *ContextInfo { + if x != nil { + return x.ContextInfo + } + return nil +} + +type LocationMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + 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"` + IsLive *bool `protobuf:"varint,6,opt,name=isLive" json:"isLive,omitempty"` + AccuracyInMeters *uint32 `protobuf:"varint,7,opt,name=accuracyInMeters" json:"accuracyInMeters,omitempty"` + SpeedInMps *float32 `protobuf:"fixed32,8,opt,name=speedInMps" json:"speedInMps,omitempty"` + DegreesClockwiseFromMagneticNorth *uint32 `protobuf:"varint,9,opt,name=degreesClockwiseFromMagneticNorth" json:"degreesClockwiseFromMagneticNorth,omitempty"` + Comment *string `protobuf:"bytes,11,opt,name=comment" json:"comment,omitempty"` + JpegThumbnail []byte `protobuf:"bytes,16,opt,name=jpegThumbnail" json:"jpegThumbnail,omitempty"` + ContextInfo *ContextInfo `protobuf:"bytes,17,opt,name=contextInfo" json:"contextInfo,omitempty"` +} + +func (x *LocationMessage) Reset() { + *x = LocationMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LocationMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LocationMessage) ProtoMessage() {} + +func (x *LocationMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LocationMessage.ProtoReflect.Descriptor instead. +func (*LocationMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{10} +} + +func (x *LocationMessage) GetDegreesLatitude() float64 { + if x != nil && x.DegreesLatitude != nil { + return *x.DegreesLatitude + } + return 0 +} + +func (x *LocationMessage) GetDegreesLongitude() float64 { + if x != nil && x.DegreesLongitude != nil { + return *x.DegreesLongitude + } + return 0 +} + +func (x *LocationMessage) GetName() string { + if x != nil && x.Name != nil { + return *x.Name + } + return "" +} + +func (x *LocationMessage) GetAddress() string { + if x != nil && x.Address != nil { + return *x.Address + } + return "" +} + +func (x *LocationMessage) GetUrl() string { + if x != nil && x.Url != nil { + return *x.Url + } + return "" +} + +func (x *LocationMessage) GetIsLive() bool { + if x != nil && x.IsLive != nil { + return *x.IsLive + } + return false +} + +func (x *LocationMessage) GetAccuracyInMeters() uint32 { + if x != nil && x.AccuracyInMeters != nil { + return *x.AccuracyInMeters + } + return 0 +} + +func (x *LocationMessage) GetSpeedInMps() float32 { + if x != nil && x.SpeedInMps != nil { + return *x.SpeedInMps + } + return 0 +} + +func (x *LocationMessage) GetDegreesClockwiseFromMagneticNorth() uint32 { + if x != nil && x.DegreesClockwiseFromMagneticNorth != nil { + return *x.DegreesClockwiseFromMagneticNorth + } + return 0 +} + +func (x *LocationMessage) GetComment() string { + if x != nil && x.Comment != nil { + return *x.Comment + } + return "" +} + +func (x *LocationMessage) GetJpegThumbnail() []byte { + if x != nil { + return x.JpegThumbnail + } + return nil +} + +func (x *LocationMessage) GetContextInfo() *ContextInfo { + if x != nil { + return x.ContextInfo + } + return nil +} + +type LiveLocationMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + 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"` + TimeOffset *uint32 `protobuf:"varint,8,opt,name=timeOffset" json:"timeOffset,omitempty"` + JpegThumbnail []byte `protobuf:"bytes,16,opt,name=jpegThumbnail" json:"jpegThumbnail,omitempty"` + ContextInfo *ContextInfo `protobuf:"bytes,17,opt,name=contextInfo" json:"contextInfo,omitempty"` +} + +func (x *LiveLocationMessage) Reset() { + *x = LiveLocationMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LiveLocationMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LiveLocationMessage) ProtoMessage() {} + +func (x *LiveLocationMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LiveLocationMessage.ProtoReflect.Descriptor instead. +func (*LiveLocationMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{11} +} + +func (x *LiveLocationMessage) GetDegreesLatitude() float64 { + if x != nil && x.DegreesLatitude != nil { + return *x.DegreesLatitude + } + return 0 +} + +func (x *LiveLocationMessage) GetDegreesLongitude() float64 { + if x != nil && x.DegreesLongitude != nil { + return *x.DegreesLongitude + } + return 0 +} + +func (x *LiveLocationMessage) GetAccuracyInMeters() uint32 { + if x != nil && x.AccuracyInMeters != nil { + return *x.AccuracyInMeters + } + return 0 +} + +func (x *LiveLocationMessage) GetSpeedInMps() float32 { + if x != nil && x.SpeedInMps != nil { + return *x.SpeedInMps + } + return 0 +} + +func (x *LiveLocationMessage) GetDegreesClockwiseFromMagneticNorth() uint32 { + if x != nil && x.DegreesClockwiseFromMagneticNorth != nil { + return *x.DegreesClockwiseFromMagneticNorth + } + return 0 +} + +func (x *LiveLocationMessage) GetCaption() string { + if x != nil && x.Caption != nil { + return *x.Caption + } + return "" +} + +func (x *LiveLocationMessage) GetSequenceNumber() int64 { + if x != nil && x.SequenceNumber != nil { + return *x.SequenceNumber + } + return 0 +} + +func (x *LiveLocationMessage) GetTimeOffset() uint32 { + if x != nil && x.TimeOffset != nil { + return *x.TimeOffset + } + return 0 +} + +func (x *LiveLocationMessage) GetJpegThumbnail() []byte { + if x != nil { + return x.JpegThumbnail + } + return nil +} + +func (x *LiveLocationMessage) GetContextInfo() *ContextInfo { + if x != nil { + return x.ContextInfo + } + return nil +} + +type ListResponseMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Title *string `protobuf:"bytes,1,opt,name=title" json:"title,omitempty"` + ListType *ListResponseMessage_ListType `protobuf:"varint,2,opt,name=listType,enum=proto.ListResponseMessage_ListType" json:"listType,omitempty"` + SingleSelectReply *ListResponseMessage_SingleSelectReply `protobuf:"bytes,3,opt,name=singleSelectReply" json:"singleSelectReply,omitempty"` + ContextInfo *ContextInfo `protobuf:"bytes,4,opt,name=contextInfo" json:"contextInfo,omitempty"` + Description *string `protobuf:"bytes,5,opt,name=description" json:"description,omitempty"` +} + +func (x *ListResponseMessage) Reset() { + *x = ListResponseMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListResponseMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListResponseMessage) ProtoMessage() {} + +func (x *ListResponseMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListResponseMessage.ProtoReflect.Descriptor instead. +func (*ListResponseMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{12} +} + +func (x *ListResponseMessage) GetTitle() string { + if x != nil && x.Title != nil { + return *x.Title + } + return "" +} + +func (x *ListResponseMessage) GetListType() ListResponseMessage_ListType { + if x != nil && x.ListType != nil { + return *x.ListType + } + return ListResponseMessage_UNKNOWN +} + +func (x *ListResponseMessage) GetSingleSelectReply() *ListResponseMessage_SingleSelectReply { + if x != nil { + return x.SingleSelectReply + } + return nil +} + +func (x *ListResponseMessage) GetContextInfo() *ContextInfo { + if x != nil { + return x.ContextInfo + } + return nil +} + +func (x *ListResponseMessage) GetDescription() string { + if x != nil && x.Description != nil { + return *x.Description + } + return "" +} + +type ListMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Title *string `protobuf:"bytes,1,opt,name=title" json:"title,omitempty"` + Description *string `protobuf:"bytes,2,opt,name=description" json:"description,omitempty"` + ButtonText *string `protobuf:"bytes,3,opt,name=buttonText" json:"buttonText,omitempty"` + ListType *ListMessage_ListType `protobuf:"varint,4,opt,name=listType,enum=proto.ListMessage_ListType" json:"listType,omitempty"` + Sections []*ListMessage_Section `protobuf:"bytes,5,rep,name=sections" json:"sections,omitempty"` + ProductListInfo *ListMessage_ProductListInfo `protobuf:"bytes,6,opt,name=productListInfo" json:"productListInfo,omitempty"` + FooterText *string `protobuf:"bytes,7,opt,name=footerText" json:"footerText,omitempty"` + ContextInfo *ContextInfo `protobuf:"bytes,8,opt,name=contextInfo" json:"contextInfo,omitempty"` +} + +func (x *ListMessage) Reset() { + *x = ListMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListMessage) ProtoMessage() {} + +func (x *ListMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListMessage.ProtoReflect.Descriptor instead. +func (*ListMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{13} +} + +func (x *ListMessage) GetTitle() string { + if x != nil && x.Title != nil { + return *x.Title + } + return "" +} + +func (x *ListMessage) GetDescription() string { + if x != nil && x.Description != nil { + return *x.Description + } + return "" +} + +func (x *ListMessage) GetButtonText() string { + if x != nil && x.ButtonText != nil { + return *x.ButtonText + } + return "" +} + +func (x *ListMessage) GetListType() ListMessage_ListType { + if x != nil && x.ListType != nil { + return *x.ListType + } + return ListMessage_UNKNOWN +} + +func (x *ListMessage) GetSections() []*ListMessage_Section { + if x != nil { + return x.Sections + } + return nil +} + +func (x *ListMessage) GetProductListInfo() *ListMessage_ProductListInfo { + if x != nil { + return x.ProductListInfo + } + return nil +} + +func (x *ListMessage) GetFooterText() string { + if x != nil && x.FooterText != nil { + return *x.FooterText + } + return "" +} + +func (x *ListMessage) GetContextInfo() *ContextInfo { + if x != nil { + return x.ContextInfo + } + return nil +} + +type KeepInChatMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key *MessageKey `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` + KeepType *KeepType `protobuf:"varint,2,opt,name=keepType,enum=proto.KeepType" json:"keepType,omitempty"` + TimestampMs *int64 `protobuf:"varint,3,opt,name=timestampMs" json:"timestampMs,omitempty"` +} + +func (x *KeepInChatMessage) Reset() { + *x = KeepInChatMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KeepInChatMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeepInChatMessage) ProtoMessage() {} + +func (x *KeepInChatMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KeepInChatMessage.ProtoReflect.Descriptor instead. +func (*KeepInChatMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{14} +} + +func (x *KeepInChatMessage) GetKey() *MessageKey { + if x != nil { + return x.Key + } + return nil +} + +func (x *KeepInChatMessage) GetKeepType() KeepType { + if x != nil && x.KeepType != nil { + return *x.KeepType + } + return KeepType_UNKNOWN +} + +func (x *KeepInChatMessage) GetTimestampMs() int64 { + if x != nil && x.TimestampMs != nil { + return *x.TimestampMs + } + return 0 +} + +type InvoiceMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Note *string `protobuf:"bytes,1,opt,name=note" json:"note,omitempty"` + Token *string `protobuf:"bytes,2,opt,name=token" json:"token,omitempty"` + AttachmentType *InvoiceMessage_AttachmentType `protobuf:"varint,3,opt,name=attachmentType,enum=proto.InvoiceMessage_AttachmentType" json:"attachmentType,omitempty"` + AttachmentMimetype *string `protobuf:"bytes,4,opt,name=attachmentMimetype" json:"attachmentMimetype,omitempty"` + AttachmentMediaKey []byte `protobuf:"bytes,5,opt,name=attachmentMediaKey" json:"attachmentMediaKey,omitempty"` + AttachmentMediaKeyTimestamp *int64 `protobuf:"varint,6,opt,name=attachmentMediaKeyTimestamp" json:"attachmentMediaKeyTimestamp,omitempty"` + AttachmentFileSha256 []byte `protobuf:"bytes,7,opt,name=attachmentFileSha256" json:"attachmentFileSha256,omitempty"` + AttachmentFileEncSha256 []byte `protobuf:"bytes,8,opt,name=attachmentFileEncSha256" json:"attachmentFileEncSha256,omitempty"` + AttachmentDirectPath *string `protobuf:"bytes,9,opt,name=attachmentDirectPath" json:"attachmentDirectPath,omitempty"` + AttachmentJpegThumbnail []byte `protobuf:"bytes,10,opt,name=attachmentJpegThumbnail" json:"attachmentJpegThumbnail,omitempty"` +} + +func (x *InvoiceMessage) Reset() { + *x = InvoiceMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InvoiceMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InvoiceMessage) ProtoMessage() {} + +func (x *InvoiceMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InvoiceMessage.ProtoReflect.Descriptor instead. +func (*InvoiceMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{15} +} + +func (x *InvoiceMessage) GetNote() string { + if x != nil && x.Note != nil { + return *x.Note + } + return "" +} + +func (x *InvoiceMessage) GetToken() string { + if x != nil && x.Token != nil { + return *x.Token + } + return "" +} + +func (x *InvoiceMessage) GetAttachmentType() InvoiceMessage_AttachmentType { + if x != nil && x.AttachmentType != nil { + return *x.AttachmentType + } + return InvoiceMessage_IMAGE +} + +func (x *InvoiceMessage) GetAttachmentMimetype() string { + if x != nil && x.AttachmentMimetype != nil { + return *x.AttachmentMimetype + } + return "" +} + +func (x *InvoiceMessage) GetAttachmentMediaKey() []byte { + if x != nil { + return x.AttachmentMediaKey + } + return nil +} + +func (x *InvoiceMessage) GetAttachmentMediaKeyTimestamp() int64 { + if x != nil && x.AttachmentMediaKeyTimestamp != nil { + return *x.AttachmentMediaKeyTimestamp + } + return 0 +} + +func (x *InvoiceMessage) GetAttachmentFileSha256() []byte { + if x != nil { + return x.AttachmentFileSha256 + } + return nil +} + +func (x *InvoiceMessage) GetAttachmentFileEncSha256() []byte { + if x != nil { + return x.AttachmentFileEncSha256 + } + return nil +} + +func (x *InvoiceMessage) GetAttachmentDirectPath() string { + if x != nil && x.AttachmentDirectPath != nil { + return *x.AttachmentDirectPath + } + return "" +} + +func (x *InvoiceMessage) GetAttachmentJpegThumbnail() []byte { + if x != nil { + return x.AttachmentJpegThumbnail + } + return nil +} + +type InteractiveResponseMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Body *InteractiveResponseMessage_Body `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + ContextInfo *ContextInfo `protobuf:"bytes,15,opt,name=contextInfo" json:"contextInfo,omitempty"` + // Types that are assignable to InteractiveResponseMessage: + // + // *InteractiveResponseMessage_NativeFlowResponseMessage_ + InteractiveResponseMessage isInteractiveResponseMessage_InteractiveResponseMessage `protobuf_oneof:"interactiveResponseMessage"` +} + +func (x *InteractiveResponseMessage) Reset() { + *x = InteractiveResponseMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InteractiveResponseMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InteractiveResponseMessage) ProtoMessage() {} + +func (x *InteractiveResponseMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InteractiveResponseMessage.ProtoReflect.Descriptor instead. +func (*InteractiveResponseMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{16} +} + +func (x *InteractiveResponseMessage) GetBody() *InteractiveResponseMessage_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *InteractiveResponseMessage) GetContextInfo() *ContextInfo { + if x != nil { + return x.ContextInfo + } + return nil +} + +func (m *InteractiveResponseMessage) GetInteractiveResponseMessage() isInteractiveResponseMessage_InteractiveResponseMessage { + if m != nil { + return m.InteractiveResponseMessage + } + return nil +} + +func (x *InteractiveResponseMessage) GetNativeFlowResponseMessage() *InteractiveResponseMessage_NativeFlowResponseMessage { + if x, ok := x.GetInteractiveResponseMessage().(*InteractiveResponseMessage_NativeFlowResponseMessage_); ok { + return x.NativeFlowResponseMessage + } + return nil +} + +type isInteractiveResponseMessage_InteractiveResponseMessage interface { + isInteractiveResponseMessage_InteractiveResponseMessage() +} + +type InteractiveResponseMessage_NativeFlowResponseMessage_ struct { + NativeFlowResponseMessage *InteractiveResponseMessage_NativeFlowResponseMessage `protobuf:"bytes,2,opt,name=nativeFlowResponseMessage,oneof"` +} + +func (*InteractiveResponseMessage_NativeFlowResponseMessage_) isInteractiveResponseMessage_InteractiveResponseMessage() { +} + +type InteractiveMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Header *InteractiveMessage_Header `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` + Body *InteractiveMessage_Body `protobuf:"bytes,2,opt,name=body" json:"body,omitempty"` + Footer *InteractiveMessage_Footer `protobuf:"bytes,3,opt,name=footer" json:"footer,omitempty"` + ContextInfo *ContextInfo `protobuf:"bytes,15,opt,name=contextInfo" json:"contextInfo,omitempty"` + // Types that are assignable to InteractiveMessage: + // + // *InteractiveMessage_ShopStorefrontMessage + // *InteractiveMessage_CollectionMessage_ + // *InteractiveMessage_NativeFlowMessage_ + InteractiveMessage isInteractiveMessage_InteractiveMessage `protobuf_oneof:"interactiveMessage"` +} + +func (x *InteractiveMessage) Reset() { + *x = InteractiveMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InteractiveMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InteractiveMessage) ProtoMessage() {} + +func (x *InteractiveMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[17] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InteractiveMessage.ProtoReflect.Descriptor instead. +func (*InteractiveMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{17} +} + +func (x *InteractiveMessage) GetHeader() *InteractiveMessage_Header { + if x != nil { + return x.Header + } + return nil +} + +func (x *InteractiveMessage) GetBody() *InteractiveMessage_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *InteractiveMessage) GetFooter() *InteractiveMessage_Footer { + if x != nil { + return x.Footer + } + return nil +} + +func (x *InteractiveMessage) GetContextInfo() *ContextInfo { + if x != nil { + return x.ContextInfo + } + return nil +} + +func (m *InteractiveMessage) GetInteractiveMessage() isInteractiveMessage_InteractiveMessage { + if m != nil { + return m.InteractiveMessage + } + return nil +} + +func (x *InteractiveMessage) GetShopStorefrontMessage() *InteractiveMessage_ShopMessage { + if x, ok := x.GetInteractiveMessage().(*InteractiveMessage_ShopStorefrontMessage); ok { + return x.ShopStorefrontMessage + } + return nil +} + +func (x *InteractiveMessage) GetCollectionMessage() *InteractiveMessage_CollectionMessage { + if x, ok := x.GetInteractiveMessage().(*InteractiveMessage_CollectionMessage_); ok { + return x.CollectionMessage + } + return nil +} + +func (x *InteractiveMessage) GetNativeFlowMessage() *InteractiveMessage_NativeFlowMessage { + if x, ok := x.GetInteractiveMessage().(*InteractiveMessage_NativeFlowMessage_); ok { + return x.NativeFlowMessage + } + return nil +} + +type isInteractiveMessage_InteractiveMessage interface { + isInteractiveMessage_InteractiveMessage() +} + +type InteractiveMessage_ShopStorefrontMessage struct { + ShopStorefrontMessage *InteractiveMessage_ShopMessage `protobuf:"bytes,4,opt,name=shopStorefrontMessage,oneof"` +} + +type InteractiveMessage_CollectionMessage_ struct { + CollectionMessage *InteractiveMessage_CollectionMessage `protobuf:"bytes,5,opt,name=collectionMessage,oneof"` +} + +type InteractiveMessage_NativeFlowMessage_ struct { + NativeFlowMessage *InteractiveMessage_NativeFlowMessage `protobuf:"bytes,6,opt,name=nativeFlowMessage,oneof"` +} + +func (*InteractiveMessage_ShopStorefrontMessage) isInteractiveMessage_InteractiveMessage() {} + +func (*InteractiveMessage_CollectionMessage_) isInteractiveMessage_InteractiveMessage() {} + +func (*InteractiveMessage_NativeFlowMessage_) isInteractiveMessage_InteractiveMessage() {} + +type InitialSecurityNotificationSettingSync struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SecurityNotificationEnabled *bool `protobuf:"varint,1,opt,name=securityNotificationEnabled" json:"securityNotificationEnabled,omitempty"` +} + +func (x *InitialSecurityNotificationSettingSync) Reset() { + *x = InitialSecurityNotificationSettingSync{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InitialSecurityNotificationSettingSync) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InitialSecurityNotificationSettingSync) ProtoMessage() {} + +func (x *InitialSecurityNotificationSettingSync) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[18] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InitialSecurityNotificationSettingSync.ProtoReflect.Descriptor instead. +func (*InitialSecurityNotificationSettingSync) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{18} +} + +func (x *InitialSecurityNotificationSettingSync) GetSecurityNotificationEnabled() bool { + if x != nil && x.SecurityNotificationEnabled != nil { + return *x.SecurityNotificationEnabled + } + return false +} + +type ImageMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + 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"` + MediaKeyTimestamp *int64 `protobuf:"varint,12,opt,name=mediaKeyTimestamp" json:"mediaKeyTimestamp,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"` + ExperimentGroupId *uint32 `protobuf:"varint,20,opt,name=experimentGroupId" json:"experimentGroupId,omitempty"` + ScansSidecar []byte `protobuf:"bytes,21,opt,name=scansSidecar" json:"scansSidecar,omitempty"` + ScanLengths []uint32 `protobuf:"varint,22,rep,name=scanLengths" json:"scanLengths,omitempty"` + MidQualityFileSha256 []byte `protobuf:"bytes,23,opt,name=midQualityFileSha256" json:"midQualityFileSha256,omitempty"` + MidQualityFileEncSha256 []byte `protobuf:"bytes,24,opt,name=midQualityFileEncSha256" json:"midQualityFileEncSha256,omitempty"` + ViewOnce *bool `protobuf:"varint,25,opt,name=viewOnce" json:"viewOnce,omitempty"` + ThumbnailDirectPath *string `protobuf:"bytes,26,opt,name=thumbnailDirectPath" json:"thumbnailDirectPath,omitempty"` + ThumbnailSha256 []byte `protobuf:"bytes,27,opt,name=thumbnailSha256" json:"thumbnailSha256,omitempty"` + ThumbnailEncSha256 []byte `protobuf:"bytes,28,opt,name=thumbnailEncSha256" json:"thumbnailEncSha256,omitempty"` + StaticUrl *string `protobuf:"bytes,29,opt,name=staticUrl" json:"staticUrl,omitempty"` +} + +func (x *ImageMessage) Reset() { + *x = ImageMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ImageMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ImageMessage) ProtoMessage() {} + +func (x *ImageMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[19] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ImageMessage.ProtoReflect.Descriptor instead. +func (*ImageMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{19} +} + +func (x *ImageMessage) GetUrl() string { + if x != nil && x.Url != nil { + return *x.Url + } + return "" +} + +func (x *ImageMessage) GetMimetype() string { + if x != nil && x.Mimetype != nil { + return *x.Mimetype + } + return "" +} + +func (x *ImageMessage) GetCaption() string { + if x != nil && x.Caption != nil { + return *x.Caption + } + return "" +} + +func (x *ImageMessage) GetFileSha256() []byte { + if x != nil { + return x.FileSha256 + } + return nil +} + +func (x *ImageMessage) GetFileLength() uint64 { + if x != nil && x.FileLength != nil { + return *x.FileLength + } + return 0 +} + +func (x *ImageMessage) GetHeight() uint32 { + if x != nil && x.Height != nil { + return *x.Height + } + return 0 +} + +func (x *ImageMessage) GetWidth() uint32 { + if x != nil && x.Width != nil { + return *x.Width + } + return 0 +} + +func (x *ImageMessage) GetMediaKey() []byte { + if x != nil { + return x.MediaKey + } + return nil +} + +func (x *ImageMessage) GetFileEncSha256() []byte { + if x != nil { + return x.FileEncSha256 + } + return nil +} + +func (x *ImageMessage) GetInteractiveAnnotations() []*InteractiveAnnotation { + if x != nil { + return x.InteractiveAnnotations + } + return nil +} + +func (x *ImageMessage) GetDirectPath() string { + if x != nil && x.DirectPath != nil { + return *x.DirectPath + } + return "" +} + +func (x *ImageMessage) GetMediaKeyTimestamp() int64 { + if x != nil && x.MediaKeyTimestamp != nil { + return *x.MediaKeyTimestamp + } + return 0 +} + +func (x *ImageMessage) GetJpegThumbnail() []byte { + if x != nil { + return x.JpegThumbnail + } + return nil +} + +func (x *ImageMessage) GetContextInfo() *ContextInfo { + if x != nil { + return x.ContextInfo + } + return nil +} + +func (x *ImageMessage) GetFirstScanSidecar() []byte { + if x != nil { + return x.FirstScanSidecar + } + return nil +} + +func (x *ImageMessage) GetFirstScanLength() uint32 { + if x != nil && x.FirstScanLength != nil { + return *x.FirstScanLength + } + return 0 +} + +func (x *ImageMessage) GetExperimentGroupId() uint32 { + if x != nil && x.ExperimentGroupId != nil { + return *x.ExperimentGroupId + } + return 0 +} + +func (x *ImageMessage) GetScansSidecar() []byte { + if x != nil { + return x.ScansSidecar + } + return nil +} + +func (x *ImageMessage) GetScanLengths() []uint32 { + if x != nil { + return x.ScanLengths + } + return nil +} + +func (x *ImageMessage) GetMidQualityFileSha256() []byte { + if x != nil { + return x.MidQualityFileSha256 + } + return nil +} + +func (x *ImageMessage) GetMidQualityFileEncSha256() []byte { + if x != nil { + return x.MidQualityFileEncSha256 + } + return nil +} + +func (x *ImageMessage) GetViewOnce() bool { + if x != nil && x.ViewOnce != nil { + return *x.ViewOnce + } + return false +} + +func (x *ImageMessage) GetThumbnailDirectPath() string { + if x != nil && x.ThumbnailDirectPath != nil { + return *x.ThumbnailDirectPath + } + return "" +} + +func (x *ImageMessage) GetThumbnailSha256() []byte { + if x != nil { + return x.ThumbnailSha256 + } + return nil +} + +func (x *ImageMessage) GetThumbnailEncSha256() []byte { + if x != nil { + return x.ThumbnailEncSha256 + } + return nil +} + +func (x *ImageMessage) GetStaticUrl() string { + if x != nil && x.StaticUrl != nil { + return *x.StaticUrl + } + return "" +} + +type HistorySyncNotification struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FileSha256 []byte `protobuf:"bytes,1,opt,name=fileSha256" json:"fileSha256,omitempty"` + FileLength *uint64 `protobuf:"varint,2,opt,name=fileLength" json:"fileLength,omitempty"` + MediaKey []byte `protobuf:"bytes,3,opt,name=mediaKey" json:"mediaKey,omitempty"` + FileEncSha256 []byte `protobuf:"bytes,4,opt,name=fileEncSha256" json:"fileEncSha256,omitempty"` + DirectPath *string `protobuf:"bytes,5,opt,name=directPath" json:"directPath,omitempty"` + SyncType *HistorySyncNotification_HistorySyncType `protobuf:"varint,6,opt,name=syncType,enum=proto.HistorySyncNotification_HistorySyncType" json:"syncType,omitempty"` + ChunkOrder *uint32 `protobuf:"varint,7,opt,name=chunkOrder" json:"chunkOrder,omitempty"` + OriginalMessageId *string `protobuf:"bytes,8,opt,name=originalMessageId" json:"originalMessageId,omitempty"` + Progress *uint32 `protobuf:"varint,9,opt,name=progress" json:"progress,omitempty"` + OldestMsgInChunkTimestampSec *int64 `protobuf:"varint,10,opt,name=oldestMsgInChunkTimestampSec" json:"oldestMsgInChunkTimestampSec,omitempty"` +} + +func (x *HistorySyncNotification) Reset() { + *x = HistorySyncNotification{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HistorySyncNotification) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HistorySyncNotification) ProtoMessage() {} + +func (x *HistorySyncNotification) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[20] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HistorySyncNotification.ProtoReflect.Descriptor instead. +func (*HistorySyncNotification) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{20} +} + +func (x *HistorySyncNotification) GetFileSha256() []byte { + if x != nil { + return x.FileSha256 + } + return nil +} + +func (x *HistorySyncNotification) GetFileLength() uint64 { + if x != nil && x.FileLength != nil { + return *x.FileLength + } + return 0 +} + +func (x *HistorySyncNotification) GetMediaKey() []byte { + if x != nil { + return x.MediaKey + } + return nil +} + +func (x *HistorySyncNotification) GetFileEncSha256() []byte { + if x != nil { + return x.FileEncSha256 + } + return nil +} + +func (x *HistorySyncNotification) GetDirectPath() string { + if x != nil && x.DirectPath != nil { + return *x.DirectPath + } + return "" +} + +func (x *HistorySyncNotification) GetSyncType() HistorySyncNotification_HistorySyncType { + if x != nil && x.SyncType != nil { + return *x.SyncType + } + return HistorySyncNotification_INITIAL_BOOTSTRAP +} + +func (x *HistorySyncNotification) GetChunkOrder() uint32 { + if x != nil && x.ChunkOrder != nil { + return *x.ChunkOrder + } + return 0 +} + +func (x *HistorySyncNotification) GetOriginalMessageId() string { + if x != nil && x.OriginalMessageId != nil { + return *x.OriginalMessageId + } + return "" +} + +func (x *HistorySyncNotification) GetProgress() uint32 { + if x != nil && x.Progress != nil { + return *x.Progress + } + return 0 +} + +func (x *HistorySyncNotification) GetOldestMsgInChunkTimestampSec() int64 { + if x != nil && x.OldestMsgInChunkTimestampSec != nil { + return *x.OldestMsgInChunkTimestampSec + } + return 0 +} + +type HighlyStructuredMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + 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 []*HighlyStructuredMessage_HSMLocalizableParameter `protobuf:"bytes,6,rep,name=localizableParams" json:"localizableParams,omitempty"` + DeterministicLg *string `protobuf:"bytes,7,opt,name=deterministicLg" json:"deterministicLg,omitempty"` + DeterministicLc *string `protobuf:"bytes,8,opt,name=deterministicLc" json:"deterministicLc,omitempty"` + HydratedHsm *TemplateMessage `protobuf:"bytes,9,opt,name=hydratedHsm" json:"hydratedHsm,omitempty"` +} + +func (x *HighlyStructuredMessage) Reset() { + *x = HighlyStructuredMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HighlyStructuredMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HighlyStructuredMessage) ProtoMessage() {} + +func (x *HighlyStructuredMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[21] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HighlyStructuredMessage.ProtoReflect.Descriptor instead. +func (*HighlyStructuredMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{21} +} + +func (x *HighlyStructuredMessage) GetNamespace() string { + if x != nil && x.Namespace != nil { + return *x.Namespace + } + return "" +} + +func (x *HighlyStructuredMessage) GetElementName() string { + if x != nil && x.ElementName != nil { + return *x.ElementName + } + return "" +} + +func (x *HighlyStructuredMessage) GetParams() []string { + if x != nil { + return x.Params + } + return nil +} + +func (x *HighlyStructuredMessage) GetFallbackLg() string { + if x != nil && x.FallbackLg != nil { + return *x.FallbackLg + } + return "" +} + +func (x *HighlyStructuredMessage) GetFallbackLc() string { + if x != nil && x.FallbackLc != nil { + return *x.FallbackLc + } + return "" +} + +func (x *HighlyStructuredMessage) GetLocalizableParams() []*HighlyStructuredMessage_HSMLocalizableParameter { + if x != nil { + return x.LocalizableParams + } + return nil +} + +func (x *HighlyStructuredMessage) GetDeterministicLg() string { + if x != nil && x.DeterministicLg != nil { + return *x.DeterministicLg + } + return "" +} + +func (x *HighlyStructuredMessage) GetDeterministicLc() string { + if x != nil && x.DeterministicLc != nil { + return *x.DeterministicLc + } + return "" +} + +func (x *HighlyStructuredMessage) GetHydratedHsm() *TemplateMessage { + if x != nil { + return x.HydratedHsm + } + return nil +} + +type GroupInviteMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + GroupJid *string `protobuf:"bytes,1,opt,name=groupJid" json:"groupJid,omitempty"` + InviteCode *string `protobuf:"bytes,2,opt,name=inviteCode" json:"inviteCode,omitempty"` + InviteExpiration *int64 `protobuf:"varint,3,opt,name=inviteExpiration" json:"inviteExpiration,omitempty"` + GroupName *string `protobuf:"bytes,4,opt,name=groupName" json:"groupName,omitempty"` + JpegThumbnail []byte `protobuf:"bytes,5,opt,name=jpegThumbnail" json:"jpegThumbnail,omitempty"` + Caption *string `protobuf:"bytes,6,opt,name=caption" json:"caption,omitempty"` + ContextInfo *ContextInfo `protobuf:"bytes,7,opt,name=contextInfo" json:"contextInfo,omitempty"` + GroupType *GroupInviteMessage_GroupType `protobuf:"varint,8,opt,name=groupType,enum=proto.GroupInviteMessage_GroupType" json:"groupType,omitempty"` +} + +func (x *GroupInviteMessage) Reset() { + *x = GroupInviteMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GroupInviteMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GroupInviteMessage) ProtoMessage() {} + +func (x *GroupInviteMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[22] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GroupInviteMessage.ProtoReflect.Descriptor instead. +func (*GroupInviteMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{22} +} + +func (x *GroupInviteMessage) GetGroupJid() string { + if x != nil && x.GroupJid != nil { + return *x.GroupJid + } + return "" +} + +func (x *GroupInviteMessage) GetInviteCode() string { + if x != nil && x.InviteCode != nil { + return *x.InviteCode + } + return "" +} + +func (x *GroupInviteMessage) GetInviteExpiration() int64 { + if x != nil && x.InviteExpiration != nil { + return *x.InviteExpiration + } + return 0 +} + +func (x *GroupInviteMessage) GetGroupName() string { + if x != nil && x.GroupName != nil { + return *x.GroupName + } + return "" +} + +func (x *GroupInviteMessage) GetJpegThumbnail() []byte { + if x != nil { + return x.JpegThumbnail + } + return nil +} + +func (x *GroupInviteMessage) GetCaption() string { + if x != nil && x.Caption != nil { + return *x.Caption + } + return "" +} + +func (x *GroupInviteMessage) GetContextInfo() *ContextInfo { + if x != nil { + return x.ContextInfo + } + return nil +} + +func (x *GroupInviteMessage) GetGroupType() GroupInviteMessage_GroupType { + if x != nil && x.GroupType != nil { + return *x.GroupType + } + return GroupInviteMessage_DEFAULT +} + +type FutureProofMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Message *Message `protobuf:"bytes,1,opt,name=message" json:"message,omitempty"` +} + +func (x *FutureProofMessage) Reset() { + *x = FutureProofMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FutureProofMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FutureProofMessage) ProtoMessage() {} + +func (x *FutureProofMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[23] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FutureProofMessage.ProtoReflect.Descriptor instead. +func (*FutureProofMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{23} +} + +func (x *FutureProofMessage) GetMessage() *Message { + if x != nil { + return x.Message + } + return nil +} + +type ExtendedTextMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + 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"` + PreviewType *ExtendedTextMessage_PreviewType `protobuf:"varint,10,opt,name=previewType,enum=proto.ExtendedTextMessage_PreviewType" json:"previewType,omitempty"` + JpegThumbnail []byte `protobuf:"bytes,16,opt,name=jpegThumbnail" json:"jpegThumbnail,omitempty"` + ContextInfo *ContextInfo `protobuf:"bytes,17,opt,name=contextInfo" json:"contextInfo,omitempty"` + DoNotPlayInline *bool `protobuf:"varint,18,opt,name=doNotPlayInline" json:"doNotPlayInline,omitempty"` + ThumbnailDirectPath *string `protobuf:"bytes,19,opt,name=thumbnailDirectPath" json:"thumbnailDirectPath,omitempty"` + ThumbnailSha256 []byte `protobuf:"bytes,20,opt,name=thumbnailSha256" json:"thumbnailSha256,omitempty"` + ThumbnailEncSha256 []byte `protobuf:"bytes,21,opt,name=thumbnailEncSha256" json:"thumbnailEncSha256,omitempty"` + MediaKey []byte `protobuf:"bytes,22,opt,name=mediaKey" json:"mediaKey,omitempty"` + MediaKeyTimestamp *int64 `protobuf:"varint,23,opt,name=mediaKeyTimestamp" json:"mediaKeyTimestamp,omitempty"` + ThumbnailHeight *uint32 `protobuf:"varint,24,opt,name=thumbnailHeight" json:"thumbnailHeight,omitempty"` + ThumbnailWidth *uint32 `protobuf:"varint,25,opt,name=thumbnailWidth" json:"thumbnailWidth,omitempty"` + InviteLinkGroupType *ExtendedTextMessage_InviteLinkGroupType `protobuf:"varint,26,opt,name=inviteLinkGroupType,enum=proto.ExtendedTextMessage_InviteLinkGroupType" json:"inviteLinkGroupType,omitempty"` + InviteLinkParentGroupSubjectV2 *string `protobuf:"bytes,27,opt,name=inviteLinkParentGroupSubjectV2" json:"inviteLinkParentGroupSubjectV2,omitempty"` + InviteLinkParentGroupThumbnailV2 []byte `protobuf:"bytes,28,opt,name=inviteLinkParentGroupThumbnailV2" json:"inviteLinkParentGroupThumbnailV2,omitempty"` + InviteLinkGroupTypeV2 *ExtendedTextMessage_InviteLinkGroupType `protobuf:"varint,29,opt,name=inviteLinkGroupTypeV2,enum=proto.ExtendedTextMessage_InviteLinkGroupType" json:"inviteLinkGroupTypeV2,omitempty"` + ViewOnce *bool `protobuf:"varint,30,opt,name=viewOnce" json:"viewOnce,omitempty"` +} + +func (x *ExtendedTextMessage) Reset() { + *x = ExtendedTextMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExtendedTextMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExtendedTextMessage) ProtoMessage() {} + +func (x *ExtendedTextMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[24] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExtendedTextMessage.ProtoReflect.Descriptor instead. +func (*ExtendedTextMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{24} +} + +func (x *ExtendedTextMessage) GetText() string { + if x != nil && x.Text != nil { + return *x.Text + } + return "" +} + +func (x *ExtendedTextMessage) GetMatchedText() string { + if x != nil && x.MatchedText != nil { + return *x.MatchedText + } + return "" +} + +func (x *ExtendedTextMessage) GetCanonicalUrl() string { + if x != nil && x.CanonicalUrl != nil { + return *x.CanonicalUrl + } + return "" +} + +func (x *ExtendedTextMessage) GetDescription() string { + if x != nil && x.Description != nil { + return *x.Description + } + return "" +} + +func (x *ExtendedTextMessage) GetTitle() string { + if x != nil && x.Title != nil { + return *x.Title + } + return "" +} + +func (x *ExtendedTextMessage) GetTextArgb() uint32 { + if x != nil && x.TextArgb != nil { + return *x.TextArgb + } + return 0 +} + +func (x *ExtendedTextMessage) GetBackgroundArgb() uint32 { + if x != nil && x.BackgroundArgb != nil { + return *x.BackgroundArgb + } + return 0 +} + +func (x *ExtendedTextMessage) GetFont() ExtendedTextMessage_FontType { + if x != nil && x.Font != nil { + return *x.Font + } + return ExtendedTextMessage_SANS_SERIF +} + +func (x *ExtendedTextMessage) GetPreviewType() ExtendedTextMessage_PreviewType { + if x != nil && x.PreviewType != nil { + return *x.PreviewType + } + return ExtendedTextMessage_NONE +} + +func (x *ExtendedTextMessage) GetJpegThumbnail() []byte { + if x != nil { + return x.JpegThumbnail + } + return nil +} + +func (x *ExtendedTextMessage) GetContextInfo() *ContextInfo { + if x != nil { + return x.ContextInfo + } + return nil +} + +func (x *ExtendedTextMessage) GetDoNotPlayInline() bool { + if x != nil && x.DoNotPlayInline != nil { + return *x.DoNotPlayInline + } + return false +} + +func (x *ExtendedTextMessage) GetThumbnailDirectPath() string { + if x != nil && x.ThumbnailDirectPath != nil { + return *x.ThumbnailDirectPath + } + return "" +} + +func (x *ExtendedTextMessage) GetThumbnailSha256() []byte { + if x != nil { + return x.ThumbnailSha256 + } + return nil +} + +func (x *ExtendedTextMessage) GetThumbnailEncSha256() []byte { + if x != nil { + return x.ThumbnailEncSha256 + } + return nil +} + +func (x *ExtendedTextMessage) GetMediaKey() []byte { + if x != nil { + return x.MediaKey + } + return nil +} + +func (x *ExtendedTextMessage) GetMediaKeyTimestamp() int64 { + if x != nil && x.MediaKeyTimestamp != nil { + return *x.MediaKeyTimestamp + } + return 0 +} + +func (x *ExtendedTextMessage) GetThumbnailHeight() uint32 { + if x != nil && x.ThumbnailHeight != nil { + return *x.ThumbnailHeight + } + return 0 +} + +func (x *ExtendedTextMessage) GetThumbnailWidth() uint32 { + if x != nil && x.ThumbnailWidth != nil { + return *x.ThumbnailWidth + } + return 0 +} + +func (x *ExtendedTextMessage) GetInviteLinkGroupType() ExtendedTextMessage_InviteLinkGroupType { + if x != nil && x.InviteLinkGroupType != nil { + return *x.InviteLinkGroupType + } + return ExtendedTextMessage_DEFAULT +} + +func (x *ExtendedTextMessage) GetInviteLinkParentGroupSubjectV2() string { + if x != nil && x.InviteLinkParentGroupSubjectV2 != nil { + return *x.InviteLinkParentGroupSubjectV2 + } + return "" +} + +func (x *ExtendedTextMessage) GetInviteLinkParentGroupThumbnailV2() []byte { + if x != nil { + return x.InviteLinkParentGroupThumbnailV2 + } + return nil +} + +func (x *ExtendedTextMessage) GetInviteLinkGroupTypeV2() ExtendedTextMessage_InviteLinkGroupType { + if x != nil && x.InviteLinkGroupTypeV2 != nil { + return *x.InviteLinkGroupTypeV2 + } + return ExtendedTextMessage_DEFAULT +} + +func (x *ExtendedTextMessage) GetViewOnce() bool { + if x != nil && x.ViewOnce != nil { + return *x.ViewOnce + } + return false +} + +type EncReactionMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TargetMessageKey *MessageKey `protobuf:"bytes,1,opt,name=targetMessageKey" json:"targetMessageKey,omitempty"` + EncPayload []byte `protobuf:"bytes,2,opt,name=encPayload" json:"encPayload,omitempty"` + EncIv []byte `protobuf:"bytes,3,opt,name=encIv" json:"encIv,omitempty"` +} + +func (x *EncReactionMessage) Reset() { + *x = EncReactionMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EncReactionMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EncReactionMessage) ProtoMessage() {} + +func (x *EncReactionMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[25] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EncReactionMessage.ProtoReflect.Descriptor instead. +func (*EncReactionMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{25} +} + +func (x *EncReactionMessage) GetTargetMessageKey() *MessageKey { + if x != nil { + return x.TargetMessageKey + } + return nil +} + +func (x *EncReactionMessage) GetEncPayload() []byte { + if x != nil { + return x.EncPayload + } + return nil +} + +func (x *EncReactionMessage) GetEncIv() []byte { + if x != nil { + return x.EncIv + } + return nil +} + +type DocumentMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + 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"` + MediaKeyTimestamp *int64 `protobuf:"varint,11,opt,name=mediaKeyTimestamp" json:"mediaKeyTimestamp,omitempty"` + ContactVcard *bool `protobuf:"varint,12,opt,name=contactVcard" json:"contactVcard,omitempty"` + ThumbnailDirectPath *string `protobuf:"bytes,13,opt,name=thumbnailDirectPath" json:"thumbnailDirectPath,omitempty"` + ThumbnailSha256 []byte `protobuf:"bytes,14,opt,name=thumbnailSha256" json:"thumbnailSha256,omitempty"` + ThumbnailEncSha256 []byte `protobuf:"bytes,15,opt,name=thumbnailEncSha256" json:"thumbnailEncSha256,omitempty"` + JpegThumbnail []byte `protobuf:"bytes,16,opt,name=jpegThumbnail" json:"jpegThumbnail,omitempty"` + ContextInfo *ContextInfo `protobuf:"bytes,17,opt,name=contextInfo" json:"contextInfo,omitempty"` + ThumbnailHeight *uint32 `protobuf:"varint,18,opt,name=thumbnailHeight" json:"thumbnailHeight,omitempty"` + ThumbnailWidth *uint32 `protobuf:"varint,19,opt,name=thumbnailWidth" json:"thumbnailWidth,omitempty"` + Caption *string `protobuf:"bytes,20,opt,name=caption" json:"caption,omitempty"` +} + +func (x *DocumentMessage) Reset() { + *x = DocumentMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DocumentMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DocumentMessage) ProtoMessage() {} + +func (x *DocumentMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[26] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DocumentMessage.ProtoReflect.Descriptor instead. +func (*DocumentMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{26} +} + +func (x *DocumentMessage) GetUrl() string { + if x != nil && x.Url != nil { + return *x.Url + } + return "" +} + +func (x *DocumentMessage) GetMimetype() string { + if x != nil && x.Mimetype != nil { + return *x.Mimetype + } + return "" +} + +func (x *DocumentMessage) GetTitle() string { + if x != nil && x.Title != nil { + return *x.Title + } + return "" +} + +func (x *DocumentMessage) GetFileSha256() []byte { + if x != nil { + return x.FileSha256 + } + return nil +} + +func (x *DocumentMessage) GetFileLength() uint64 { + if x != nil && x.FileLength != nil { + return *x.FileLength + } + return 0 +} + +func (x *DocumentMessage) GetPageCount() uint32 { + if x != nil && x.PageCount != nil { + return *x.PageCount + } + return 0 +} + +func (x *DocumentMessage) GetMediaKey() []byte { + if x != nil { + return x.MediaKey + } + return nil +} + +func (x *DocumentMessage) GetFileName() string { + if x != nil && x.FileName != nil { + return *x.FileName + } + return "" +} + +func (x *DocumentMessage) GetFileEncSha256() []byte { + if x != nil { + return x.FileEncSha256 + } + return nil +} + +func (x *DocumentMessage) GetDirectPath() string { + if x != nil && x.DirectPath != nil { + return *x.DirectPath + } + return "" +} + +func (x *DocumentMessage) GetMediaKeyTimestamp() int64 { + if x != nil && x.MediaKeyTimestamp != nil { + return *x.MediaKeyTimestamp + } + return 0 +} + +func (x *DocumentMessage) GetContactVcard() bool { + if x != nil && x.ContactVcard != nil { + return *x.ContactVcard + } + return false +} + +func (x *DocumentMessage) GetThumbnailDirectPath() string { + if x != nil && x.ThumbnailDirectPath != nil { + return *x.ThumbnailDirectPath + } + return "" +} + +func (x *DocumentMessage) GetThumbnailSha256() []byte { + if x != nil { + return x.ThumbnailSha256 + } + return nil +} + +func (x *DocumentMessage) GetThumbnailEncSha256() []byte { + if x != nil { + return x.ThumbnailEncSha256 + } + return nil +} + +func (x *DocumentMessage) GetJpegThumbnail() []byte { + if x != nil { + return x.JpegThumbnail + } + return nil +} + +func (x *DocumentMessage) GetContextInfo() *ContextInfo { + if x != nil { + return x.ContextInfo + } + return nil +} + +func (x *DocumentMessage) GetThumbnailHeight() uint32 { + if x != nil && x.ThumbnailHeight != nil { + return *x.ThumbnailHeight + } + return 0 +} + +func (x *DocumentMessage) GetThumbnailWidth() uint32 { + if x != nil && x.ThumbnailWidth != nil { + return *x.ThumbnailWidth + } + return 0 +} + +func (x *DocumentMessage) GetCaption() string { + if x != nil && x.Caption != nil { + return *x.Caption + } + return "" +} + +type DeviceSentMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DestinationJid *string `protobuf:"bytes,1,opt,name=destinationJid" json:"destinationJid,omitempty"` + Message *Message `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"` + Phash *string `protobuf:"bytes,3,opt,name=phash" json:"phash,omitempty"` +} + +func (x *DeviceSentMessage) Reset() { + *x = DeviceSentMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeviceSentMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeviceSentMessage) ProtoMessage() {} + +func (x *DeviceSentMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[27] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeviceSentMessage.ProtoReflect.Descriptor instead. +func (*DeviceSentMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{27} +} + +func (x *DeviceSentMessage) GetDestinationJid() string { + if x != nil && x.DestinationJid != nil { + return *x.DestinationJid + } + return "" +} + +func (x *DeviceSentMessage) GetMessage() *Message { + if x != nil { + return x.Message + } + return nil +} + +func (x *DeviceSentMessage) GetPhash() string { + if x != nil && x.Phash != nil { + return *x.Phash + } + return "" +} + +type DeclinePaymentRequestMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key *MessageKey `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` +} + +func (x *DeclinePaymentRequestMessage) Reset() { + *x = DeclinePaymentRequestMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeclinePaymentRequestMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeclinePaymentRequestMessage) ProtoMessage() {} + +func (x *DeclinePaymentRequestMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[28] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeclinePaymentRequestMessage.ProtoReflect.Descriptor instead. +func (*DeclinePaymentRequestMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{28} +} + +func (x *DeclinePaymentRequestMessage) GetKey() *MessageKey { + if x != nil { + return x.Key + } + return nil +} + +type ContactsArrayMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + 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"` +} + +func (x *ContactsArrayMessage) Reset() { + *x = ContactsArrayMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ContactsArrayMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ContactsArrayMessage) ProtoMessage() {} + +func (x *ContactsArrayMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[29] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ContactsArrayMessage.ProtoReflect.Descriptor instead. +func (*ContactsArrayMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{29} +} + +func (x *ContactsArrayMessage) GetDisplayName() string { + if x != nil && x.DisplayName != nil { + return *x.DisplayName + } + return "" +} + +func (x *ContactsArrayMessage) GetContacts() []*ContactMessage { + if x != nil { + return x.Contacts + } + return nil +} + +func (x *ContactsArrayMessage) GetContextInfo() *ContextInfo { + if x != nil { + return x.ContextInfo + } + return nil +} + +type ContactMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + 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"` +} + +func (x *ContactMessage) Reset() { + *x = ContactMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ContactMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ContactMessage) ProtoMessage() {} + +func (x *ContactMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[30] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ContactMessage.ProtoReflect.Descriptor instead. +func (*ContactMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{30} +} + +func (x *ContactMessage) GetDisplayName() string { + if x != nil && x.DisplayName != nil { + return *x.DisplayName + } + return "" +} + +func (x *ContactMessage) GetVcard() string { + if x != nil && x.Vcard != nil { + return *x.Vcard + } + return "" +} + +func (x *ContactMessage) GetContextInfo() *ContextInfo { + if x != nil { + return x.ContextInfo + } + return nil +} + +type Chat struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DisplayName *string `protobuf:"bytes,1,opt,name=displayName" json:"displayName,omitempty"` + Id *string `protobuf:"bytes,2,opt,name=id" json:"id,omitempty"` +} + +func (x *Chat) Reset() { + *x = Chat{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Chat) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Chat) ProtoMessage() {} + +func (x *Chat) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[31] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Chat.ProtoReflect.Descriptor instead. +func (*Chat) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{31} +} + +func (x *Chat) GetDisplayName() string { + if x != nil && x.DisplayName != nil { + return *x.DisplayName + } + return "" +} + +func (x *Chat) GetId() string { + if x != nil && x.Id != nil { + return *x.Id + } + return "" +} + +type CancelPaymentRequestMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key *MessageKey `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` +} + +func (x *CancelPaymentRequestMessage) Reset() { + *x = CancelPaymentRequestMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CancelPaymentRequestMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CancelPaymentRequestMessage) ProtoMessage() {} + +func (x *CancelPaymentRequestMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[32] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CancelPaymentRequestMessage.ProtoReflect.Descriptor instead. +func (*CancelPaymentRequestMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{32} +} + +func (x *CancelPaymentRequestMessage) GetKey() *MessageKey { + if x != nil { + return x.Key + } + return nil +} + +type Call struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CallKey []byte `protobuf:"bytes,1,opt,name=callKey" json:"callKey,omitempty"` + ConversionSource *string `protobuf:"bytes,2,opt,name=conversionSource" json:"conversionSource,omitempty"` + ConversionData []byte `protobuf:"bytes,3,opt,name=conversionData" json:"conversionData,omitempty"` + ConversionDelaySeconds *uint32 `protobuf:"varint,4,opt,name=conversionDelaySeconds" json:"conversionDelaySeconds,omitempty"` +} + +func (x *Call) Reset() { + *x = Call{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Call) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Call) ProtoMessage() {} + +func (x *Call) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[33] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Call.ProtoReflect.Descriptor instead. +func (*Call) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{33} +} + +func (x *Call) GetCallKey() []byte { + if x != nil { + return x.CallKey + } + return nil +} + +func (x *Call) GetConversionSource() string { + if x != nil && x.ConversionSource != nil { + return *x.ConversionSource + } + return "" +} + +func (x *Call) GetConversionData() []byte { + if x != nil { + return x.ConversionData + } + return nil +} + +func (x *Call) GetConversionDelaySeconds() uint32 { + if x != nil && x.ConversionDelaySeconds != nil { + return *x.ConversionDelaySeconds + } + return 0 +} + +type ButtonsResponseMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SelectedButtonId *string `protobuf:"bytes,1,opt,name=selectedButtonId" json:"selectedButtonId,omitempty"` + ContextInfo *ContextInfo `protobuf:"bytes,3,opt,name=contextInfo" json:"contextInfo,omitempty"` + Type *ButtonsResponseMessage_Type `protobuf:"varint,4,opt,name=type,enum=proto.ButtonsResponseMessage_Type" json:"type,omitempty"` + // Types that are assignable to Response: + // + // *ButtonsResponseMessage_SelectedDisplayText + Response isButtonsResponseMessage_Response `protobuf_oneof:"response"` +} + +func (x *ButtonsResponseMessage) Reset() { + *x = ButtonsResponseMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ButtonsResponseMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ButtonsResponseMessage) ProtoMessage() {} + +func (x *ButtonsResponseMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[34] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ButtonsResponseMessage.ProtoReflect.Descriptor instead. +func (*ButtonsResponseMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{34} +} + +func (x *ButtonsResponseMessage) GetSelectedButtonId() string { + if x != nil && x.SelectedButtonId != nil { + return *x.SelectedButtonId + } + return "" +} + +func (x *ButtonsResponseMessage) GetContextInfo() *ContextInfo { + if x != nil { + return x.ContextInfo + } + return nil +} + +func (x *ButtonsResponseMessage) GetType() ButtonsResponseMessage_Type { + if x != nil && x.Type != nil { + return *x.Type + } + return ButtonsResponseMessage_UNKNOWN +} + +func (m *ButtonsResponseMessage) GetResponse() isButtonsResponseMessage_Response { + if m != nil { + return m.Response + } + return nil +} + +func (x *ButtonsResponseMessage) GetSelectedDisplayText() string { + if x, ok := x.GetResponse().(*ButtonsResponseMessage_SelectedDisplayText); ok { + return x.SelectedDisplayText + } + return "" +} + +type isButtonsResponseMessage_Response interface { + isButtonsResponseMessage_Response() +} + +type ButtonsResponseMessage_SelectedDisplayText struct { + SelectedDisplayText string `protobuf:"bytes,2,opt,name=selectedDisplayText,oneof"` +} + +func (*ButtonsResponseMessage_SelectedDisplayText) isButtonsResponseMessage_Response() {} + +type ButtonsMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ContentText *string `protobuf:"bytes,6,opt,name=contentText" json:"contentText,omitempty"` + FooterText *string `protobuf:"bytes,7,opt,name=footerText" json:"footerText,omitempty"` + ContextInfo *ContextInfo `protobuf:"bytes,8,opt,name=contextInfo" json:"contextInfo,omitempty"` + Buttons []*ButtonsMessage_Button `protobuf:"bytes,9,rep,name=buttons" json:"buttons,omitempty"` + HeaderType *ButtonsMessage_HeaderType `protobuf:"varint,10,opt,name=headerType,enum=proto.ButtonsMessage_HeaderType" json:"headerType,omitempty"` + // Types that are assignable to Header: + // + // *ButtonsMessage_Text + // *ButtonsMessage_DocumentMessage + // *ButtonsMessage_ImageMessage + // *ButtonsMessage_VideoMessage + // *ButtonsMessage_LocationMessage + Header isButtonsMessage_Header `protobuf_oneof:"header"` +} + +func (x *ButtonsMessage) Reset() { + *x = ButtonsMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ButtonsMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ButtonsMessage) ProtoMessage() {} + +func (x *ButtonsMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[35] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ButtonsMessage.ProtoReflect.Descriptor instead. +func (*ButtonsMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{35} +} + +func (x *ButtonsMessage) GetContentText() string { + if x != nil && x.ContentText != nil { + return *x.ContentText + } + return "" +} + +func (x *ButtonsMessage) GetFooterText() string { + if x != nil && x.FooterText != nil { + return *x.FooterText + } + return "" +} + +func (x *ButtonsMessage) GetContextInfo() *ContextInfo { + if x != nil { + return x.ContextInfo + } + return nil +} + +func (x *ButtonsMessage) GetButtons() []*ButtonsMessage_Button { + if x != nil { + return x.Buttons + } + return nil +} + +func (x *ButtonsMessage) GetHeaderType() ButtonsMessage_HeaderType { + if x != nil && x.HeaderType != nil { + return *x.HeaderType + } + return ButtonsMessage_UNKNOWN +} + +func (m *ButtonsMessage) GetHeader() isButtonsMessage_Header { + if m != nil { + return m.Header + } + return nil +} + +func (x *ButtonsMessage) GetText() string { + if x, ok := x.GetHeader().(*ButtonsMessage_Text); ok { + return x.Text + } + return "" +} + +func (x *ButtonsMessage) GetDocumentMessage() *DocumentMessage { + if x, ok := x.GetHeader().(*ButtonsMessage_DocumentMessage); ok { + return x.DocumentMessage + } + return nil +} + +func (x *ButtonsMessage) GetImageMessage() *ImageMessage { + if x, ok := x.GetHeader().(*ButtonsMessage_ImageMessage); ok { + return x.ImageMessage + } + return nil +} + +func (x *ButtonsMessage) GetVideoMessage() *VideoMessage { + if x, ok := x.GetHeader().(*ButtonsMessage_VideoMessage); ok { + return x.VideoMessage + } + return nil +} + +func (x *ButtonsMessage) GetLocationMessage() *LocationMessage { + if x, ok := x.GetHeader().(*ButtonsMessage_LocationMessage); ok { + return x.LocationMessage + } + return nil +} + +type isButtonsMessage_Header interface { + isButtonsMessage_Header() +} + +type ButtonsMessage_Text struct { + Text string `protobuf:"bytes,1,opt,name=text,oneof"` +} + +type ButtonsMessage_DocumentMessage struct { + DocumentMessage *DocumentMessage `protobuf:"bytes,2,opt,name=documentMessage,oneof"` +} + +type ButtonsMessage_ImageMessage struct { + ImageMessage *ImageMessage `protobuf:"bytes,3,opt,name=imageMessage,oneof"` +} + +type ButtonsMessage_VideoMessage struct { + VideoMessage *VideoMessage `protobuf:"bytes,4,opt,name=videoMessage,oneof"` +} + +type ButtonsMessage_LocationMessage struct { + LocationMessage *LocationMessage `protobuf:"bytes,5,opt,name=locationMessage,oneof"` +} + +func (*ButtonsMessage_Text) isButtonsMessage_Header() {} + +func (*ButtonsMessage_DocumentMessage) isButtonsMessage_Header() {} + +func (*ButtonsMessage_ImageMessage) isButtonsMessage_Header() {} + +func (*ButtonsMessage_VideoMessage) isButtonsMessage_Header() {} + +func (*ButtonsMessage_LocationMessage) isButtonsMessage_Header() {} + +type AudioMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + 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"` + MediaKeyTimestamp *int64 `protobuf:"varint,10,opt,name=mediaKeyTimestamp" json:"mediaKeyTimestamp,omitempty"` + ContextInfo *ContextInfo `protobuf:"bytes,17,opt,name=contextInfo" json:"contextInfo,omitempty"` + StreamingSidecar []byte `protobuf:"bytes,18,opt,name=streamingSidecar" json:"streamingSidecar,omitempty"` + Waveform []byte `protobuf:"bytes,19,opt,name=waveform" json:"waveform,omitempty"` + BackgroundArgb *uint32 `protobuf:"fixed32,20,opt,name=backgroundArgb" json:"backgroundArgb,omitempty"` +} + +func (x *AudioMessage) Reset() { + *x = AudioMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[36] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AudioMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AudioMessage) ProtoMessage() {} + +func (x *AudioMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[36] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AudioMessage.ProtoReflect.Descriptor instead. +func (*AudioMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{36} +} + +func (x *AudioMessage) GetUrl() string { + if x != nil && x.Url != nil { + return *x.Url + } + return "" +} + +func (x *AudioMessage) GetMimetype() string { + if x != nil && x.Mimetype != nil { + return *x.Mimetype + } + return "" +} + +func (x *AudioMessage) GetFileSha256() []byte { + if x != nil { + return x.FileSha256 + } + return nil +} + +func (x *AudioMessage) GetFileLength() uint64 { + if x != nil && x.FileLength != nil { + return *x.FileLength + } + return 0 +} + +func (x *AudioMessage) GetSeconds() uint32 { + if x != nil && x.Seconds != nil { + return *x.Seconds + } + return 0 +} + +func (x *AudioMessage) GetPtt() bool { + if x != nil && x.Ptt != nil { + return *x.Ptt + } + return false +} + +func (x *AudioMessage) GetMediaKey() []byte { + if x != nil { + return x.MediaKey + } + return nil +} + +func (x *AudioMessage) GetFileEncSha256() []byte { + if x != nil { + return x.FileEncSha256 + } + return nil +} + +func (x *AudioMessage) GetDirectPath() string { + if x != nil && x.DirectPath != nil { + return *x.DirectPath + } + return "" +} + +func (x *AudioMessage) GetMediaKeyTimestamp() int64 { + if x != nil && x.MediaKeyTimestamp != nil { + return *x.MediaKeyTimestamp + } + return 0 +} + +func (x *AudioMessage) GetContextInfo() *ContextInfo { + if x != nil { + return x.ContextInfo + } + return nil +} + +func (x *AudioMessage) GetStreamingSidecar() []byte { + if x != nil { + return x.StreamingSidecar + } + return nil +} + +func (x *AudioMessage) GetWaveform() []byte { + if x != nil { + return x.Waveform + } + return nil +} + +func (x *AudioMessage) GetBackgroundArgb() uint32 { + if x != nil && x.BackgroundArgb != nil { + return *x.BackgroundArgb + } + return 0 +} + +type AppStateSyncKey struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + KeyId *AppStateSyncKeyId `protobuf:"bytes,1,opt,name=keyId" json:"keyId,omitempty"` + KeyData *AppStateSyncKeyData `protobuf:"bytes,2,opt,name=keyData" json:"keyData,omitempty"` +} + +func (x *AppStateSyncKey) Reset() { + *x = AppStateSyncKey{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[37] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AppStateSyncKey) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AppStateSyncKey) ProtoMessage() {} + +func (x *AppStateSyncKey) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[37] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AppStateSyncKey.ProtoReflect.Descriptor instead. +func (*AppStateSyncKey) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{37} +} + +func (x *AppStateSyncKey) GetKeyId() *AppStateSyncKeyId { + if x != nil { + return x.KeyId + } + return nil +} + +func (x *AppStateSyncKey) GetKeyData() *AppStateSyncKeyData { + if x != nil { + return x.KeyData + } + return nil +} + +type AppStateSyncKeyShare struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Keys []*AppStateSyncKey `protobuf:"bytes,1,rep,name=keys" json:"keys,omitempty"` +} + +func (x *AppStateSyncKeyShare) Reset() { + *x = AppStateSyncKeyShare{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[38] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AppStateSyncKeyShare) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AppStateSyncKeyShare) ProtoMessage() {} + +func (x *AppStateSyncKeyShare) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[38] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AppStateSyncKeyShare.ProtoReflect.Descriptor instead. +func (*AppStateSyncKeyShare) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{38} +} + +func (x *AppStateSyncKeyShare) GetKeys() []*AppStateSyncKey { + if x != nil { + return x.Keys + } + return nil +} + +type AppStateSyncKeyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + KeyIds []*AppStateSyncKeyId `protobuf:"bytes,1,rep,name=keyIds" json:"keyIds,omitempty"` +} + +func (x *AppStateSyncKeyRequest) Reset() { + *x = AppStateSyncKeyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[39] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AppStateSyncKeyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AppStateSyncKeyRequest) ProtoMessage() {} + +func (x *AppStateSyncKeyRequest) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[39] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AppStateSyncKeyRequest.ProtoReflect.Descriptor instead. +func (*AppStateSyncKeyRequest) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{39} +} + +func (x *AppStateSyncKeyRequest) GetKeyIds() []*AppStateSyncKeyId { + if x != nil { + return x.KeyIds + } + return nil +} + +type AppStateSyncKeyId struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + KeyId []byte `protobuf:"bytes,1,opt,name=keyId" json:"keyId,omitempty"` +} + +func (x *AppStateSyncKeyId) Reset() { + *x = AppStateSyncKeyId{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[40] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AppStateSyncKeyId) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AppStateSyncKeyId) ProtoMessage() {} + +func (x *AppStateSyncKeyId) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[40] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AppStateSyncKeyId.ProtoReflect.Descriptor instead. +func (*AppStateSyncKeyId) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{40} +} + +func (x *AppStateSyncKeyId) GetKeyId() []byte { + if x != nil { + return x.KeyId + } + return nil +} + +type AppStateSyncKeyFingerprint struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RawId *uint32 `protobuf:"varint,1,opt,name=rawId" json:"rawId,omitempty"` + CurrentIndex *uint32 `protobuf:"varint,2,opt,name=currentIndex" json:"currentIndex,omitempty"` + DeviceIndexes []uint32 `protobuf:"varint,3,rep,packed,name=deviceIndexes" json:"deviceIndexes,omitempty"` +} + +func (x *AppStateSyncKeyFingerprint) Reset() { + *x = AppStateSyncKeyFingerprint{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[41] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AppStateSyncKeyFingerprint) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AppStateSyncKeyFingerprint) ProtoMessage() {} + +func (x *AppStateSyncKeyFingerprint) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[41] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AppStateSyncKeyFingerprint.ProtoReflect.Descriptor instead. +func (*AppStateSyncKeyFingerprint) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{41} +} + +func (x *AppStateSyncKeyFingerprint) GetRawId() uint32 { + if x != nil && x.RawId != nil { + return *x.RawId + } + return 0 +} + +func (x *AppStateSyncKeyFingerprint) GetCurrentIndex() uint32 { + if x != nil && x.CurrentIndex != nil { + return *x.CurrentIndex + } + return 0 +} + +func (x *AppStateSyncKeyFingerprint) GetDeviceIndexes() []uint32 { + if x != nil { + return x.DeviceIndexes + } + return nil +} + +type AppStateSyncKeyData struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + KeyData []byte `protobuf:"bytes,1,opt,name=keyData" json:"keyData,omitempty"` + Fingerprint *AppStateSyncKeyFingerprint `protobuf:"bytes,2,opt,name=fingerprint" json:"fingerprint,omitempty"` + Timestamp *int64 `protobuf:"varint,3,opt,name=timestamp" json:"timestamp,omitempty"` +} + +func (x *AppStateSyncKeyData) Reset() { + *x = AppStateSyncKeyData{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[42] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AppStateSyncKeyData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AppStateSyncKeyData) ProtoMessage() {} + +func (x *AppStateSyncKeyData) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[42] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AppStateSyncKeyData.ProtoReflect.Descriptor instead. +func (*AppStateSyncKeyData) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{42} +} + +func (x *AppStateSyncKeyData) GetKeyData() []byte { + if x != nil { + return x.KeyData + } + return nil +} + +func (x *AppStateSyncKeyData) GetFingerprint() *AppStateSyncKeyFingerprint { + if x != nil { + return x.Fingerprint + } + return nil +} + +func (x *AppStateSyncKeyData) GetTimestamp() int64 { + if x != nil && x.Timestamp != nil { + return *x.Timestamp + } + return 0 +} + +type AppStateFatalExceptionNotification struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CollectionNames []string `protobuf:"bytes,1,rep,name=collectionNames" json:"collectionNames,omitempty"` + Timestamp *int64 `protobuf:"varint,2,opt,name=timestamp" json:"timestamp,omitempty"` +} + +func (x *AppStateFatalExceptionNotification) Reset() { + *x = AppStateFatalExceptionNotification{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[43] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AppStateFatalExceptionNotification) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AppStateFatalExceptionNotification) ProtoMessage() {} + +func (x *AppStateFatalExceptionNotification) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[43] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AppStateFatalExceptionNotification.ProtoReflect.Descriptor instead. +func (*AppStateFatalExceptionNotification) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{43} +} + +func (x *AppStateFatalExceptionNotification) GetCollectionNames() []string { + if x != nil { + return x.CollectionNames + } + return nil +} + +func (x *AppStateFatalExceptionNotification) GetTimestamp() int64 { + if x != nil && x.Timestamp != nil { + return *x.Timestamp + } + return 0 +} + +type Location struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + 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"` +} + +func (x *Location) Reset() { + *x = Location{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[44] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Location) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Location) ProtoMessage() {} + +func (x *Location) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[44] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Location.ProtoReflect.Descriptor instead. +func (*Location) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{44} +} + +func (x *Location) GetDegreesLatitude() float64 { + if x != nil && x.DegreesLatitude != nil { + return *x.DegreesLatitude + } + return 0 +} + +func (x *Location) GetDegreesLongitude() float64 { + if x != nil && x.DegreesLongitude != nil { + return *x.DegreesLongitude + } + return 0 +} + +func (x *Location) GetName() string { + if x != nil && x.Name != nil { + return *x.Name + } + return "" +} + +type InteractiveAnnotation struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PolygonVertices []*Point `protobuf:"bytes,1,rep,name=polygonVertices" json:"polygonVertices,omitempty"` + // Types that are assignable to Action: + // + // *InteractiveAnnotation_Location + Action isInteractiveAnnotation_Action `protobuf_oneof:"action"` +} + +func (x *InteractiveAnnotation) Reset() { + *x = InteractiveAnnotation{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[45] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InteractiveAnnotation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InteractiveAnnotation) ProtoMessage() {} + +func (x *InteractiveAnnotation) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[45] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InteractiveAnnotation.ProtoReflect.Descriptor instead. +func (*InteractiveAnnotation) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{45} +} + +func (x *InteractiveAnnotation) GetPolygonVertices() []*Point { + if x != nil { + return x.PolygonVertices + } + return nil +} + +func (m *InteractiveAnnotation) GetAction() isInteractiveAnnotation_Action { + if m != nil { + return m.Action + } + return nil +} + +func (x *InteractiveAnnotation) GetLocation() *Location { + if x, ok := x.GetAction().(*InteractiveAnnotation_Location); ok { + return x.Location + } + return nil +} + +type isInteractiveAnnotation_Action interface { + isInteractiveAnnotation_Action() +} + +type InteractiveAnnotation_Location struct { + Location *Location `protobuf:"bytes,2,opt,name=location,oneof"` +} + +func (*InteractiveAnnotation_Location) isInteractiveAnnotation_Action() {} + +type HydratedTemplateButton struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Index *uint32 `protobuf:"varint,4,opt,name=index" json:"index,omitempty"` + // Types that are assignable to HydratedButton: + // + // *HydratedTemplateButton_QuickReplyButton + // *HydratedTemplateButton_UrlButton + // *HydratedTemplateButton_CallButton + HydratedButton isHydratedTemplateButton_HydratedButton `protobuf_oneof:"hydratedButton"` +} + +func (x *HydratedTemplateButton) Reset() { + *x = HydratedTemplateButton{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[46] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HydratedTemplateButton) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HydratedTemplateButton) ProtoMessage() {} + +func (x *HydratedTemplateButton) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[46] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HydratedTemplateButton.ProtoReflect.Descriptor instead. +func (*HydratedTemplateButton) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{46} +} + +func (x *HydratedTemplateButton) GetIndex() uint32 { + if x != nil && x.Index != nil { + return *x.Index + } + return 0 +} + +func (m *HydratedTemplateButton) GetHydratedButton() isHydratedTemplateButton_HydratedButton { + if m != nil { + return m.HydratedButton + } + return nil +} + +func (x *HydratedTemplateButton) GetQuickReplyButton() *HydratedTemplateButton_HydratedQuickReplyButton { + if x, ok := x.GetHydratedButton().(*HydratedTemplateButton_QuickReplyButton); ok { + return x.QuickReplyButton + } + return nil +} + +func (x *HydratedTemplateButton) GetUrlButton() *HydratedTemplateButton_HydratedURLButton { + if x, ok := x.GetHydratedButton().(*HydratedTemplateButton_UrlButton); ok { + return x.UrlButton + } + return nil +} + +func (x *HydratedTemplateButton) GetCallButton() *HydratedTemplateButton_HydratedCallButton { + if x, ok := x.GetHydratedButton().(*HydratedTemplateButton_CallButton); ok { + return x.CallButton + } + return nil +} + +type isHydratedTemplateButton_HydratedButton interface { + isHydratedTemplateButton_HydratedButton() +} + +type HydratedTemplateButton_QuickReplyButton struct { + QuickReplyButton *HydratedTemplateButton_HydratedQuickReplyButton `protobuf:"bytes,1,opt,name=quickReplyButton,oneof"` +} + +type HydratedTemplateButton_UrlButton struct { + UrlButton *HydratedTemplateButton_HydratedURLButton `protobuf:"bytes,2,opt,name=urlButton,oneof"` +} + +type HydratedTemplateButton_CallButton struct { + CallButton *HydratedTemplateButton_HydratedCallButton `protobuf:"bytes,3,opt,name=callButton,oneof"` +} + +func (*HydratedTemplateButton_QuickReplyButton) isHydratedTemplateButton_HydratedButton() {} + +func (*HydratedTemplateButton_UrlButton) isHydratedTemplateButton_HydratedButton() {} + +func (*HydratedTemplateButton_CallButton) isHydratedTemplateButton_HydratedButton() {} + +type DisappearingMode struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Initiator *DisappearingMode_Initiator `protobuf:"varint,1,opt,name=initiator,enum=proto.DisappearingMode_Initiator" json:"initiator,omitempty"` +} + +func (x *DisappearingMode) Reset() { + *x = DisappearingMode{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[47] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DisappearingMode) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DisappearingMode) ProtoMessage() {} + +func (x *DisappearingMode) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[47] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DisappearingMode.ProtoReflect.Descriptor instead. +func (*DisappearingMode) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{47} +} + +func (x *DisappearingMode) GetInitiator() DisappearingMode_Initiator { + if x != nil && x.Initiator != nil { + return *x.Initiator + } + return DisappearingMode_CHANGED_IN_CHAT +} + +type DeviceListMetadata struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SenderKeyHash []byte `protobuf:"bytes,1,opt,name=senderKeyHash" json:"senderKeyHash,omitempty"` + SenderTimestamp *uint64 `protobuf:"varint,2,opt,name=senderTimestamp" json:"senderTimestamp,omitempty"` + SenderKeyIndexes []uint32 `protobuf:"varint,3,rep,packed,name=senderKeyIndexes" json:"senderKeyIndexes,omitempty"` + RecipientKeyHash []byte `protobuf:"bytes,8,opt,name=recipientKeyHash" json:"recipientKeyHash,omitempty"` + RecipientTimestamp *uint64 `protobuf:"varint,9,opt,name=recipientTimestamp" json:"recipientTimestamp,omitempty"` + RecipientKeyIndexes []uint32 `protobuf:"varint,10,rep,packed,name=recipientKeyIndexes" json:"recipientKeyIndexes,omitempty"` +} + +func (x *DeviceListMetadata) Reset() { + *x = DeviceListMetadata{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[48] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeviceListMetadata) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeviceListMetadata) ProtoMessage() {} + +func (x *DeviceListMetadata) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[48] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeviceListMetadata.ProtoReflect.Descriptor instead. +func (*DeviceListMetadata) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{48} +} + +func (x *DeviceListMetadata) GetSenderKeyHash() []byte { + if x != nil { + return x.SenderKeyHash + } + return nil +} + +func (x *DeviceListMetadata) GetSenderTimestamp() uint64 { + if x != nil && x.SenderTimestamp != nil { + return *x.SenderTimestamp + } + return 0 +} + +func (x *DeviceListMetadata) GetSenderKeyIndexes() []uint32 { + if x != nil { + return x.SenderKeyIndexes + } + return nil +} + +func (x *DeviceListMetadata) GetRecipientKeyHash() []byte { + if x != nil { + return x.RecipientKeyHash + } + return nil +} + +func (x *DeviceListMetadata) GetRecipientTimestamp() uint64 { + if x != nil && x.RecipientTimestamp != nil { + return *x.RecipientTimestamp + } + return 0 +} + +func (x *DeviceListMetadata) GetRecipientKeyIndexes() []uint32 { + if x != nil { + return x.RecipientKeyIndexes + } + return nil +} + +type ContextInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + 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,opt,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"` + ForwardingScore *uint32 `protobuf:"varint,21,opt,name=forwardingScore" json:"forwardingScore,omitempty"` + IsForwarded *bool `protobuf:"varint,22,opt,name=isForwarded" json:"isForwarded,omitempty"` + QuotedAd *ContextInfo_AdReplyInfo `protobuf:"bytes,23,opt,name=quotedAd" json:"quotedAd,omitempty"` + PlaceholderKey *MessageKey `protobuf:"bytes,24,opt,name=placeholderKey" json:"placeholderKey,omitempty"` + Expiration *uint32 `protobuf:"varint,25,opt,name=expiration" json:"expiration,omitempty"` + EphemeralSettingTimestamp *int64 `protobuf:"varint,26,opt,name=ephemeralSettingTimestamp" json:"ephemeralSettingTimestamp,omitempty"` + EphemeralSharedSecret []byte `protobuf:"bytes,27,opt,name=ephemeralSharedSecret" json:"ephemeralSharedSecret,omitempty"` + ExternalAdReply *ContextInfo_ExternalAdReplyInfo `protobuf:"bytes,28,opt,name=externalAdReply" json:"externalAdReply,omitempty"` + EntryPointConversionSource *string `protobuf:"bytes,29,opt,name=entryPointConversionSource" json:"entryPointConversionSource,omitempty"` + EntryPointConversionApp *string `protobuf:"bytes,30,opt,name=entryPointConversionApp" json:"entryPointConversionApp,omitempty"` + EntryPointConversionDelaySeconds *uint32 `protobuf:"varint,31,opt,name=entryPointConversionDelaySeconds" json:"entryPointConversionDelaySeconds,omitempty"` + DisappearingMode *DisappearingMode `protobuf:"bytes,32,opt,name=disappearingMode" json:"disappearingMode,omitempty"` + ActionLink *ActionLink `protobuf:"bytes,33,opt,name=actionLink" json:"actionLink,omitempty"` + GroupSubject *string `protobuf:"bytes,34,opt,name=groupSubject" json:"groupSubject,omitempty"` + ParentGroupJid *string `protobuf:"bytes,35,opt,name=parentGroupJid" json:"parentGroupJid,omitempty"` + TrustBannerType *string `protobuf:"bytes,37,opt,name=trustBannerType" json:"trustBannerType,omitempty"` + TrustBannerAction *uint32 `protobuf:"varint,38,opt,name=trustBannerAction" json:"trustBannerAction,omitempty"` + IsSampled *bool `protobuf:"varint,39,opt,name=isSampled" json:"isSampled,omitempty"` +} + +func (x *ContextInfo) Reset() { + *x = ContextInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[49] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ContextInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ContextInfo) ProtoMessage() {} + +func (x *ContextInfo) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[49] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ContextInfo.ProtoReflect.Descriptor instead. +func (*ContextInfo) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{49} +} + +func (x *ContextInfo) GetStanzaId() string { + if x != nil && x.StanzaId != nil { + return *x.StanzaId + } + return "" +} + +func (x *ContextInfo) GetParticipant() string { + if x != nil && x.Participant != nil { + return *x.Participant + } + return "" +} + +func (x *ContextInfo) GetQuotedMessage() *Message { + if x != nil { + return x.QuotedMessage + } + return nil +} + +func (x *ContextInfo) GetRemoteJid() string { + if x != nil && x.RemoteJid != nil { + return *x.RemoteJid + } + return "" +} + +func (x *ContextInfo) GetMentionedJid() []string { + if x != nil { + return x.MentionedJid + } + return nil +} + +func (x *ContextInfo) GetConversionSource() string { + if x != nil && x.ConversionSource != nil { + return *x.ConversionSource + } + return "" +} + +func (x *ContextInfo) GetConversionData() []byte { + if x != nil { + return x.ConversionData + } + return nil +} + +func (x *ContextInfo) GetConversionDelaySeconds() uint32 { + if x != nil && x.ConversionDelaySeconds != nil { + return *x.ConversionDelaySeconds + } + return 0 +} + +func (x *ContextInfo) GetForwardingScore() uint32 { + if x != nil && x.ForwardingScore != nil { + return *x.ForwardingScore + } + return 0 +} + +func (x *ContextInfo) GetIsForwarded() bool { + if x != nil && x.IsForwarded != nil { + return *x.IsForwarded + } + return false +} + +func (x *ContextInfo) GetQuotedAd() *ContextInfo_AdReplyInfo { + if x != nil { + return x.QuotedAd + } + return nil +} + +func (x *ContextInfo) GetPlaceholderKey() *MessageKey { + if x != nil { + return x.PlaceholderKey + } + return nil +} + +func (x *ContextInfo) GetExpiration() uint32 { + if x != nil && x.Expiration != nil { + return *x.Expiration + } + return 0 +} + +func (x *ContextInfo) GetEphemeralSettingTimestamp() int64 { + if x != nil && x.EphemeralSettingTimestamp != nil { + return *x.EphemeralSettingTimestamp + } + return 0 +} + +func (x *ContextInfo) GetEphemeralSharedSecret() []byte { + if x != nil { + return x.EphemeralSharedSecret + } + return nil +} + +func (x *ContextInfo) GetExternalAdReply() *ContextInfo_ExternalAdReplyInfo { + if x != nil { + return x.ExternalAdReply + } + return nil +} + +func (x *ContextInfo) GetEntryPointConversionSource() string { + if x != nil && x.EntryPointConversionSource != nil { + return *x.EntryPointConversionSource + } + return "" +} + +func (x *ContextInfo) GetEntryPointConversionApp() string { + if x != nil && x.EntryPointConversionApp != nil { + return *x.EntryPointConversionApp + } + return "" +} + +func (x *ContextInfo) GetEntryPointConversionDelaySeconds() uint32 { + if x != nil && x.EntryPointConversionDelaySeconds != nil { + return *x.EntryPointConversionDelaySeconds + } + return 0 +} + +func (x *ContextInfo) GetDisappearingMode() *DisappearingMode { + if x != nil { + return x.DisappearingMode + } + return nil +} + +func (x *ContextInfo) GetActionLink() *ActionLink { + if x != nil { + return x.ActionLink + } + return nil +} + +func (x *ContextInfo) GetGroupSubject() string { + if x != nil && x.GroupSubject != nil { + return *x.GroupSubject + } + return "" +} + +func (x *ContextInfo) GetParentGroupJid() string { + if x != nil && x.ParentGroupJid != nil { + return *x.ParentGroupJid + } + return "" +} + +func (x *ContextInfo) GetTrustBannerType() string { + if x != nil && x.TrustBannerType != nil { + return *x.TrustBannerType + } + return "" +} + +func (x *ContextInfo) GetTrustBannerAction() uint32 { + if x != nil && x.TrustBannerAction != nil { + return *x.TrustBannerAction + } + return 0 +} + +func (x *ContextInfo) GetIsSampled() bool { + if x != nil && x.IsSampled != nil { + return *x.IsSampled + } + return false +} + +type ActionLink struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Url *string `protobuf:"bytes,1,opt,name=url" json:"url,omitempty"` + ButtonTitle *string `protobuf:"bytes,2,opt,name=buttonTitle" json:"buttonTitle,omitempty"` +} + +func (x *ActionLink) Reset() { + *x = ActionLink{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[50] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ActionLink) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ActionLink) ProtoMessage() {} + +func (x *ActionLink) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[50] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ActionLink.ProtoReflect.Descriptor instead. +func (*ActionLink) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{50} +} + +func (x *ActionLink) GetUrl() string { + if x != nil && x.Url != nil { + return *x.Url + } + return "" +} + +func (x *ActionLink) GetButtonTitle() string { + if x != nil && x.ButtonTitle != nil { + return *x.ButtonTitle + } + return "" +} + +type TemplateButton struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Index *uint32 `protobuf:"varint,4,opt,name=index" json:"index,omitempty"` + // Types that are assignable to Button: + // + // *TemplateButton_QuickReplyButton_ + // *TemplateButton_UrlButton + // *TemplateButton_CallButton_ + Button isTemplateButton_Button `protobuf_oneof:"button"` +} + +func (x *TemplateButton) Reset() { + *x = TemplateButton{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[51] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TemplateButton) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TemplateButton) ProtoMessage() {} + +func (x *TemplateButton) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[51] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TemplateButton.ProtoReflect.Descriptor instead. +func (*TemplateButton) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{51} +} + +func (x *TemplateButton) GetIndex() uint32 { + if x != nil && x.Index != nil { + return *x.Index + } + return 0 +} + +func (m *TemplateButton) GetButton() isTemplateButton_Button { + if m != nil { + return m.Button + } + return nil +} + +func (x *TemplateButton) GetQuickReplyButton() *TemplateButton_QuickReplyButton { + if x, ok := x.GetButton().(*TemplateButton_QuickReplyButton_); ok { + return x.QuickReplyButton + } + return nil +} + +func (x *TemplateButton) GetUrlButton() *TemplateButton_URLButton { + if x, ok := x.GetButton().(*TemplateButton_UrlButton); ok { + return x.UrlButton + } + return nil +} + +func (x *TemplateButton) GetCallButton() *TemplateButton_CallButton { + if x, ok := x.GetButton().(*TemplateButton_CallButton_); ok { + return x.CallButton + } + return nil +} + +type isTemplateButton_Button interface { + isTemplateButton_Button() +} + +type TemplateButton_QuickReplyButton_ struct { + QuickReplyButton *TemplateButton_QuickReplyButton `protobuf:"bytes,1,opt,name=quickReplyButton,oneof"` +} + +type TemplateButton_UrlButton struct { + UrlButton *TemplateButton_URLButton `protobuf:"bytes,2,opt,name=urlButton,oneof"` +} + +type TemplateButton_CallButton_ struct { + CallButton *TemplateButton_CallButton `protobuf:"bytes,3,opt,name=callButton,oneof"` +} + +func (*TemplateButton_QuickReplyButton_) isTemplateButton_Button() {} + +func (*TemplateButton_UrlButton) isTemplateButton_Button() {} + +func (*TemplateButton_CallButton_) isTemplateButton_Button() {} + +type Point struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + XDeprecated *int32 `protobuf:"varint,1,opt,name=xDeprecated" json:"xDeprecated,omitempty"` + YDeprecated *int32 `protobuf:"varint,2,opt,name=yDeprecated" json:"yDeprecated,omitempty"` + X *float64 `protobuf:"fixed64,3,opt,name=x" json:"x,omitempty"` + Y *float64 `protobuf:"fixed64,4,opt,name=y" json:"y,omitempty"` +} + +func (x *Point) Reset() { + *x = Point{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[52] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Point) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Point) ProtoMessage() {} + +func (x *Point) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[52] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Point.ProtoReflect.Descriptor instead. +func (*Point) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{52} +} + +func (x *Point) GetXDeprecated() int32 { + if x != nil && x.XDeprecated != nil { + return *x.XDeprecated + } + return 0 +} + +func (x *Point) GetYDeprecated() int32 { + if x != nil && x.YDeprecated != nil { + return *x.YDeprecated + } + return 0 +} + +func (x *Point) GetX() float64 { + if x != nil && x.X != nil { + return *x.X + } + return 0 +} + +func (x *Point) GetY() float64 { + if x != nil && x.Y != nil { + return *x.Y + } + return 0 +} + +type PaymentBackground struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id *string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + FileLength *uint64 `protobuf:"varint,2,opt,name=fileLength" json:"fileLength,omitempty"` + Width *uint32 `protobuf:"varint,3,opt,name=width" json:"width,omitempty"` + Height *uint32 `protobuf:"varint,4,opt,name=height" json:"height,omitempty"` + Mimetype *string `protobuf:"bytes,5,opt,name=mimetype" json:"mimetype,omitempty"` + PlaceholderArgb *uint32 `protobuf:"fixed32,6,opt,name=placeholderArgb" json:"placeholderArgb,omitempty"` + TextArgb *uint32 `protobuf:"fixed32,7,opt,name=textArgb" json:"textArgb,omitempty"` + SubtextArgb *uint32 `protobuf:"fixed32,8,opt,name=subtextArgb" json:"subtextArgb,omitempty"` + MediaData *PaymentBackground_MediaData `protobuf:"bytes,9,opt,name=mediaData" json:"mediaData,omitempty"` + Type *PaymentBackground_Type `protobuf:"varint,10,opt,name=type,enum=proto.PaymentBackground_Type" json:"type,omitempty"` +} + +func (x *PaymentBackground) Reset() { + *x = PaymentBackground{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[53] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PaymentBackground) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PaymentBackground) ProtoMessage() {} + +func (x *PaymentBackground) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[53] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PaymentBackground.ProtoReflect.Descriptor instead. +func (*PaymentBackground) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{53} +} + +func (x *PaymentBackground) GetId() string { + if x != nil && x.Id != nil { + return *x.Id + } + return "" +} + +func (x *PaymentBackground) GetFileLength() uint64 { + if x != nil && x.FileLength != nil { + return *x.FileLength + } + return 0 +} + +func (x *PaymentBackground) GetWidth() uint32 { + if x != nil && x.Width != nil { + return *x.Width + } + return 0 +} + +func (x *PaymentBackground) GetHeight() uint32 { + if x != nil && x.Height != nil { + return *x.Height + } + return 0 +} + +func (x *PaymentBackground) GetMimetype() string { + if x != nil && x.Mimetype != nil { + return *x.Mimetype + } + return "" +} + +func (x *PaymentBackground) GetPlaceholderArgb() uint32 { + if x != nil && x.PlaceholderArgb != nil { + return *x.PlaceholderArgb + } + return 0 +} + +func (x *PaymentBackground) GetTextArgb() uint32 { + if x != nil && x.TextArgb != nil { + return *x.TextArgb + } + return 0 +} + +func (x *PaymentBackground) GetSubtextArgb() uint32 { + if x != nil && x.SubtextArgb != nil { + return *x.SubtextArgb + } + return 0 +} + +func (x *PaymentBackground) GetMediaData() *PaymentBackground_MediaData { + if x != nil { + return x.MediaData + } + return nil +} + +func (x *PaymentBackground) GetType() PaymentBackground_Type { + if x != nil && x.Type != nil { + return *x.Type + } + return PaymentBackground_UNKNOWN +} + +type Money struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Value *int64 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"` + Offset *uint32 `protobuf:"varint,2,opt,name=offset" json:"offset,omitempty"` + CurrencyCode *string `protobuf:"bytes,3,opt,name=currencyCode" json:"currencyCode,omitempty"` +} + +func (x *Money) Reset() { + *x = Money{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[54] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Money) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Money) ProtoMessage() {} + +func (x *Money) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[54] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Money.ProtoReflect.Descriptor instead. +func (*Money) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{54} +} + +func (x *Money) GetValue() int64 { + if x != nil && x.Value != nil { + return *x.Value + } + return 0 +} + +func (x *Money) GetOffset() uint32 { + if x != nil && x.Offset != nil { + return *x.Offset + } + return 0 +} + +func (x *Money) GetCurrencyCode() string { + if x != nil && x.CurrencyCode != nil { + return *x.CurrencyCode + } + return "" +} + +type Message struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + 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"` + LiveLocationMessage *LiveLocationMessage `protobuf:"bytes,18,opt,name=liveLocationMessage" json:"liveLocationMessage,omitempty"` + RequestPaymentMessage *RequestPaymentMessage `protobuf:"bytes,22,opt,name=requestPaymentMessage" json:"requestPaymentMessage,omitempty"` + DeclinePaymentRequestMessage *DeclinePaymentRequestMessage `protobuf:"bytes,23,opt,name=declinePaymentRequestMessage" json:"declinePaymentRequestMessage,omitempty"` + CancelPaymentRequestMessage *CancelPaymentRequestMessage `protobuf:"bytes,24,opt,name=cancelPaymentRequestMessage" json:"cancelPaymentRequestMessage,omitempty"` + TemplateMessage *TemplateMessage `protobuf:"bytes,25,opt,name=templateMessage" json:"templateMessage,omitempty"` + StickerMessage *StickerMessage `protobuf:"bytes,26,opt,name=stickerMessage" json:"stickerMessage,omitempty"` + GroupInviteMessage *GroupInviteMessage `protobuf:"bytes,28,opt,name=groupInviteMessage" json:"groupInviteMessage,omitempty"` + TemplateButtonReplyMessage *TemplateButtonReplyMessage `protobuf:"bytes,29,opt,name=templateButtonReplyMessage" json:"templateButtonReplyMessage,omitempty"` + ProductMessage *ProductMessage `protobuf:"bytes,30,opt,name=productMessage" json:"productMessage,omitempty"` + DeviceSentMessage *DeviceSentMessage `protobuf:"bytes,31,opt,name=deviceSentMessage" json:"deviceSentMessage,omitempty"` + MessageContextInfo *MessageContextInfo `protobuf:"bytes,35,opt,name=messageContextInfo" json:"messageContextInfo,omitempty"` + ListMessage *ListMessage `protobuf:"bytes,36,opt,name=listMessage" json:"listMessage,omitempty"` + ViewOnceMessage *FutureProofMessage `protobuf:"bytes,37,opt,name=viewOnceMessage" json:"viewOnceMessage,omitempty"` + OrderMessage *OrderMessage `protobuf:"bytes,38,opt,name=orderMessage" json:"orderMessage,omitempty"` + ListResponseMessage *ListResponseMessage `protobuf:"bytes,39,opt,name=listResponseMessage" json:"listResponseMessage,omitempty"` + EphemeralMessage *FutureProofMessage `protobuf:"bytes,40,opt,name=ephemeralMessage" json:"ephemeralMessage,omitempty"` + InvoiceMessage *InvoiceMessage `protobuf:"bytes,41,opt,name=invoiceMessage" json:"invoiceMessage,omitempty"` + ButtonsMessage *ButtonsMessage `protobuf:"bytes,42,opt,name=buttonsMessage" json:"buttonsMessage,omitempty"` + ButtonsResponseMessage *ButtonsResponseMessage `protobuf:"bytes,43,opt,name=buttonsResponseMessage" json:"buttonsResponseMessage,omitempty"` + PaymentInviteMessage *PaymentInviteMessage `protobuf:"bytes,44,opt,name=paymentInviteMessage" json:"paymentInviteMessage,omitempty"` + InteractiveMessage *InteractiveMessage `protobuf:"bytes,45,opt,name=interactiveMessage" json:"interactiveMessage,omitempty"` + ReactionMessage *ReactionMessage `protobuf:"bytes,46,opt,name=reactionMessage" json:"reactionMessage,omitempty"` + StickerSyncRmrMessage *StickerSyncRMRMessage `protobuf:"bytes,47,opt,name=stickerSyncRmrMessage" json:"stickerSyncRmrMessage,omitempty"` + InteractiveResponseMessage *InteractiveResponseMessage `protobuf:"bytes,48,opt,name=interactiveResponseMessage" json:"interactiveResponseMessage,omitempty"` + PollCreationMessage *PollCreationMessage `protobuf:"bytes,49,opt,name=pollCreationMessage" json:"pollCreationMessage,omitempty"` + PollUpdateMessage *PollUpdateMessage `protobuf:"bytes,50,opt,name=pollUpdateMessage" json:"pollUpdateMessage,omitempty"` + KeepInChatMessage *KeepInChatMessage `protobuf:"bytes,51,opt,name=keepInChatMessage" json:"keepInChatMessage,omitempty"` + DocumentWithCaptionMessage *FutureProofMessage `protobuf:"bytes,53,opt,name=documentWithCaptionMessage" json:"documentWithCaptionMessage,omitempty"` + RequestPhoneNumberMessage *RequestPhoneNumberMessage `protobuf:"bytes,54,opt,name=requestPhoneNumberMessage" json:"requestPhoneNumberMessage,omitempty"` + ViewOnceMessageV2 *FutureProofMessage `protobuf:"bytes,55,opt,name=viewOnceMessageV2" json:"viewOnceMessageV2,omitempty"` + EncReactionMessage *EncReactionMessage `protobuf:"bytes,56,opt,name=encReactionMessage" json:"encReactionMessage,omitempty"` + EditedMessage *FutureProofMessage `protobuf:"bytes,58,opt,name=editedMessage" json:"editedMessage,omitempty"` + ViewOnceMessageV2Extension *FutureProofMessage `protobuf:"bytes,59,opt,name=viewOnceMessageV2Extension" json:"viewOnceMessageV2Extension,omitempty"` + PollCreationMessageV2 *PollCreationMessage `protobuf:"bytes,60,opt,name=pollCreationMessageV2" json:"pollCreationMessageV2,omitempty"` +} + +func (x *Message) Reset() { + *x = Message{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[55] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Message) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Message) ProtoMessage() {} + +func (x *Message) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[55] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Message.ProtoReflect.Descriptor instead. +func (*Message) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{55} +} + +func (x *Message) GetConversation() string { + if x != nil && x.Conversation != nil { + return *x.Conversation + } + return "" +} + +func (x *Message) GetSenderKeyDistributionMessage() *SenderKeyDistributionMessage { + if x != nil { + return x.SenderKeyDistributionMessage + } + return nil +} + +func (x *Message) GetImageMessage() *ImageMessage { + if x != nil { + return x.ImageMessage + } + return nil +} + +func (x *Message) GetContactMessage() *ContactMessage { + if x != nil { + return x.ContactMessage + } + return nil +} + +func (x *Message) GetLocationMessage() *LocationMessage { + if x != nil { + return x.LocationMessage + } + return nil +} + +func (x *Message) GetExtendedTextMessage() *ExtendedTextMessage { + if x != nil { + return x.ExtendedTextMessage + } + return nil +} + +func (x *Message) GetDocumentMessage() *DocumentMessage { + if x != nil { + return x.DocumentMessage + } + return nil +} + +func (x *Message) GetAudioMessage() *AudioMessage { + if x != nil { + return x.AudioMessage + } + return nil +} + +func (x *Message) GetVideoMessage() *VideoMessage { + if x != nil { + return x.VideoMessage + } + return nil +} + +func (x *Message) GetCall() *Call { + if x != nil { + return x.Call + } + return nil +} + +func (x *Message) GetChat() *Chat { + if x != nil { + return x.Chat + } + return nil +} + +func (x *Message) GetProtocolMessage() *ProtocolMessage { + if x != nil { + return x.ProtocolMessage + } + return nil +} + +func (x *Message) GetContactsArrayMessage() *ContactsArrayMessage { + if x != nil { + return x.ContactsArrayMessage + } + return nil +} + +func (x *Message) GetHighlyStructuredMessage() *HighlyStructuredMessage { + if x != nil { + return x.HighlyStructuredMessage + } + return nil +} + +func (x *Message) GetFastRatchetKeySenderKeyDistributionMessage() *SenderKeyDistributionMessage { + if x != nil { + return x.FastRatchetKeySenderKeyDistributionMessage + } + return nil +} + +func (x *Message) GetSendPaymentMessage() *SendPaymentMessage { + if x != nil { + return x.SendPaymentMessage + } + return nil +} + +func (x *Message) GetLiveLocationMessage() *LiveLocationMessage { + if x != nil { + return x.LiveLocationMessage + } + return nil +} + +func (x *Message) GetRequestPaymentMessage() *RequestPaymentMessage { + if x != nil { + return x.RequestPaymentMessage + } + return nil +} + +func (x *Message) GetDeclinePaymentRequestMessage() *DeclinePaymentRequestMessage { + if x != nil { + return x.DeclinePaymentRequestMessage + } + return nil +} + +func (x *Message) GetCancelPaymentRequestMessage() *CancelPaymentRequestMessage { + if x != nil { + return x.CancelPaymentRequestMessage + } + return nil +} + +func (x *Message) GetTemplateMessage() *TemplateMessage { + if x != nil { + return x.TemplateMessage + } + return nil +} + +func (x *Message) GetStickerMessage() *StickerMessage { + if x != nil { + return x.StickerMessage + } + return nil +} + +func (x *Message) GetGroupInviteMessage() *GroupInviteMessage { + if x != nil { + return x.GroupInviteMessage + } + return nil +} + +func (x *Message) GetTemplateButtonReplyMessage() *TemplateButtonReplyMessage { + if x != nil { + return x.TemplateButtonReplyMessage + } + return nil +} + +func (x *Message) GetProductMessage() *ProductMessage { + if x != nil { + return x.ProductMessage + } + return nil +} + +func (x *Message) GetDeviceSentMessage() *DeviceSentMessage { + if x != nil { + return x.DeviceSentMessage + } + return nil +} + +func (x *Message) GetMessageContextInfo() *MessageContextInfo { + if x != nil { + return x.MessageContextInfo + } + return nil +} + +func (x *Message) GetListMessage() *ListMessage { + if x != nil { + return x.ListMessage + } + return nil +} + +func (x *Message) GetViewOnceMessage() *FutureProofMessage { + if x != nil { + return x.ViewOnceMessage + } + return nil +} + +func (x *Message) GetOrderMessage() *OrderMessage { + if x != nil { + return x.OrderMessage + } + return nil +} + +func (x *Message) GetListResponseMessage() *ListResponseMessage { + if x != nil { + return x.ListResponseMessage + } + return nil +} + +func (x *Message) GetEphemeralMessage() *FutureProofMessage { + if x != nil { + return x.EphemeralMessage + } + return nil +} + +func (x *Message) GetInvoiceMessage() *InvoiceMessage { + if x != nil { + return x.InvoiceMessage + } + return nil +} + +func (x *Message) GetButtonsMessage() *ButtonsMessage { + if x != nil { + return x.ButtonsMessage + } + return nil +} + +func (x *Message) GetButtonsResponseMessage() *ButtonsResponseMessage { + if x != nil { + return x.ButtonsResponseMessage + } + return nil +} + +func (x *Message) GetPaymentInviteMessage() *PaymentInviteMessage { + if x != nil { + return x.PaymentInviteMessage + } + return nil +} + +func (x *Message) GetInteractiveMessage() *InteractiveMessage { + if x != nil { + return x.InteractiveMessage + } + return nil +} + +func (x *Message) GetReactionMessage() *ReactionMessage { + if x != nil { + return x.ReactionMessage + } + return nil +} + +func (x *Message) GetStickerSyncRmrMessage() *StickerSyncRMRMessage { + if x != nil { + return x.StickerSyncRmrMessage + } + return nil +} + +func (x *Message) GetInteractiveResponseMessage() *InteractiveResponseMessage { + if x != nil { + return x.InteractiveResponseMessage + } + return nil +} + +func (x *Message) GetPollCreationMessage() *PollCreationMessage { + if x != nil { + return x.PollCreationMessage + } + return nil +} + +func (x *Message) GetPollUpdateMessage() *PollUpdateMessage { + if x != nil { + return x.PollUpdateMessage + } + return nil +} + +func (x *Message) GetKeepInChatMessage() *KeepInChatMessage { + if x != nil { + return x.KeepInChatMessage + } + return nil +} + +func (x *Message) GetDocumentWithCaptionMessage() *FutureProofMessage { + if x != nil { + return x.DocumentWithCaptionMessage + } + return nil +} + +func (x *Message) GetRequestPhoneNumberMessage() *RequestPhoneNumberMessage { + if x != nil { + return x.RequestPhoneNumberMessage + } + return nil +} + +func (x *Message) GetViewOnceMessageV2() *FutureProofMessage { + if x != nil { + return x.ViewOnceMessageV2 + } + return nil +} + +func (x *Message) GetEncReactionMessage() *EncReactionMessage { + if x != nil { + return x.EncReactionMessage + } + return nil +} + +func (x *Message) GetEditedMessage() *FutureProofMessage { + if x != nil { + return x.EditedMessage + } + return nil +} + +func (x *Message) GetViewOnceMessageV2Extension() *FutureProofMessage { + if x != nil { + return x.ViewOnceMessageV2Extension + } + return nil +} + +func (x *Message) GetPollCreationMessageV2() *PollCreationMessage { + if x != nil { + return x.PollCreationMessageV2 + } + return nil +} + +type MessageContextInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DeviceListMetadata *DeviceListMetadata `protobuf:"bytes,1,opt,name=deviceListMetadata" json:"deviceListMetadata,omitempty"` + DeviceListMetadataVersion *int32 `protobuf:"varint,2,opt,name=deviceListMetadataVersion" json:"deviceListMetadataVersion,omitempty"` + MessageSecret []byte `protobuf:"bytes,3,opt,name=messageSecret" json:"messageSecret,omitempty"` + PaddingBytes []byte `protobuf:"bytes,4,opt,name=paddingBytes" json:"paddingBytes,omitempty"` +} + +func (x *MessageContextInfo) Reset() { + *x = MessageContextInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[56] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MessageContextInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MessageContextInfo) ProtoMessage() {} + +func (x *MessageContextInfo) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[56] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MessageContextInfo.ProtoReflect.Descriptor instead. +func (*MessageContextInfo) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{56} +} + +func (x *MessageContextInfo) GetDeviceListMetadata() *DeviceListMetadata { + if x != nil { + return x.DeviceListMetadata + } + return nil +} + +func (x *MessageContextInfo) GetDeviceListMetadataVersion() int32 { + if x != nil && x.DeviceListMetadataVersion != nil { + return *x.DeviceListMetadataVersion + } + return 0 +} + +func (x *MessageContextInfo) GetMessageSecret() []byte { + if x != nil { + return x.MessageSecret + } + return nil +} + +func (x *MessageContextInfo) GetPaddingBytes() []byte { + if x != nil { + return x.PaddingBytes + } + return nil +} + +type VideoMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + 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"` + MediaKeyTimestamp *int64 `protobuf:"varint,14,opt,name=mediaKeyTimestamp" json:"mediaKeyTimestamp,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"` + ViewOnce *bool `protobuf:"varint,20,opt,name=viewOnce" json:"viewOnce,omitempty"` + ThumbnailDirectPath *string `protobuf:"bytes,21,opt,name=thumbnailDirectPath" json:"thumbnailDirectPath,omitempty"` + ThumbnailSha256 []byte `protobuf:"bytes,22,opt,name=thumbnailSha256" json:"thumbnailSha256,omitempty"` + ThumbnailEncSha256 []byte `protobuf:"bytes,23,opt,name=thumbnailEncSha256" json:"thumbnailEncSha256,omitempty"` + StaticUrl *string `protobuf:"bytes,24,opt,name=staticUrl" json:"staticUrl,omitempty"` +} + +func (x *VideoMessage) Reset() { + *x = VideoMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[57] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VideoMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VideoMessage) ProtoMessage() {} + +func (x *VideoMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[57] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VideoMessage.ProtoReflect.Descriptor instead. +func (*VideoMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{57} +} + +func (x *VideoMessage) GetUrl() string { + if x != nil && x.Url != nil { + return *x.Url + } + return "" +} + +func (x *VideoMessage) GetMimetype() string { + if x != nil && x.Mimetype != nil { + return *x.Mimetype + } + return "" +} + +func (x *VideoMessage) GetFileSha256() []byte { + if x != nil { + return x.FileSha256 + } + return nil +} + +func (x *VideoMessage) GetFileLength() uint64 { + if x != nil && x.FileLength != nil { + return *x.FileLength + } + return 0 +} + +func (x *VideoMessage) GetSeconds() uint32 { + if x != nil && x.Seconds != nil { + return *x.Seconds + } + return 0 +} + +func (x *VideoMessage) GetMediaKey() []byte { + if x != nil { + return x.MediaKey + } + return nil +} + +func (x *VideoMessage) GetCaption() string { + if x != nil && x.Caption != nil { + return *x.Caption + } + return "" +} + +func (x *VideoMessage) GetGifPlayback() bool { + if x != nil && x.GifPlayback != nil { + return *x.GifPlayback + } + return false +} + +func (x *VideoMessage) GetHeight() uint32 { + if x != nil && x.Height != nil { + return *x.Height + } + return 0 +} + +func (x *VideoMessage) GetWidth() uint32 { + if x != nil && x.Width != nil { + return *x.Width + } + return 0 +} + +func (x *VideoMessage) GetFileEncSha256() []byte { + if x != nil { + return x.FileEncSha256 + } + return nil +} + +func (x *VideoMessage) GetInteractiveAnnotations() []*InteractiveAnnotation { + if x != nil { + return x.InteractiveAnnotations + } + return nil +} + +func (x *VideoMessage) GetDirectPath() string { + if x != nil && x.DirectPath != nil { + return *x.DirectPath + } + return "" +} + +func (x *VideoMessage) GetMediaKeyTimestamp() int64 { + if x != nil && x.MediaKeyTimestamp != nil { + return *x.MediaKeyTimestamp + } + return 0 +} + +func (x *VideoMessage) GetJpegThumbnail() []byte { + if x != nil { + return x.JpegThumbnail + } + return nil +} + +func (x *VideoMessage) GetContextInfo() *ContextInfo { + if x != nil { + return x.ContextInfo + } + return nil +} + +func (x *VideoMessage) GetStreamingSidecar() []byte { + if x != nil { + return x.StreamingSidecar + } + return nil +} + +func (x *VideoMessage) GetGifAttribution() VideoMessage_Attribution { + if x != nil && x.GifAttribution != nil { + return *x.GifAttribution + } + return VideoMessage_NONE +} + +func (x *VideoMessage) GetViewOnce() bool { + if x != nil && x.ViewOnce != nil { + return *x.ViewOnce + } + return false +} + +func (x *VideoMessage) GetThumbnailDirectPath() string { + if x != nil && x.ThumbnailDirectPath != nil { + return *x.ThumbnailDirectPath + } + return "" +} + +func (x *VideoMessage) GetThumbnailSha256() []byte { + if x != nil { + return x.ThumbnailSha256 + } + return nil +} + +func (x *VideoMessage) GetThumbnailEncSha256() []byte { + if x != nil { + return x.ThumbnailEncSha256 + } + return nil +} + +func (x *VideoMessage) GetStaticUrl() string { + if x != nil && x.StaticUrl != nil { + return *x.StaticUrl + } + return "" +} + +type TemplateMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ContextInfo *ContextInfo `protobuf:"bytes,3,opt,name=contextInfo" json:"contextInfo,omitempty"` + HydratedTemplate *TemplateMessage_HydratedFourRowTemplate `protobuf:"bytes,4,opt,name=hydratedTemplate" json:"hydratedTemplate,omitempty"` + TemplateId *string `protobuf:"bytes,9,opt,name=templateId" json:"templateId,omitempty"` + // Types that are assignable to Format: + // + // *TemplateMessage_FourRowTemplate_ + // *TemplateMessage_HydratedFourRowTemplate_ + // *TemplateMessage_InteractiveMessageTemplate + Format isTemplateMessage_Format `protobuf_oneof:"format"` +} + +func (x *TemplateMessage) Reset() { + *x = TemplateMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[58] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TemplateMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TemplateMessage) ProtoMessage() {} + +func (x *TemplateMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[58] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TemplateMessage.ProtoReflect.Descriptor instead. +func (*TemplateMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{58} +} + +func (x *TemplateMessage) GetContextInfo() *ContextInfo { + if x != nil { + return x.ContextInfo + } + return nil +} + +func (x *TemplateMessage) GetHydratedTemplate() *TemplateMessage_HydratedFourRowTemplate { + if x != nil { + return x.HydratedTemplate + } + return nil +} + +func (x *TemplateMessage) GetTemplateId() string { + if x != nil && x.TemplateId != nil { + return *x.TemplateId + } + return "" +} + +func (m *TemplateMessage) GetFormat() isTemplateMessage_Format { + if m != nil { + return m.Format + } + return nil +} + +func (x *TemplateMessage) GetFourRowTemplate() *TemplateMessage_FourRowTemplate { + if x, ok := x.GetFormat().(*TemplateMessage_FourRowTemplate_); ok { + return x.FourRowTemplate + } + return nil +} + +func (x *TemplateMessage) GetHydratedFourRowTemplate() *TemplateMessage_HydratedFourRowTemplate { + if x, ok := x.GetFormat().(*TemplateMessage_HydratedFourRowTemplate_); ok { + return x.HydratedFourRowTemplate + } + return nil +} + +func (x *TemplateMessage) GetInteractiveMessageTemplate() *InteractiveMessage { + if x, ok := x.GetFormat().(*TemplateMessage_InteractiveMessageTemplate); ok { + return x.InteractiveMessageTemplate + } + return nil +} + +type isTemplateMessage_Format interface { + isTemplateMessage_Format() +} + +type TemplateMessage_FourRowTemplate_ struct { + FourRowTemplate *TemplateMessage_FourRowTemplate `protobuf:"bytes,1,opt,name=fourRowTemplate,oneof"` +} + +type TemplateMessage_HydratedFourRowTemplate_ struct { + HydratedFourRowTemplate *TemplateMessage_HydratedFourRowTemplate `protobuf:"bytes,2,opt,name=hydratedFourRowTemplate,oneof"` +} + +type TemplateMessage_InteractiveMessageTemplate struct { + InteractiveMessageTemplate *InteractiveMessage `protobuf:"bytes,5,opt,name=interactiveMessageTemplate,oneof"` +} + +func (*TemplateMessage_FourRowTemplate_) isTemplateMessage_Format() {} + +func (*TemplateMessage_HydratedFourRowTemplate_) isTemplateMessage_Format() {} + +func (*TemplateMessage_InteractiveMessageTemplate) isTemplateMessage_Format() {} + +type TemplateButtonReplyMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SelectedId *string `protobuf:"bytes,1,opt,name=selectedId" json:"selectedId,omitempty"` + SelectedDisplayText *string `protobuf:"bytes,2,opt,name=selectedDisplayText" json:"selectedDisplayText,omitempty"` + ContextInfo *ContextInfo `protobuf:"bytes,3,opt,name=contextInfo" json:"contextInfo,omitempty"` + SelectedIndex *uint32 `protobuf:"varint,4,opt,name=selectedIndex" json:"selectedIndex,omitempty"` +} + +func (x *TemplateButtonReplyMessage) Reset() { + *x = TemplateButtonReplyMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[59] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TemplateButtonReplyMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TemplateButtonReplyMessage) ProtoMessage() {} + +func (x *TemplateButtonReplyMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[59] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TemplateButtonReplyMessage.ProtoReflect.Descriptor instead. +func (*TemplateButtonReplyMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{59} +} + +func (x *TemplateButtonReplyMessage) GetSelectedId() string { + if x != nil && x.SelectedId != nil { + return *x.SelectedId + } + return "" +} + +func (x *TemplateButtonReplyMessage) GetSelectedDisplayText() string { + if x != nil && x.SelectedDisplayText != nil { + return *x.SelectedDisplayText + } + return "" +} + +func (x *TemplateButtonReplyMessage) GetContextInfo() *ContextInfo { + if x != nil { + return x.ContextInfo + } + return nil +} + +func (x *TemplateButtonReplyMessage) GetSelectedIndex() uint32 { + if x != nil && x.SelectedIndex != nil { + return *x.SelectedIndex + } + return 0 +} + +type StickerSyncRMRMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Filehash []string `protobuf:"bytes,1,rep,name=filehash" json:"filehash,omitempty"` + RmrSource *string `protobuf:"bytes,2,opt,name=rmrSource" json:"rmrSource,omitempty"` + RequestTimestamp *int64 `protobuf:"varint,3,opt,name=requestTimestamp" json:"requestTimestamp,omitempty"` +} + +func (x *StickerSyncRMRMessage) Reset() { + *x = StickerSyncRMRMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[60] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StickerSyncRMRMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StickerSyncRMRMessage) ProtoMessage() {} + +func (x *StickerSyncRMRMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[60] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StickerSyncRMRMessage.ProtoReflect.Descriptor instead. +func (*StickerSyncRMRMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{60} +} + +func (x *StickerSyncRMRMessage) GetFilehash() []string { + if x != nil { + return x.Filehash + } + return nil +} + +func (x *StickerSyncRMRMessage) GetRmrSource() string { + if x != nil && x.RmrSource != nil { + return *x.RmrSource + } + return "" +} + +func (x *StickerSyncRMRMessage) GetRequestTimestamp() int64 { + if x != nil && x.RequestTimestamp != nil { + return *x.RequestTimestamp + } + return 0 +} + +type StickerMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + 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"` + MediaKeyTimestamp *int64 `protobuf:"varint,10,opt,name=mediaKeyTimestamp" json:"mediaKeyTimestamp,omitempty"` + FirstFrameLength *uint32 `protobuf:"varint,11,opt,name=firstFrameLength" json:"firstFrameLength,omitempty"` + FirstFrameSidecar []byte `protobuf:"bytes,12,opt,name=firstFrameSidecar" json:"firstFrameSidecar,omitempty"` + IsAnimated *bool `protobuf:"varint,13,opt,name=isAnimated" json:"isAnimated,omitempty"` + PngThumbnail []byte `protobuf:"bytes,16,opt,name=pngThumbnail" json:"pngThumbnail,omitempty"` + ContextInfo *ContextInfo `protobuf:"bytes,17,opt,name=contextInfo" json:"contextInfo,omitempty"` + StickerSentTs *int64 `protobuf:"varint,18,opt,name=stickerSentTs" json:"stickerSentTs,omitempty"` + IsAvatar *bool `protobuf:"varint,19,opt,name=isAvatar" json:"isAvatar,omitempty"` +} + +func (x *StickerMessage) Reset() { + *x = StickerMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[61] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StickerMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StickerMessage) ProtoMessage() {} + +func (x *StickerMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[61] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StickerMessage.ProtoReflect.Descriptor instead. +func (*StickerMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{61} +} + +func (x *StickerMessage) GetUrl() string { + if x != nil && x.Url != nil { + return *x.Url + } + return "" +} + +func (x *StickerMessage) GetFileSha256() []byte { + if x != nil { + return x.FileSha256 + } + return nil +} + +func (x *StickerMessage) GetFileEncSha256() []byte { + if x != nil { + return x.FileEncSha256 + } + return nil +} + +func (x *StickerMessage) GetMediaKey() []byte { + if x != nil { + return x.MediaKey + } + return nil +} + +func (x *StickerMessage) GetMimetype() string { + if x != nil && x.Mimetype != nil { + return *x.Mimetype + } + return "" +} + +func (x *StickerMessage) GetHeight() uint32 { + if x != nil && x.Height != nil { + return *x.Height + } + return 0 +} + +func (x *StickerMessage) GetWidth() uint32 { + if x != nil && x.Width != nil { + return *x.Width + } + return 0 +} + +func (x *StickerMessage) GetDirectPath() string { + if x != nil && x.DirectPath != nil { + return *x.DirectPath + } + return "" +} + +func (x *StickerMessage) GetFileLength() uint64 { + if x != nil && x.FileLength != nil { + return *x.FileLength + } + return 0 +} + +func (x *StickerMessage) GetMediaKeyTimestamp() int64 { + if x != nil && x.MediaKeyTimestamp != nil { + return *x.MediaKeyTimestamp + } + return 0 +} + +func (x *StickerMessage) GetFirstFrameLength() uint32 { + if x != nil && x.FirstFrameLength != nil { + return *x.FirstFrameLength + } + return 0 +} + +func (x *StickerMessage) GetFirstFrameSidecar() []byte { + if x != nil { + return x.FirstFrameSidecar + } + return nil +} + +func (x *StickerMessage) GetIsAnimated() bool { + if x != nil && x.IsAnimated != nil { + return *x.IsAnimated + } + return false +} + +func (x *StickerMessage) GetPngThumbnail() []byte { + if x != nil { + return x.PngThumbnail + } + return nil +} + +func (x *StickerMessage) GetContextInfo() *ContextInfo { + if x != nil { + return x.ContextInfo + } + return nil +} + +func (x *StickerMessage) GetStickerSentTs() int64 { + if x != nil && x.StickerSentTs != nil { + return *x.StickerSentTs + } + return 0 +} + +func (x *StickerMessage) GetIsAvatar() bool { + if x != nil && x.IsAvatar != nil { + return *x.IsAvatar + } + return false +} + +type SenderKeyDistributionMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + GroupId *string `protobuf:"bytes,1,opt,name=groupId" json:"groupId,omitempty"` + AxolotlSenderKeyDistributionMessage []byte `protobuf:"bytes,2,opt,name=axolotlSenderKeyDistributionMessage" json:"axolotlSenderKeyDistributionMessage,omitempty"` +} + +func (x *SenderKeyDistributionMessage) Reset() { + *x = SenderKeyDistributionMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[62] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SenderKeyDistributionMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SenderKeyDistributionMessage) ProtoMessage() {} + +func (x *SenderKeyDistributionMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[62] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SenderKeyDistributionMessage.ProtoReflect.Descriptor instead. +func (*SenderKeyDistributionMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{62} +} + +func (x *SenderKeyDistributionMessage) GetGroupId() string { + if x != nil && x.GroupId != nil { + return *x.GroupId + } + return "" +} + +func (x *SenderKeyDistributionMessage) GetAxolotlSenderKeyDistributionMessage() []byte { + if x != nil { + return x.AxolotlSenderKeyDistributionMessage + } + return nil +} + +type SendPaymentMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NoteMessage *Message `protobuf:"bytes,2,opt,name=noteMessage" json:"noteMessage,omitempty"` + RequestMessageKey *MessageKey `protobuf:"bytes,3,opt,name=requestMessageKey" json:"requestMessageKey,omitempty"` + Background *PaymentBackground `protobuf:"bytes,4,opt,name=background" json:"background,omitempty"` +} + +func (x *SendPaymentMessage) Reset() { + *x = SendPaymentMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[63] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SendPaymentMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendPaymentMessage) ProtoMessage() {} + +func (x *SendPaymentMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[63] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendPaymentMessage.ProtoReflect.Descriptor instead. +func (*SendPaymentMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{63} +} + +func (x *SendPaymentMessage) GetNoteMessage() *Message { + if x != nil { + return x.NoteMessage + } + return nil +} + +func (x *SendPaymentMessage) GetRequestMessageKey() *MessageKey { + if x != nil { + return x.RequestMessageKey + } + return nil +} + +func (x *SendPaymentMessage) GetBackground() *PaymentBackground { + if x != nil { + return x.Background + } + return nil +} + +type RequestPhoneNumberMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ContextInfo *ContextInfo `protobuf:"bytes,1,opt,name=contextInfo" json:"contextInfo,omitempty"` +} + +func (x *RequestPhoneNumberMessage) Reset() { + *x = RequestPhoneNumberMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[64] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RequestPhoneNumberMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RequestPhoneNumberMessage) ProtoMessage() {} + +func (x *RequestPhoneNumberMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[64] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RequestPhoneNumberMessage.ProtoReflect.Descriptor instead. +func (*RequestPhoneNumberMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{64} +} + +func (x *RequestPhoneNumberMessage) GetContextInfo() *ContextInfo { + if x != nil { + return x.ContextInfo + } + return nil +} + +type RequestPaymentMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + NoteMessage *Message `protobuf:"bytes,4,opt,name=noteMessage" json:"noteMessage,omitempty"` + 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"` + ExpiryTimestamp *int64 `protobuf:"varint,5,opt,name=expiryTimestamp" json:"expiryTimestamp,omitempty"` + Amount *Money `protobuf:"bytes,6,opt,name=amount" json:"amount,omitempty"` + Background *PaymentBackground `protobuf:"bytes,7,opt,name=background" json:"background,omitempty"` +} + +func (x *RequestPaymentMessage) Reset() { + *x = RequestPaymentMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[65] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RequestPaymentMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RequestPaymentMessage) ProtoMessage() {} + +func (x *RequestPaymentMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[65] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RequestPaymentMessage.ProtoReflect.Descriptor instead. +func (*RequestPaymentMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{65} +} + +func (x *RequestPaymentMessage) GetNoteMessage() *Message { + if x != nil { + return x.NoteMessage + } + return nil +} + +func (x *RequestPaymentMessage) GetCurrencyCodeIso4217() string { + if x != nil && x.CurrencyCodeIso4217 != nil { + return *x.CurrencyCodeIso4217 + } + return "" +} + +func (x *RequestPaymentMessage) GetAmount1000() uint64 { + if x != nil && x.Amount1000 != nil { + return *x.Amount1000 + } + return 0 +} + +func (x *RequestPaymentMessage) GetRequestFrom() string { + if x != nil && x.RequestFrom != nil { + return *x.RequestFrom + } + return "" +} + +func (x *RequestPaymentMessage) GetExpiryTimestamp() int64 { + if x != nil && x.ExpiryTimestamp != nil { + return *x.ExpiryTimestamp + } + return 0 +} + +func (x *RequestPaymentMessage) GetAmount() *Money { + if x != nil { + return x.Amount + } + return nil +} + +func (x *RequestPaymentMessage) GetBackground() *PaymentBackground { + if x != nil { + return x.Background + } + return nil +} + +type ReactionMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key *MessageKey `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` + Text *string `protobuf:"bytes,2,opt,name=text" json:"text,omitempty"` + GroupingKey *string `protobuf:"bytes,3,opt,name=groupingKey" json:"groupingKey,omitempty"` + SenderTimestampMs *int64 `protobuf:"varint,4,opt,name=senderTimestampMs" json:"senderTimestampMs,omitempty"` +} + +func (x *ReactionMessage) Reset() { + *x = ReactionMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[66] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ReactionMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReactionMessage) ProtoMessage() {} + +func (x *ReactionMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[66] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReactionMessage.ProtoReflect.Descriptor instead. +func (*ReactionMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{66} +} + +func (x *ReactionMessage) GetKey() *MessageKey { + if x != nil { + return x.Key + } + return nil +} + +func (x *ReactionMessage) GetText() string { + if x != nil && x.Text != nil { + return *x.Text + } + return "" +} + +func (x *ReactionMessage) GetGroupingKey() string { + if x != nil && x.GroupingKey != nil { + return *x.GroupingKey + } + return "" +} + +func (x *ReactionMessage) GetSenderTimestampMs() int64 { + if x != nil && x.SenderTimestampMs != nil { + return *x.SenderTimestampMs + } + return 0 +} + +type ProtocolMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + 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"` + EphemeralExpiration *uint32 `protobuf:"varint,4,opt,name=ephemeralExpiration" json:"ephemeralExpiration,omitempty"` + EphemeralSettingTimestamp *int64 `protobuf:"varint,5,opt,name=ephemeralSettingTimestamp" json:"ephemeralSettingTimestamp,omitempty"` + HistorySyncNotification *HistorySyncNotification `protobuf:"bytes,6,opt,name=historySyncNotification" json:"historySyncNotification,omitempty"` + AppStateSyncKeyShare *AppStateSyncKeyShare `protobuf:"bytes,7,opt,name=appStateSyncKeyShare" json:"appStateSyncKeyShare,omitempty"` + AppStateSyncKeyRequest *AppStateSyncKeyRequest `protobuf:"bytes,8,opt,name=appStateSyncKeyRequest" json:"appStateSyncKeyRequest,omitempty"` + InitialSecurityNotificationSettingSync *InitialSecurityNotificationSettingSync `protobuf:"bytes,9,opt,name=initialSecurityNotificationSettingSync" json:"initialSecurityNotificationSettingSync,omitempty"` + AppStateFatalExceptionNotification *AppStateFatalExceptionNotification `protobuf:"bytes,10,opt,name=appStateFatalExceptionNotification" json:"appStateFatalExceptionNotification,omitempty"` + DisappearingMode *DisappearingMode `protobuf:"bytes,11,opt,name=disappearingMode" json:"disappearingMode,omitempty"` + EditedMessage *Message `protobuf:"bytes,14,opt,name=editedMessage" json:"editedMessage,omitempty"` + TimestampMs *int64 `protobuf:"varint,15,opt,name=timestampMs" json:"timestampMs,omitempty"` + PeerDataOperationRequestMessage *PeerDataOperationRequestMessage `protobuf:"bytes,16,opt,name=peerDataOperationRequestMessage" json:"peerDataOperationRequestMessage,omitempty"` + PeerDataOperationRequestResponseMessage *PeerDataOperationRequestResponseMessage `protobuf:"bytes,17,opt,name=peerDataOperationRequestResponseMessage" json:"peerDataOperationRequestResponseMessage,omitempty"` +} + +func (x *ProtocolMessage) Reset() { + *x = ProtocolMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[67] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ProtocolMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProtocolMessage) ProtoMessage() {} + +func (x *ProtocolMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[67] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ProtocolMessage.ProtoReflect.Descriptor instead. +func (*ProtocolMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{67} +} + +func (x *ProtocolMessage) GetKey() *MessageKey { + if x != nil { + return x.Key + } + return nil +} + +func (x *ProtocolMessage) GetType() ProtocolMessage_Type { + if x != nil && x.Type != nil { + return *x.Type + } + return ProtocolMessage_REVOKE +} + +func (x *ProtocolMessage) GetEphemeralExpiration() uint32 { + if x != nil && x.EphemeralExpiration != nil { + return *x.EphemeralExpiration + } + return 0 +} + +func (x *ProtocolMessage) GetEphemeralSettingTimestamp() int64 { + if x != nil && x.EphemeralSettingTimestamp != nil { + return *x.EphemeralSettingTimestamp + } + return 0 +} + +func (x *ProtocolMessage) GetHistorySyncNotification() *HistorySyncNotification { + if x != nil { + return x.HistorySyncNotification + } + return nil +} + +func (x *ProtocolMessage) GetAppStateSyncKeyShare() *AppStateSyncKeyShare { + if x != nil { + return x.AppStateSyncKeyShare + } + return nil +} + +func (x *ProtocolMessage) GetAppStateSyncKeyRequest() *AppStateSyncKeyRequest { + if x != nil { + return x.AppStateSyncKeyRequest + } + return nil +} + +func (x *ProtocolMessage) GetInitialSecurityNotificationSettingSync() *InitialSecurityNotificationSettingSync { + if x != nil { + return x.InitialSecurityNotificationSettingSync + } + return nil +} + +func (x *ProtocolMessage) GetAppStateFatalExceptionNotification() *AppStateFatalExceptionNotification { + if x != nil { + return x.AppStateFatalExceptionNotification + } + return nil +} + +func (x *ProtocolMessage) GetDisappearingMode() *DisappearingMode { + if x != nil { + return x.DisappearingMode + } + return nil +} + +func (x *ProtocolMessage) GetEditedMessage() *Message { + if x != nil { + return x.EditedMessage + } + return nil +} + +func (x *ProtocolMessage) GetTimestampMs() int64 { + if x != nil && x.TimestampMs != nil { + return *x.TimestampMs + } + return 0 +} + +func (x *ProtocolMessage) GetPeerDataOperationRequestMessage() *PeerDataOperationRequestMessage { + if x != nil { + return x.PeerDataOperationRequestMessage + } + return nil +} + +func (x *ProtocolMessage) GetPeerDataOperationRequestResponseMessage() *PeerDataOperationRequestResponseMessage { + if x != nil { + return x.PeerDataOperationRequestResponseMessage + } + return nil +} + +type ProductMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Product *ProductMessage_ProductSnapshot `protobuf:"bytes,1,opt,name=product" json:"product,omitempty"` + BusinessOwnerJid *string `protobuf:"bytes,2,opt,name=businessOwnerJid" json:"businessOwnerJid,omitempty"` + Catalog *ProductMessage_CatalogSnapshot `protobuf:"bytes,4,opt,name=catalog" json:"catalog,omitempty"` + Body *string `protobuf:"bytes,5,opt,name=body" json:"body,omitempty"` + Footer *string `protobuf:"bytes,6,opt,name=footer" json:"footer,omitempty"` + ContextInfo *ContextInfo `protobuf:"bytes,17,opt,name=contextInfo" json:"contextInfo,omitempty"` +} + +func (x *ProductMessage) Reset() { + *x = ProductMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[68] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ProductMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProductMessage) ProtoMessage() {} + +func (x *ProductMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[68] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ProductMessage.ProtoReflect.Descriptor instead. +func (*ProductMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{68} +} + +func (x *ProductMessage) GetProduct() *ProductMessage_ProductSnapshot { + if x != nil { + return x.Product + } + return nil +} + +func (x *ProductMessage) GetBusinessOwnerJid() string { + if x != nil && x.BusinessOwnerJid != nil { + return *x.BusinessOwnerJid + } + return "" +} + +func (x *ProductMessage) GetCatalog() *ProductMessage_CatalogSnapshot { + if x != nil { + return x.Catalog + } + return nil +} + +func (x *ProductMessage) GetBody() string { + if x != nil && x.Body != nil { + return *x.Body + } + return "" +} + +func (x *ProductMessage) GetFooter() string { + if x != nil && x.Footer != nil { + return *x.Footer + } + return "" +} + +func (x *ProductMessage) GetContextInfo() *ContextInfo { + if x != nil { + return x.ContextInfo + } + return nil +} + +type PollVoteMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SelectedOptions [][]byte `protobuf:"bytes,1,rep,name=selectedOptions" json:"selectedOptions,omitempty"` +} + +func (x *PollVoteMessage) Reset() { + *x = PollVoteMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[69] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PollVoteMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PollVoteMessage) ProtoMessage() {} + +func (x *PollVoteMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[69] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PollVoteMessage.ProtoReflect.Descriptor instead. +func (*PollVoteMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{69} +} + +func (x *PollVoteMessage) GetSelectedOptions() [][]byte { + if x != nil { + return x.SelectedOptions + } + return nil +} + +type PollUpdateMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PollCreationMessageKey *MessageKey `protobuf:"bytes,1,opt,name=pollCreationMessageKey" json:"pollCreationMessageKey,omitempty"` + Vote *PollEncValue `protobuf:"bytes,2,opt,name=vote" json:"vote,omitempty"` + Metadata *PollUpdateMessageMetadata `protobuf:"bytes,3,opt,name=metadata" json:"metadata,omitempty"` + SenderTimestampMs *int64 `protobuf:"varint,4,opt,name=senderTimestampMs" json:"senderTimestampMs,omitempty"` +} + +func (x *PollUpdateMessage) Reset() { + *x = PollUpdateMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[70] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PollUpdateMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PollUpdateMessage) ProtoMessage() {} + +func (x *PollUpdateMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[70] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PollUpdateMessage.ProtoReflect.Descriptor instead. +func (*PollUpdateMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{70} +} + +func (x *PollUpdateMessage) GetPollCreationMessageKey() *MessageKey { + if x != nil { + return x.PollCreationMessageKey + } + return nil +} + +func (x *PollUpdateMessage) GetVote() *PollEncValue { + if x != nil { + return x.Vote + } + return nil +} + +func (x *PollUpdateMessage) GetMetadata() *PollUpdateMessageMetadata { + if x != nil { + return x.Metadata + } + return nil +} + +func (x *PollUpdateMessage) GetSenderTimestampMs() int64 { + if x != nil && x.SenderTimestampMs != nil { + return *x.SenderTimestampMs + } + return 0 +} + +type PollUpdateMessageMetadata struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *PollUpdateMessageMetadata) Reset() { + *x = PollUpdateMessageMetadata{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[71] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PollUpdateMessageMetadata) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PollUpdateMessageMetadata) ProtoMessage() {} + +func (x *PollUpdateMessageMetadata) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[71] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PollUpdateMessageMetadata.ProtoReflect.Descriptor instead. +func (*PollUpdateMessageMetadata) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{71} +} + +type PollEncValue struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + EncPayload []byte `protobuf:"bytes,1,opt,name=encPayload" json:"encPayload,omitempty"` + EncIv []byte `protobuf:"bytes,2,opt,name=encIv" json:"encIv,omitempty"` +} + +func (x *PollEncValue) Reset() { + *x = PollEncValue{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[72] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PollEncValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PollEncValue) ProtoMessage() {} + +func (x *PollEncValue) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[72] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PollEncValue.ProtoReflect.Descriptor instead. +func (*PollEncValue) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{72} +} + +func (x *PollEncValue) GetEncPayload() []byte { + if x != nil { + return x.EncPayload + } + return nil +} + +func (x *PollEncValue) GetEncIv() []byte { + if x != nil { + return x.EncIv + } + return nil +} + +type PollCreationMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + EncKey []byte `protobuf:"bytes,1,opt,name=encKey" json:"encKey,omitempty"` + Name *string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` + Options []*PollCreationMessage_Option `protobuf:"bytes,3,rep,name=options" json:"options,omitempty"` + SelectableOptionsCount *uint32 `protobuf:"varint,4,opt,name=selectableOptionsCount" json:"selectableOptionsCount,omitempty"` + ContextInfo *ContextInfo `protobuf:"bytes,5,opt,name=contextInfo" json:"contextInfo,omitempty"` +} + +func (x *PollCreationMessage) Reset() { + *x = PollCreationMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[73] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PollCreationMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PollCreationMessage) ProtoMessage() {} + +func (x *PollCreationMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[73] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PollCreationMessage.ProtoReflect.Descriptor instead. +func (*PollCreationMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{73} +} + +func (x *PollCreationMessage) GetEncKey() []byte { + if x != nil { + return x.EncKey + } + return nil +} + +func (x *PollCreationMessage) GetName() string { + if x != nil && x.Name != nil { + return *x.Name + } + return "" +} + +func (x *PollCreationMessage) GetOptions() []*PollCreationMessage_Option { + if x != nil { + return x.Options + } + return nil +} + +func (x *PollCreationMessage) GetSelectableOptionsCount() uint32 { + if x != nil && x.SelectableOptionsCount != nil { + return *x.SelectableOptionsCount + } + return 0 +} + +func (x *PollCreationMessage) GetContextInfo() *ContextInfo { + if x != nil { + return x.ContextInfo + } + return nil +} + +type EphemeralSetting struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Duration *int32 `protobuf:"fixed32,1,opt,name=duration" json:"duration,omitempty"` + Timestamp *int64 `protobuf:"fixed64,2,opt,name=timestamp" json:"timestamp,omitempty"` +} + +func (x *EphemeralSetting) Reset() { + *x = EphemeralSetting{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[74] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EphemeralSetting) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EphemeralSetting) ProtoMessage() {} + +func (x *EphemeralSetting) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[74] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EphemeralSetting.ProtoReflect.Descriptor instead. +func (*EphemeralSetting) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{74} +} + +func (x *EphemeralSetting) GetDuration() int32 { + if x != nil && x.Duration != nil { + return *x.Duration + } + return 0 +} + +func (x *EphemeralSetting) GetTimestamp() int64 { + if x != nil && x.Timestamp != nil { + return *x.Timestamp + } + return 0 +} + +type WallpaperSettings struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Filename *string `protobuf:"bytes,1,opt,name=filename" json:"filename,omitempty"` + Opacity *uint32 `protobuf:"varint,2,opt,name=opacity" json:"opacity,omitempty"` +} + +func (x *WallpaperSettings) Reset() { + *x = WallpaperSettings{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[75] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WallpaperSettings) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WallpaperSettings) ProtoMessage() {} + +func (x *WallpaperSettings) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[75] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WallpaperSettings.ProtoReflect.Descriptor instead. +func (*WallpaperSettings) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{75} +} + +func (x *WallpaperSettings) GetFilename() string { + if x != nil && x.Filename != nil { + return *x.Filename + } + return "" +} + +func (x *WallpaperSettings) GetOpacity() uint32 { + if x != nil && x.Opacity != nil { + return *x.Opacity + } + return 0 +} + +type StickerMetadata struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + 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"` + Weight *float32 `protobuf:"fixed32,10,opt,name=weight" json:"weight,omitempty"` + LastStickerSentTs *int64 `protobuf:"varint,11,opt,name=lastStickerSentTs" json:"lastStickerSentTs,omitempty"` +} + +func (x *StickerMetadata) Reset() { + *x = StickerMetadata{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[76] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StickerMetadata) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StickerMetadata) ProtoMessage() {} + +func (x *StickerMetadata) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[76] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StickerMetadata.ProtoReflect.Descriptor instead. +func (*StickerMetadata) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{76} +} + +func (x *StickerMetadata) GetUrl() string { + if x != nil && x.Url != nil { + return *x.Url + } + return "" +} + +func (x *StickerMetadata) GetFileSha256() []byte { + if x != nil { + return x.FileSha256 + } + return nil +} + +func (x *StickerMetadata) GetFileEncSha256() []byte { + if x != nil { + return x.FileEncSha256 + } + return nil +} + +func (x *StickerMetadata) GetMediaKey() []byte { + if x != nil { + return x.MediaKey + } + return nil +} + +func (x *StickerMetadata) GetMimetype() string { + if x != nil && x.Mimetype != nil { + return *x.Mimetype + } + return "" +} + +func (x *StickerMetadata) GetHeight() uint32 { + if x != nil && x.Height != nil { + return *x.Height + } + return 0 +} + +func (x *StickerMetadata) GetWidth() uint32 { + if x != nil && x.Width != nil { + return *x.Width + } + return 0 +} + +func (x *StickerMetadata) GetDirectPath() string { + if x != nil && x.DirectPath != nil { + return *x.DirectPath + } + return "" +} + +func (x *StickerMetadata) GetFileLength() uint64 { + if x != nil && x.FileLength != nil { + return *x.FileLength + } + return 0 +} + +func (x *StickerMetadata) GetWeight() float32 { + if x != nil && x.Weight != nil { + return *x.Weight + } + return 0 +} + +func (x *StickerMetadata) GetLastStickerSentTs() int64 { + if x != nil && x.LastStickerSentTs != nil { + return *x.LastStickerSentTs + } + return 0 +} + +type Pushname struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id *string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + Pushname *string `protobuf:"bytes,2,opt,name=pushname" json:"pushname,omitempty"` +} + +func (x *Pushname) Reset() { + *x = Pushname{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[77] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Pushname) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Pushname) ProtoMessage() {} + +func (x *Pushname) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[77] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Pushname.ProtoReflect.Descriptor instead. +func (*Pushname) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{77} +} + +func (x *Pushname) GetId() string { + if x != nil && x.Id != nil { + return *x.Id + } + return "" +} + +func (x *Pushname) GetPushname() string { + if x != nil && x.Pushname != nil { + return *x.Pushname + } + return "" +} + +type PastParticipants struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + GroupJid *string `protobuf:"bytes,1,opt,name=groupJid" json:"groupJid,omitempty"` + PastParticipants []*PastParticipant `protobuf:"bytes,2,rep,name=pastParticipants" json:"pastParticipants,omitempty"` +} + +func (x *PastParticipants) Reset() { + *x = PastParticipants{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[78] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PastParticipants) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PastParticipants) ProtoMessage() {} + +func (x *PastParticipants) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[78] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PastParticipants.ProtoReflect.Descriptor instead. +func (*PastParticipants) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{78} +} + +func (x *PastParticipants) GetGroupJid() string { + if x != nil && x.GroupJid != nil { + return *x.GroupJid + } + return "" +} + +func (x *PastParticipants) GetPastParticipants() []*PastParticipant { + if x != nil { + return x.PastParticipants + } + return nil +} + +type PastParticipant struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserJid *string `protobuf:"bytes,1,opt,name=userJid" json:"userJid,omitempty"` + LeaveReason *PastParticipant_LeaveReason `protobuf:"varint,2,opt,name=leaveReason,enum=proto.PastParticipant_LeaveReason" json:"leaveReason,omitempty"` + LeaveTs *uint64 `protobuf:"varint,3,opt,name=leaveTs" json:"leaveTs,omitempty"` +} + +func (x *PastParticipant) Reset() { + *x = PastParticipant{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[79] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PastParticipant) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PastParticipant) ProtoMessage() {} + +func (x *PastParticipant) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[79] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PastParticipant.ProtoReflect.Descriptor instead. +func (*PastParticipant) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{79} +} + +func (x *PastParticipant) GetUserJid() string { + if x != nil && x.UserJid != nil { + return *x.UserJid + } + return "" +} + +func (x *PastParticipant) GetLeaveReason() PastParticipant_LeaveReason { + if x != nil && x.LeaveReason != nil { + return *x.LeaveReason + } + return PastParticipant_LEFT +} + +func (x *PastParticipant) GetLeaveTs() uint64 { + if x != nil && x.LeaveTs != nil { + return *x.LeaveTs + } + return 0 +} + +type HistorySync struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SyncType *HistorySync_HistorySyncType `protobuf:"varint,1,req,name=syncType,enum=proto.HistorySync_HistorySyncType" json:"syncType,omitempty"` + Conversations []*Conversation `protobuf:"bytes,2,rep,name=conversations" json:"conversations,omitempty"` + StatusV3Messages []*WebMessageInfo `protobuf:"bytes,3,rep,name=statusV3Messages" json:"statusV3Messages,omitempty"` + ChunkOrder *uint32 `protobuf:"varint,5,opt,name=chunkOrder" json:"chunkOrder,omitempty"` + Progress *uint32 `protobuf:"varint,6,opt,name=progress" json:"progress,omitempty"` + Pushnames []*Pushname `protobuf:"bytes,7,rep,name=pushnames" json:"pushnames,omitempty"` + GlobalSettings *GlobalSettings `protobuf:"bytes,8,opt,name=globalSettings" json:"globalSettings,omitempty"` + ThreadIdUserSecret []byte `protobuf:"bytes,9,opt,name=threadIdUserSecret" json:"threadIdUserSecret,omitempty"` + ThreadDsTimeframeOffset *uint32 `protobuf:"varint,10,opt,name=threadDsTimeframeOffset" json:"threadDsTimeframeOffset,omitempty"` + RecentStickers []*StickerMetadata `protobuf:"bytes,11,rep,name=recentStickers" json:"recentStickers,omitempty"` + PastParticipants []*PastParticipants `protobuf:"bytes,12,rep,name=pastParticipants" json:"pastParticipants,omitempty"` +} + +func (x *HistorySync) Reset() { + *x = HistorySync{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[80] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HistorySync) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HistorySync) ProtoMessage() {} + +func (x *HistorySync) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[80] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HistorySync.ProtoReflect.Descriptor instead. +func (*HistorySync) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{80} +} + +func (x *HistorySync) GetSyncType() HistorySync_HistorySyncType { + if x != nil && x.SyncType != nil { + return *x.SyncType + } + return HistorySync_INITIAL_BOOTSTRAP +} + +func (x *HistorySync) GetConversations() []*Conversation { + if x != nil { + return x.Conversations + } + return nil +} + +func (x *HistorySync) GetStatusV3Messages() []*WebMessageInfo { + if x != nil { + return x.StatusV3Messages + } + return nil +} + +func (x *HistorySync) GetChunkOrder() uint32 { + if x != nil && x.ChunkOrder != nil { + return *x.ChunkOrder + } + return 0 +} + +func (x *HistorySync) GetProgress() uint32 { + if x != nil && x.Progress != nil { + return *x.Progress + } + return 0 +} + +func (x *HistorySync) GetPushnames() []*Pushname { + if x != nil { + return x.Pushnames + } + return nil +} + +func (x *HistorySync) GetGlobalSettings() *GlobalSettings { + if x != nil { + return x.GlobalSettings + } + return nil +} + +func (x *HistorySync) GetThreadIdUserSecret() []byte { + if x != nil { + return x.ThreadIdUserSecret + } + return nil +} + +func (x *HistorySync) GetThreadDsTimeframeOffset() uint32 { + if x != nil && x.ThreadDsTimeframeOffset != nil { + return *x.ThreadDsTimeframeOffset + } + return 0 +} + +func (x *HistorySync) GetRecentStickers() []*StickerMetadata { + if x != nil { + return x.RecentStickers + } + return nil +} + +func (x *HistorySync) GetPastParticipants() []*PastParticipants { + if x != nil { + return x.PastParticipants + } + return nil +} + +type HistorySyncMsg struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Message *WebMessageInfo `protobuf:"bytes,1,opt,name=message" json:"message,omitempty"` + MsgOrderId *uint64 `protobuf:"varint,2,opt,name=msgOrderId" json:"msgOrderId,omitempty"` +} + +func (x *HistorySyncMsg) Reset() { + *x = HistorySyncMsg{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[81] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HistorySyncMsg) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HistorySyncMsg) ProtoMessage() {} + +func (x *HistorySyncMsg) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[81] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HistorySyncMsg.ProtoReflect.Descriptor instead. +func (*HistorySyncMsg) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{81} +} + +func (x *HistorySyncMsg) GetMessage() *WebMessageInfo { + if x != nil { + return x.Message + } + return nil +} + +func (x *HistorySyncMsg) GetMsgOrderId() uint64 { + if x != nil && x.MsgOrderId != nil { + return *x.MsgOrderId + } + return 0 +} + +type GroupParticipant struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserJid *string `protobuf:"bytes,1,req,name=userJid" json:"userJid,omitempty"` + Rank *GroupParticipant_Rank `protobuf:"varint,2,opt,name=rank,enum=proto.GroupParticipant_Rank" json:"rank,omitempty"` +} + +func (x *GroupParticipant) Reset() { + *x = GroupParticipant{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[82] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GroupParticipant) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GroupParticipant) ProtoMessage() {} + +func (x *GroupParticipant) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[82] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GroupParticipant.ProtoReflect.Descriptor instead. +func (*GroupParticipant) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{82} +} + +func (x *GroupParticipant) GetUserJid() string { + if x != nil && x.UserJid != nil { + return *x.UserJid + } + return "" +} + +func (x *GroupParticipant) GetRank() GroupParticipant_Rank { + if x != nil && x.Rank != nil { + return *x.Rank + } + return GroupParticipant_REGULAR +} + +type GlobalSettings struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + LightThemeWallpaper *WallpaperSettings `protobuf:"bytes,1,opt,name=lightThemeWallpaper" json:"lightThemeWallpaper,omitempty"` + MediaVisibility *MediaVisibility `protobuf:"varint,2,opt,name=mediaVisibility,enum=proto.MediaVisibility" json:"mediaVisibility,omitempty"` + DarkThemeWallpaper *WallpaperSettings `protobuf:"bytes,3,opt,name=darkThemeWallpaper" json:"darkThemeWallpaper,omitempty"` + AutoDownloadWiFi *AutoDownloadSettings `protobuf:"bytes,4,opt,name=autoDownloadWiFi" json:"autoDownloadWiFi,omitempty"` + AutoDownloadCellular *AutoDownloadSettings `protobuf:"bytes,5,opt,name=autoDownloadCellular" json:"autoDownloadCellular,omitempty"` + AutoDownloadRoaming *AutoDownloadSettings `protobuf:"bytes,6,opt,name=autoDownloadRoaming" json:"autoDownloadRoaming,omitempty"` + ShowIndividualNotificationsPreview *bool `protobuf:"varint,7,opt,name=showIndividualNotificationsPreview" json:"showIndividualNotificationsPreview,omitempty"` + ShowGroupNotificationsPreview *bool `protobuf:"varint,8,opt,name=showGroupNotificationsPreview" json:"showGroupNotificationsPreview,omitempty"` + DisappearingModeDuration *int32 `protobuf:"varint,9,opt,name=disappearingModeDuration" json:"disappearingModeDuration,omitempty"` + DisappearingModeTimestamp *int64 `protobuf:"varint,10,opt,name=disappearingModeTimestamp" json:"disappearingModeTimestamp,omitempty"` + AvatarUserSettings *AvatarUserSettings `protobuf:"bytes,11,opt,name=avatarUserSettings" json:"avatarUserSettings,omitempty"` +} + +func (x *GlobalSettings) Reset() { + *x = GlobalSettings{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[83] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GlobalSettings) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GlobalSettings) ProtoMessage() {} + +func (x *GlobalSettings) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[83] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GlobalSettings.ProtoReflect.Descriptor instead. +func (*GlobalSettings) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{83} +} + +func (x *GlobalSettings) GetLightThemeWallpaper() *WallpaperSettings { + if x != nil { + return x.LightThemeWallpaper + } + return nil +} + +func (x *GlobalSettings) GetMediaVisibility() MediaVisibility { + if x != nil && x.MediaVisibility != nil { + return *x.MediaVisibility + } + return MediaVisibility_DEFAULT +} + +func (x *GlobalSettings) GetDarkThemeWallpaper() *WallpaperSettings { + if x != nil { + return x.DarkThemeWallpaper + } + return nil +} + +func (x *GlobalSettings) GetAutoDownloadWiFi() *AutoDownloadSettings { + if x != nil { + return x.AutoDownloadWiFi + } + return nil +} + +func (x *GlobalSettings) GetAutoDownloadCellular() *AutoDownloadSettings { + if x != nil { + return x.AutoDownloadCellular + } + return nil +} + +func (x *GlobalSettings) GetAutoDownloadRoaming() *AutoDownloadSettings { + if x != nil { + return x.AutoDownloadRoaming + } + return nil +} + +func (x *GlobalSettings) GetShowIndividualNotificationsPreview() bool { + if x != nil && x.ShowIndividualNotificationsPreview != nil { + return *x.ShowIndividualNotificationsPreview + } + return false +} + +func (x *GlobalSettings) GetShowGroupNotificationsPreview() bool { + if x != nil && x.ShowGroupNotificationsPreview != nil { + return *x.ShowGroupNotificationsPreview + } + return false +} + +func (x *GlobalSettings) GetDisappearingModeDuration() int32 { + if x != nil && x.DisappearingModeDuration != nil { + return *x.DisappearingModeDuration + } + return 0 +} + +func (x *GlobalSettings) GetDisappearingModeTimestamp() int64 { + if x != nil && x.DisappearingModeTimestamp != nil { + return *x.DisappearingModeTimestamp + } + return 0 +} + +func (x *GlobalSettings) GetAvatarUserSettings() *AvatarUserSettings { + if x != nil { + return x.AvatarUserSettings + } + return nil +} + +type Conversation struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id *string `protobuf:"bytes,1,req,name=id" json:"id,omitempty"` + Messages []*HistorySyncMsg `protobuf:"bytes,2,rep,name=messages" json:"messages,omitempty"` + NewJid *string `protobuf:"bytes,3,opt,name=newJid" json:"newJid,omitempty"` + OldJid *string `protobuf:"bytes,4,opt,name=oldJid" json:"oldJid,omitempty"` + LastMsgTimestamp *uint64 `protobuf:"varint,5,opt,name=lastMsgTimestamp" json:"lastMsgTimestamp,omitempty"` + UnreadCount *uint32 `protobuf:"varint,6,opt,name=unreadCount" json:"unreadCount,omitempty"` + ReadOnly *bool `protobuf:"varint,7,opt,name=readOnly" json:"readOnly,omitempty"` + EndOfHistoryTransfer *bool `protobuf:"varint,8,opt,name=endOfHistoryTransfer" json:"endOfHistoryTransfer,omitempty"` + EphemeralExpiration *uint32 `protobuf:"varint,9,opt,name=ephemeralExpiration" json:"ephemeralExpiration,omitempty"` + EphemeralSettingTimestamp *int64 `protobuf:"varint,10,opt,name=ephemeralSettingTimestamp" json:"ephemeralSettingTimestamp,omitempty"` + EndOfHistoryTransferType *Conversation_EndOfHistoryTransferType `protobuf:"varint,11,opt,name=endOfHistoryTransferType,enum=proto.Conversation_EndOfHistoryTransferType" json:"endOfHistoryTransferType,omitempty"` + ConversationTimestamp *uint64 `protobuf:"varint,12,opt,name=conversationTimestamp" json:"conversationTimestamp,omitempty"` + Name *string `protobuf:"bytes,13,opt,name=name" json:"name,omitempty"` + PHash *string `protobuf:"bytes,14,opt,name=pHash" json:"pHash,omitempty"` + NotSpam *bool `protobuf:"varint,15,opt,name=notSpam" json:"notSpam,omitempty"` + Archived *bool `protobuf:"varint,16,opt,name=archived" json:"archived,omitempty"` + DisappearingMode *DisappearingMode `protobuf:"bytes,17,opt,name=disappearingMode" json:"disappearingMode,omitempty"` + UnreadMentionCount *uint32 `protobuf:"varint,18,opt,name=unreadMentionCount" json:"unreadMentionCount,omitempty"` + MarkedAsUnread *bool `protobuf:"varint,19,opt,name=markedAsUnread" json:"markedAsUnread,omitempty"` + Participant []*GroupParticipant `protobuf:"bytes,20,rep,name=participant" json:"participant,omitempty"` + TcToken []byte `protobuf:"bytes,21,opt,name=tcToken" json:"tcToken,omitempty"` + TcTokenTimestamp *uint64 `protobuf:"varint,22,opt,name=tcTokenTimestamp" json:"tcTokenTimestamp,omitempty"` + ContactPrimaryIdentityKey []byte `protobuf:"bytes,23,opt,name=contactPrimaryIdentityKey" json:"contactPrimaryIdentityKey,omitempty"` + Pinned *uint32 `protobuf:"varint,24,opt,name=pinned" json:"pinned,omitempty"` + MuteEndTime *uint64 `protobuf:"varint,25,opt,name=muteEndTime" json:"muteEndTime,omitempty"` + Wallpaper *WallpaperSettings `protobuf:"bytes,26,opt,name=wallpaper" json:"wallpaper,omitempty"` + MediaVisibility *MediaVisibility `protobuf:"varint,27,opt,name=mediaVisibility,enum=proto.MediaVisibility" json:"mediaVisibility,omitempty"` + TcTokenSenderTimestamp *uint64 `protobuf:"varint,28,opt,name=tcTokenSenderTimestamp" json:"tcTokenSenderTimestamp,omitempty"` + Suspended *bool `protobuf:"varint,29,opt,name=suspended" json:"suspended,omitempty"` + Terminated *bool `protobuf:"varint,30,opt,name=terminated" json:"terminated,omitempty"` + CreatedAt *uint64 `protobuf:"varint,31,opt,name=createdAt" json:"createdAt,omitempty"` + CreatedBy *string `protobuf:"bytes,32,opt,name=createdBy" json:"createdBy,omitempty"` + Description *string `protobuf:"bytes,33,opt,name=description" json:"description,omitempty"` + Support *bool `protobuf:"varint,34,opt,name=support" json:"support,omitempty"` + IsParentGroup *bool `protobuf:"varint,35,opt,name=isParentGroup" json:"isParentGroup,omitempty"` + IsDefaultSubgroup *bool `protobuf:"varint,36,opt,name=isDefaultSubgroup" json:"isDefaultSubgroup,omitempty"` + ParentGroupId *string `protobuf:"bytes,37,opt,name=parentGroupId" json:"parentGroupId,omitempty"` + DisplayName *string `protobuf:"bytes,38,opt,name=displayName" json:"displayName,omitempty"` + PnJid *string `protobuf:"bytes,39,opt,name=pnJid" json:"pnJid,omitempty"` + ShareOwnPn *bool `protobuf:"varint,40,opt,name=shareOwnPn" json:"shareOwnPn,omitempty"` + PnhDuplicateLidThread *bool `protobuf:"varint,41,opt,name=pnhDuplicateLidThread" json:"pnhDuplicateLidThread,omitempty"` + LidJid *string `protobuf:"bytes,42,opt,name=lidJid" json:"lidJid,omitempty"` +} + +func (x *Conversation) Reset() { + *x = Conversation{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[84] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Conversation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Conversation) ProtoMessage() {} + +func (x *Conversation) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[84] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Conversation.ProtoReflect.Descriptor instead. +func (*Conversation) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{84} +} + +func (x *Conversation) GetId() string { + if x != nil && x.Id != nil { + return *x.Id + } + return "" +} + +func (x *Conversation) GetMessages() []*HistorySyncMsg { + if x != nil { + return x.Messages + } + return nil +} + +func (x *Conversation) GetNewJid() string { + if x != nil && x.NewJid != nil { + return *x.NewJid + } + return "" +} + +func (x *Conversation) GetOldJid() string { + if x != nil && x.OldJid != nil { + return *x.OldJid + } + return "" +} + +func (x *Conversation) GetLastMsgTimestamp() uint64 { + if x != nil && x.LastMsgTimestamp != nil { + return *x.LastMsgTimestamp + } + return 0 +} + +func (x *Conversation) GetUnreadCount() uint32 { + if x != nil && x.UnreadCount != nil { + return *x.UnreadCount + } + return 0 +} + +func (x *Conversation) GetReadOnly() bool { + if x != nil && x.ReadOnly != nil { + return *x.ReadOnly + } + return false +} + +func (x *Conversation) GetEndOfHistoryTransfer() bool { + if x != nil && x.EndOfHistoryTransfer != nil { + return *x.EndOfHistoryTransfer + } + return false +} + +func (x *Conversation) GetEphemeralExpiration() uint32 { + if x != nil && x.EphemeralExpiration != nil { + return *x.EphemeralExpiration + } + return 0 +} + +func (x *Conversation) GetEphemeralSettingTimestamp() int64 { + if x != nil && x.EphemeralSettingTimestamp != nil { + return *x.EphemeralSettingTimestamp + } + return 0 +} + +func (x *Conversation) GetEndOfHistoryTransferType() Conversation_EndOfHistoryTransferType { + if x != nil && x.EndOfHistoryTransferType != nil { + return *x.EndOfHistoryTransferType + } + return Conversation_COMPLETE_BUT_MORE_MESSAGES_REMAIN_ON_PRIMARY +} + +func (x *Conversation) GetConversationTimestamp() uint64 { + if x != nil && x.ConversationTimestamp != nil { + return *x.ConversationTimestamp + } + return 0 +} + +func (x *Conversation) GetName() string { + if x != nil && x.Name != nil { + return *x.Name + } + return "" +} + +func (x *Conversation) GetPHash() string { + if x != nil && x.PHash != nil { + return *x.PHash + } + return "" +} + +func (x *Conversation) GetNotSpam() bool { + if x != nil && x.NotSpam != nil { + return *x.NotSpam + } + return false +} + +func (x *Conversation) GetArchived() bool { + if x != nil && x.Archived != nil { + return *x.Archived + } + return false +} + +func (x *Conversation) GetDisappearingMode() *DisappearingMode { + if x != nil { + return x.DisappearingMode + } + return nil +} + +func (x *Conversation) GetUnreadMentionCount() uint32 { + if x != nil && x.UnreadMentionCount != nil { + return *x.UnreadMentionCount + } + return 0 +} + +func (x *Conversation) GetMarkedAsUnread() bool { + if x != nil && x.MarkedAsUnread != nil { + return *x.MarkedAsUnread + } + return false +} + +func (x *Conversation) GetParticipant() []*GroupParticipant { + if x != nil { + return x.Participant + } + return nil +} + +func (x *Conversation) GetTcToken() []byte { + if x != nil { + return x.TcToken + } + return nil +} + +func (x *Conversation) GetTcTokenTimestamp() uint64 { + if x != nil && x.TcTokenTimestamp != nil { + return *x.TcTokenTimestamp + } + return 0 +} + +func (x *Conversation) GetContactPrimaryIdentityKey() []byte { + if x != nil { + return x.ContactPrimaryIdentityKey + } + return nil +} + +func (x *Conversation) GetPinned() uint32 { + if x != nil && x.Pinned != nil { + return *x.Pinned + } + return 0 +} + +func (x *Conversation) GetMuteEndTime() uint64 { + if x != nil && x.MuteEndTime != nil { + return *x.MuteEndTime + } + return 0 +} + +func (x *Conversation) GetWallpaper() *WallpaperSettings { + if x != nil { + return x.Wallpaper + } + return nil +} + +func (x *Conversation) GetMediaVisibility() MediaVisibility { + if x != nil && x.MediaVisibility != nil { + return *x.MediaVisibility + } + return MediaVisibility_DEFAULT +} + +func (x *Conversation) GetTcTokenSenderTimestamp() uint64 { + if x != nil && x.TcTokenSenderTimestamp != nil { + return *x.TcTokenSenderTimestamp + } + return 0 +} + +func (x *Conversation) GetSuspended() bool { + if x != nil && x.Suspended != nil { + return *x.Suspended + } + return false +} + +func (x *Conversation) GetTerminated() bool { + if x != nil && x.Terminated != nil { + return *x.Terminated + } + return false +} + +func (x *Conversation) GetCreatedAt() uint64 { + if x != nil && x.CreatedAt != nil { + return *x.CreatedAt + } + return 0 +} + +func (x *Conversation) GetCreatedBy() string { + if x != nil && x.CreatedBy != nil { + return *x.CreatedBy + } + return "" +} + +func (x *Conversation) GetDescription() string { + if x != nil && x.Description != nil { + return *x.Description + } + return "" +} + +func (x *Conversation) GetSupport() bool { + if x != nil && x.Support != nil { + return *x.Support + } + return false +} + +func (x *Conversation) GetIsParentGroup() bool { + if x != nil && x.IsParentGroup != nil { + return *x.IsParentGroup + } + return false +} + +func (x *Conversation) GetIsDefaultSubgroup() bool { + if x != nil && x.IsDefaultSubgroup != nil { + return *x.IsDefaultSubgroup + } + return false +} + +func (x *Conversation) GetParentGroupId() string { + if x != nil && x.ParentGroupId != nil { + return *x.ParentGroupId + } + return "" +} + +func (x *Conversation) GetDisplayName() string { + if x != nil && x.DisplayName != nil { + return *x.DisplayName + } + return "" +} + +func (x *Conversation) GetPnJid() string { + if x != nil && x.PnJid != nil { + return *x.PnJid + } + return "" +} + +func (x *Conversation) GetShareOwnPn() bool { + if x != nil && x.ShareOwnPn != nil { + return *x.ShareOwnPn + } + return false +} + +func (x *Conversation) GetPnhDuplicateLidThread() bool { + if x != nil && x.PnhDuplicateLidThread != nil { + return *x.PnhDuplicateLidThread + } + return false +} + +func (x *Conversation) GetLidJid() string { + if x != nil && x.LidJid != nil { + return *x.LidJid + } + return "" +} + +type AvatarUserSettings struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Fbid *string `protobuf:"bytes,1,opt,name=fbid" json:"fbid,omitempty"` + Password *string `protobuf:"bytes,2,opt,name=password" json:"password,omitempty"` +} + +func (x *AvatarUserSettings) Reset() { + *x = AvatarUserSettings{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[85] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AvatarUserSettings) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AvatarUserSettings) ProtoMessage() {} + +func (x *AvatarUserSettings) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[85] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AvatarUserSettings.ProtoReflect.Descriptor instead. +func (*AvatarUserSettings) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{85} +} + +func (x *AvatarUserSettings) GetFbid() string { + if x != nil && x.Fbid != nil { + return *x.Fbid + } + return "" +} + +func (x *AvatarUserSettings) GetPassword() string { + if x != nil && x.Password != nil { + return *x.Password + } + return "" +} + +type AutoDownloadSettings struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DownloadImages *bool `protobuf:"varint,1,opt,name=downloadImages" json:"downloadImages,omitempty"` + DownloadAudio *bool `protobuf:"varint,2,opt,name=downloadAudio" json:"downloadAudio,omitempty"` + DownloadVideo *bool `protobuf:"varint,3,opt,name=downloadVideo" json:"downloadVideo,omitempty"` + DownloadDocuments *bool `protobuf:"varint,4,opt,name=downloadDocuments" json:"downloadDocuments,omitempty"` +} + +func (x *AutoDownloadSettings) Reset() { + *x = AutoDownloadSettings{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[86] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AutoDownloadSettings) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AutoDownloadSettings) ProtoMessage() {} + +func (x *AutoDownloadSettings) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[86] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AutoDownloadSettings.ProtoReflect.Descriptor instead. +func (*AutoDownloadSettings) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{86} +} + +func (x *AutoDownloadSettings) GetDownloadImages() bool { + if x != nil && x.DownloadImages != nil { + return *x.DownloadImages + } + return false +} + +func (x *AutoDownloadSettings) GetDownloadAudio() bool { + if x != nil && x.DownloadAudio != nil { + return *x.DownloadAudio + } + return false +} + +func (x *AutoDownloadSettings) GetDownloadVideo() bool { + if x != nil && x.DownloadVideo != nil { + return *x.DownloadVideo + } + return false +} + +func (x *AutoDownloadSettings) GetDownloadDocuments() bool { + if x != nil && x.DownloadDocuments != nil { + return *x.DownloadDocuments + } + return false +} + +type MsgRowOpaqueData struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CurrentMsg *MsgOpaqueData `protobuf:"bytes,1,opt,name=currentMsg" json:"currentMsg,omitempty"` + QuotedMsg *MsgOpaqueData `protobuf:"bytes,2,opt,name=quotedMsg" json:"quotedMsg,omitempty"` +} + +func (x *MsgRowOpaqueData) Reset() { + *x = MsgRowOpaqueData{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[87] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgRowOpaqueData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgRowOpaqueData) ProtoMessage() {} + +func (x *MsgRowOpaqueData) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[87] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MsgRowOpaqueData.ProtoReflect.Descriptor instead. +func (*MsgRowOpaqueData) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{87} +} + +func (x *MsgRowOpaqueData) GetCurrentMsg() *MsgOpaqueData { + if x != nil { + return x.CurrentMsg + } + return nil +} + +func (x *MsgRowOpaqueData) GetQuotedMsg() *MsgOpaqueData { + if x != nil { + return x.QuotedMsg + } + return nil +} + +type MsgOpaqueData struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Body *string `protobuf:"bytes,1,opt,name=body" json:"body,omitempty"` + Caption *string `protobuf:"bytes,3,opt,name=caption" json:"caption,omitempty"` + Lng *float64 `protobuf:"fixed64,5,opt,name=lng" json:"lng,omitempty"` + IsLive *bool `protobuf:"varint,6,opt,name=isLive" json:"isLive,omitempty"` + Lat *float64 `protobuf:"fixed64,7,opt,name=lat" json:"lat,omitempty"` + PaymentAmount1000 *int32 `protobuf:"varint,8,opt,name=paymentAmount1000" json:"paymentAmount1000,omitempty"` + PaymentNoteMsgBody *string `protobuf:"bytes,9,opt,name=paymentNoteMsgBody" json:"paymentNoteMsgBody,omitempty"` + CanonicalUrl *string `protobuf:"bytes,10,opt,name=canonicalUrl" json:"canonicalUrl,omitempty"` + MatchedText *string `protobuf:"bytes,11,opt,name=matchedText" json:"matchedText,omitempty"` + Title *string `protobuf:"bytes,12,opt,name=title" json:"title,omitempty"` + Description *string `protobuf:"bytes,13,opt,name=description" json:"description,omitempty"` + FutureproofBuffer []byte `protobuf:"bytes,14,opt,name=futureproofBuffer" json:"futureproofBuffer,omitempty"` + ClientUrl *string `protobuf:"bytes,15,opt,name=clientUrl" json:"clientUrl,omitempty"` + Loc *string `protobuf:"bytes,16,opt,name=loc" json:"loc,omitempty"` + PollName *string `protobuf:"bytes,17,opt,name=pollName" json:"pollName,omitempty"` + PollOptions []*MsgOpaqueData_PollOption `protobuf:"bytes,18,rep,name=pollOptions" json:"pollOptions,omitempty"` + PollSelectableOptionsCount *uint32 `protobuf:"varint,20,opt,name=pollSelectableOptionsCount" json:"pollSelectableOptionsCount,omitempty"` + MessageSecret []byte `protobuf:"bytes,21,opt,name=messageSecret" json:"messageSecret,omitempty"` + OriginalSelfAuthor *string `protobuf:"bytes,51,opt,name=originalSelfAuthor" json:"originalSelfAuthor,omitempty"` + SenderTimestampMs *int64 `protobuf:"varint,22,opt,name=senderTimestampMs" json:"senderTimestampMs,omitempty"` + PollUpdateParentKey *string `protobuf:"bytes,23,opt,name=pollUpdateParentKey" json:"pollUpdateParentKey,omitempty"` + EncPollVote *PollEncValue `protobuf:"bytes,24,opt,name=encPollVote" json:"encPollVote,omitempty"` + IsSentCagPollCreation *bool `protobuf:"varint,28,opt,name=isSentCagPollCreation" json:"isSentCagPollCreation,omitempty"` + EncReactionTargetMessageKey *string `protobuf:"bytes,25,opt,name=encReactionTargetMessageKey" json:"encReactionTargetMessageKey,omitempty"` + EncReactionEncPayload []byte `protobuf:"bytes,26,opt,name=encReactionEncPayload" json:"encReactionEncPayload,omitempty"` + EncReactionEncIv []byte `protobuf:"bytes,27,opt,name=encReactionEncIv" json:"encReactionEncIv,omitempty"` +} + +func (x *MsgOpaqueData) Reset() { + *x = MsgOpaqueData{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[88] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgOpaqueData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgOpaqueData) ProtoMessage() {} + +func (x *MsgOpaqueData) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[88] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MsgOpaqueData.ProtoReflect.Descriptor instead. +func (*MsgOpaqueData) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{88} +} + +func (x *MsgOpaqueData) GetBody() string { + if x != nil && x.Body != nil { + return *x.Body + } + return "" +} + +func (x *MsgOpaqueData) GetCaption() string { + if x != nil && x.Caption != nil { + return *x.Caption + } + return "" +} + +func (x *MsgOpaqueData) GetLng() float64 { + if x != nil && x.Lng != nil { + return *x.Lng + } + return 0 +} + +func (x *MsgOpaqueData) GetIsLive() bool { + if x != nil && x.IsLive != nil { + return *x.IsLive + } + return false +} + +func (x *MsgOpaqueData) GetLat() float64 { + if x != nil && x.Lat != nil { + return *x.Lat + } + return 0 +} + +func (x *MsgOpaqueData) GetPaymentAmount1000() int32 { + if x != nil && x.PaymentAmount1000 != nil { + return *x.PaymentAmount1000 + } + return 0 +} + +func (x *MsgOpaqueData) GetPaymentNoteMsgBody() string { + if x != nil && x.PaymentNoteMsgBody != nil { + return *x.PaymentNoteMsgBody + } + return "" +} + +func (x *MsgOpaqueData) GetCanonicalUrl() string { + if x != nil && x.CanonicalUrl != nil { + return *x.CanonicalUrl + } + return "" +} + +func (x *MsgOpaqueData) GetMatchedText() string { + if x != nil && x.MatchedText != nil { + return *x.MatchedText + } + return "" +} + +func (x *MsgOpaqueData) GetTitle() string { + if x != nil && x.Title != nil { + return *x.Title + } + return "" +} + +func (x *MsgOpaqueData) GetDescription() string { + if x != nil && x.Description != nil { + return *x.Description + } + return "" +} + +func (x *MsgOpaqueData) GetFutureproofBuffer() []byte { + if x != nil { + return x.FutureproofBuffer + } + return nil +} + +func (x *MsgOpaqueData) GetClientUrl() string { + if x != nil && x.ClientUrl != nil { + return *x.ClientUrl + } + return "" +} + +func (x *MsgOpaqueData) GetLoc() string { + if x != nil && x.Loc != nil { + return *x.Loc + } + return "" +} + +func (x *MsgOpaqueData) GetPollName() string { + if x != nil && x.PollName != nil { + return *x.PollName + } + return "" +} + +func (x *MsgOpaqueData) GetPollOptions() []*MsgOpaqueData_PollOption { + if x != nil { + return x.PollOptions + } + return nil +} + +func (x *MsgOpaqueData) GetPollSelectableOptionsCount() uint32 { + if x != nil && x.PollSelectableOptionsCount != nil { + return *x.PollSelectableOptionsCount + } + return 0 +} + +func (x *MsgOpaqueData) GetMessageSecret() []byte { + if x != nil { + return x.MessageSecret + } + return nil +} + +func (x *MsgOpaqueData) GetOriginalSelfAuthor() string { + if x != nil && x.OriginalSelfAuthor != nil { + return *x.OriginalSelfAuthor + } + return "" +} + +func (x *MsgOpaqueData) GetSenderTimestampMs() int64 { + if x != nil && x.SenderTimestampMs != nil { + return *x.SenderTimestampMs + } + return 0 +} + +func (x *MsgOpaqueData) GetPollUpdateParentKey() string { + if x != nil && x.PollUpdateParentKey != nil { + return *x.PollUpdateParentKey + } + return "" +} + +func (x *MsgOpaqueData) GetEncPollVote() *PollEncValue { + if x != nil { + return x.EncPollVote + } + return nil +} + +func (x *MsgOpaqueData) GetIsSentCagPollCreation() bool { + if x != nil && x.IsSentCagPollCreation != nil { + return *x.IsSentCagPollCreation + } + return false +} + +func (x *MsgOpaqueData) GetEncReactionTargetMessageKey() string { + if x != nil && x.EncReactionTargetMessageKey != nil { + return *x.EncReactionTargetMessageKey + } + return "" +} + +func (x *MsgOpaqueData) GetEncReactionEncPayload() []byte { + if x != nil { + return x.EncReactionEncPayload + } + return nil +} + +func (x *MsgOpaqueData) GetEncReactionEncIv() []byte { + if x != nil { + return x.EncReactionEncIv + } + return nil +} + +type ServerErrorReceipt struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + StanzaId *string `protobuf:"bytes,1,opt,name=stanzaId" json:"stanzaId,omitempty"` +} + +func (x *ServerErrorReceipt) Reset() { + *x = ServerErrorReceipt{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[89] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ServerErrorReceipt) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServerErrorReceipt) ProtoMessage() {} + +func (x *ServerErrorReceipt) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[89] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ServerErrorReceipt.ProtoReflect.Descriptor instead. +func (*ServerErrorReceipt) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{89} +} + +func (x *ServerErrorReceipt) GetStanzaId() string { + if x != nil && x.StanzaId != nil { + return *x.StanzaId + } + return "" +} + +type MediaRetryNotification struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + StanzaId *string `protobuf:"bytes,1,opt,name=stanzaId" json:"stanzaId,omitempty"` + DirectPath *string `protobuf:"bytes,2,opt,name=directPath" json:"directPath,omitempty"` + Result *MediaRetryNotification_ResultType `protobuf:"varint,3,opt,name=result,enum=proto.MediaRetryNotification_ResultType" json:"result,omitempty"` +} + +func (x *MediaRetryNotification) Reset() { + *x = MediaRetryNotification{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[90] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MediaRetryNotification) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MediaRetryNotification) ProtoMessage() {} + +func (x *MediaRetryNotification) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[90] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MediaRetryNotification.ProtoReflect.Descriptor instead. +func (*MediaRetryNotification) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{90} +} + +func (x *MediaRetryNotification) GetStanzaId() string { + if x != nil && x.StanzaId != nil { + return *x.StanzaId + } + return "" +} + +func (x *MediaRetryNotification) GetDirectPath() string { + if x != nil && x.DirectPath != nil { + return *x.DirectPath + } + return "" +} + +func (x *MediaRetryNotification) GetResult() MediaRetryNotification_ResultType { + if x != nil && x.Result != nil { + return *x.Result + } + return MediaRetryNotification_GENERAL_ERROR +} + +type MessageKey struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + 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"` +} + +func (x *MessageKey) Reset() { + *x = MessageKey{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[91] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MessageKey) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MessageKey) ProtoMessage() {} + +func (x *MessageKey) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[91] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MessageKey.ProtoReflect.Descriptor instead. +func (*MessageKey) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{91} +} + +func (x *MessageKey) GetRemoteJid() string { + if x != nil && x.RemoteJid != nil { + return *x.RemoteJid + } + return "" +} + +func (x *MessageKey) GetFromMe() bool { + if x != nil && x.FromMe != nil { + return *x.FromMe + } + return false +} + +func (x *MessageKey) GetId() string { + if x != nil && x.Id != nil { + return *x.Id + } + return "" +} + +func (x *MessageKey) GetParticipant() string { + if x != nil && x.Participant != nil { + return *x.Participant + } + return "" +} + +type SyncdVersion struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Version *uint64 `protobuf:"varint,1,opt,name=version" json:"version,omitempty"` +} + +func (x *SyncdVersion) Reset() { + *x = SyncdVersion{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[92] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SyncdVersion) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SyncdVersion) ProtoMessage() {} + +func (x *SyncdVersion) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[92] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SyncdVersion.ProtoReflect.Descriptor instead. +func (*SyncdVersion) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{92} +} + +func (x *SyncdVersion) GetVersion() uint64 { + if x != nil && x.Version != nil { + return *x.Version + } + return 0 +} + +type SyncdValue struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Blob []byte `protobuf:"bytes,1,opt,name=blob" json:"blob,omitempty"` +} + +func (x *SyncdValue) Reset() { + *x = SyncdValue{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[93] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SyncdValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SyncdValue) ProtoMessage() {} + +func (x *SyncdValue) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[93] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SyncdValue.ProtoReflect.Descriptor instead. +func (*SyncdValue) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{93} +} + +func (x *SyncdValue) GetBlob() []byte { + if x != nil { + return x.Blob + } + return nil +} + +type SyncdSnapshot struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Version *SyncdVersion `protobuf:"bytes,1,opt,name=version" json:"version,omitempty"` + Records []*SyncdRecord `protobuf:"bytes,2,rep,name=records" json:"records,omitempty"` + Mac []byte `protobuf:"bytes,3,opt,name=mac" json:"mac,omitempty"` + KeyId *KeyId `protobuf:"bytes,4,opt,name=keyId" json:"keyId,omitempty"` +} + +func (x *SyncdSnapshot) Reset() { + *x = SyncdSnapshot{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[94] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SyncdSnapshot) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SyncdSnapshot) ProtoMessage() {} + +func (x *SyncdSnapshot) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[94] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SyncdSnapshot.ProtoReflect.Descriptor instead. +func (*SyncdSnapshot) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{94} +} + +func (x *SyncdSnapshot) GetVersion() *SyncdVersion { + if x != nil { + return x.Version + } + return nil +} + +func (x *SyncdSnapshot) GetRecords() []*SyncdRecord { + if x != nil { + return x.Records + } + return nil +} + +func (x *SyncdSnapshot) GetMac() []byte { + if x != nil { + return x.Mac + } + return nil +} + +func (x *SyncdSnapshot) GetKeyId() *KeyId { + if x != nil { + return x.KeyId + } + return nil +} + +type SyncdRecord struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Index *SyncdIndex `protobuf:"bytes,1,opt,name=index" json:"index,omitempty"` + Value *SyncdValue `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` + KeyId *KeyId `protobuf:"bytes,3,opt,name=keyId" json:"keyId,omitempty"` +} + +func (x *SyncdRecord) Reset() { + *x = SyncdRecord{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[95] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SyncdRecord) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SyncdRecord) ProtoMessage() {} + +func (x *SyncdRecord) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[95] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SyncdRecord.ProtoReflect.Descriptor instead. +func (*SyncdRecord) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{95} +} + +func (x *SyncdRecord) GetIndex() *SyncdIndex { + if x != nil { + return x.Index + } + return nil +} + +func (x *SyncdRecord) GetValue() *SyncdValue { + if x != nil { + return x.Value + } + return nil +} + +func (x *SyncdRecord) GetKeyId() *KeyId { + if x != nil { + return x.KeyId + } + return nil +} + +type SyncdPatch struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Version *SyncdVersion `protobuf:"bytes,1,opt,name=version" json:"version,omitempty"` + Mutations []*SyncdMutation `protobuf:"bytes,2,rep,name=mutations" json:"mutations,omitempty"` + ExternalMutations *ExternalBlobReference `protobuf:"bytes,3,opt,name=externalMutations" json:"externalMutations,omitempty"` + SnapshotMac []byte `protobuf:"bytes,4,opt,name=snapshotMac" json:"snapshotMac,omitempty"` + PatchMac []byte `protobuf:"bytes,5,opt,name=patchMac" json:"patchMac,omitempty"` + KeyId *KeyId `protobuf:"bytes,6,opt,name=keyId" json:"keyId,omitempty"` + ExitCode *ExitCode `protobuf:"bytes,7,opt,name=exitCode" json:"exitCode,omitempty"` + DeviceIndex *uint32 `protobuf:"varint,8,opt,name=deviceIndex" json:"deviceIndex,omitempty"` +} + +func (x *SyncdPatch) Reset() { + *x = SyncdPatch{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[96] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SyncdPatch) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SyncdPatch) ProtoMessage() {} + +func (x *SyncdPatch) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[96] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SyncdPatch.ProtoReflect.Descriptor instead. +func (*SyncdPatch) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{96} +} + +func (x *SyncdPatch) GetVersion() *SyncdVersion { + if x != nil { + return x.Version + } + return nil +} + +func (x *SyncdPatch) GetMutations() []*SyncdMutation { + if x != nil { + return x.Mutations + } + return nil +} + +func (x *SyncdPatch) GetExternalMutations() *ExternalBlobReference { + if x != nil { + return x.ExternalMutations + } + return nil +} + +func (x *SyncdPatch) GetSnapshotMac() []byte { + if x != nil { + return x.SnapshotMac + } + return nil +} + +func (x *SyncdPatch) GetPatchMac() []byte { + if x != nil { + return x.PatchMac + } + return nil +} + +func (x *SyncdPatch) GetKeyId() *KeyId { + if x != nil { + return x.KeyId + } + return nil +} + +func (x *SyncdPatch) GetExitCode() *ExitCode { + if x != nil { + return x.ExitCode + } + return nil +} + +func (x *SyncdPatch) GetDeviceIndex() uint32 { + if x != nil && x.DeviceIndex != nil { + return *x.DeviceIndex + } + return 0 +} + +type SyncdMutations struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Mutations []*SyncdMutation `protobuf:"bytes,1,rep,name=mutations" json:"mutations,omitempty"` +} + +func (x *SyncdMutations) Reset() { + *x = SyncdMutations{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[97] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SyncdMutations) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SyncdMutations) ProtoMessage() {} + +func (x *SyncdMutations) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[97] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SyncdMutations.ProtoReflect.Descriptor instead. +func (*SyncdMutations) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{97} +} + +func (x *SyncdMutations) GetMutations() []*SyncdMutation { + if x != nil { + return x.Mutations + } + return nil +} + +type SyncdMutation struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Operation *SyncdMutation_SyncdOperation `protobuf:"varint,1,opt,name=operation,enum=proto.SyncdMutation_SyncdOperation" json:"operation,omitempty"` + Record *SyncdRecord `protobuf:"bytes,2,opt,name=record" json:"record,omitempty"` +} + +func (x *SyncdMutation) Reset() { + *x = SyncdMutation{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[98] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SyncdMutation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SyncdMutation) ProtoMessage() {} + +func (x *SyncdMutation) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[98] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SyncdMutation.ProtoReflect.Descriptor instead. +func (*SyncdMutation) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{98} +} + +func (x *SyncdMutation) GetOperation() SyncdMutation_SyncdOperation { + if x != nil && x.Operation != nil { + return *x.Operation + } + return SyncdMutation_SET +} + +func (x *SyncdMutation) GetRecord() *SyncdRecord { + if x != nil { + return x.Record + } + return nil +} + +type SyncdIndex struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Blob []byte `protobuf:"bytes,1,opt,name=blob" json:"blob,omitempty"` +} + +func (x *SyncdIndex) Reset() { + *x = SyncdIndex{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[99] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SyncdIndex) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SyncdIndex) ProtoMessage() {} + +func (x *SyncdIndex) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[99] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SyncdIndex.ProtoReflect.Descriptor instead. +func (*SyncdIndex) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{99} +} + +func (x *SyncdIndex) GetBlob() []byte { + if x != nil { + return x.Blob + } + return nil +} + +type KeyId struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id []byte `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` +} + +func (x *KeyId) Reset() { + *x = KeyId{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[100] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KeyId) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeyId) ProtoMessage() {} + +func (x *KeyId) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[100] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KeyId.ProtoReflect.Descriptor instead. +func (*KeyId) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{100} +} + +func (x *KeyId) GetId() []byte { + if x != nil { + return x.Id + } + return nil +} + +type ExternalBlobReference struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MediaKey []byte `protobuf:"bytes,1,opt,name=mediaKey" json:"mediaKey,omitempty"` + DirectPath *string `protobuf:"bytes,2,opt,name=directPath" json:"directPath,omitempty"` + Handle *string `protobuf:"bytes,3,opt,name=handle" json:"handle,omitempty"` + FileSizeBytes *uint64 `protobuf:"varint,4,opt,name=fileSizeBytes" json:"fileSizeBytes,omitempty"` + FileSha256 []byte `protobuf:"bytes,5,opt,name=fileSha256" json:"fileSha256,omitempty"` + FileEncSha256 []byte `protobuf:"bytes,6,opt,name=fileEncSha256" json:"fileEncSha256,omitempty"` +} + +func (x *ExternalBlobReference) Reset() { + *x = ExternalBlobReference{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[101] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExternalBlobReference) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExternalBlobReference) ProtoMessage() {} + +func (x *ExternalBlobReference) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[101] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExternalBlobReference.ProtoReflect.Descriptor instead. +func (*ExternalBlobReference) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{101} +} + +func (x *ExternalBlobReference) GetMediaKey() []byte { + if x != nil { + return x.MediaKey + } + return nil +} + +func (x *ExternalBlobReference) GetDirectPath() string { + if x != nil && x.DirectPath != nil { + return *x.DirectPath + } + return "" +} + +func (x *ExternalBlobReference) GetHandle() string { + if x != nil && x.Handle != nil { + return *x.Handle + } + return "" +} + +func (x *ExternalBlobReference) GetFileSizeBytes() uint64 { + if x != nil && x.FileSizeBytes != nil { + return *x.FileSizeBytes + } + return 0 +} + +func (x *ExternalBlobReference) GetFileSha256() []byte { + if x != nil { + return x.FileSha256 + } + return nil +} + +func (x *ExternalBlobReference) GetFileEncSha256() []byte { + if x != nil { + return x.FileEncSha256 + } + return nil +} + +type ExitCode struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Code *uint64 `protobuf:"varint,1,opt,name=code" json:"code,omitempty"` + Text *string `protobuf:"bytes,2,opt,name=text" json:"text,omitempty"` +} + +func (x *ExitCode) Reset() { + *x = ExitCode{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[102] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ExitCode) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExitCode) ProtoMessage() {} + +func (x *ExitCode) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[102] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExitCode.ProtoReflect.Descriptor instead. +func (*ExitCode) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{102} +} + +func (x *ExitCode) GetCode() uint64 { + if x != nil && x.Code != nil { + return *x.Code + } + return 0 +} + +func (x *ExitCode) GetText() string { + if x != nil && x.Text != nil { + return *x.Text + } + return "" +} + +type SyncActionValue struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Timestamp *int64 `protobuf:"varint,1,opt,name=timestamp" json:"timestamp,omitempty"` + StarAction *StarAction `protobuf:"bytes,2,opt,name=starAction" json:"starAction,omitempty"` + ContactAction *ContactAction `protobuf:"bytes,3,opt,name=contactAction" json:"contactAction,omitempty"` + MuteAction *MuteAction `protobuf:"bytes,4,opt,name=muteAction" json:"muteAction,omitempty"` + PinAction *PinAction `protobuf:"bytes,5,opt,name=pinAction" json:"pinAction,omitempty"` + SecurityNotificationSetting *SecurityNotificationSetting `protobuf:"bytes,6,opt,name=securityNotificationSetting" json:"securityNotificationSetting,omitempty"` + PushNameSetting *PushNameSetting `protobuf:"bytes,7,opt,name=pushNameSetting" json:"pushNameSetting,omitempty"` + QuickReplyAction *QuickReplyAction `protobuf:"bytes,8,opt,name=quickReplyAction" json:"quickReplyAction,omitempty"` + RecentEmojiWeightsAction *RecentEmojiWeightsAction `protobuf:"bytes,11,opt,name=recentEmojiWeightsAction" json:"recentEmojiWeightsAction,omitempty"` + LabelEditAction *LabelEditAction `protobuf:"bytes,14,opt,name=labelEditAction" json:"labelEditAction,omitempty"` + LabelAssociationAction *LabelAssociationAction `protobuf:"bytes,15,opt,name=labelAssociationAction" json:"labelAssociationAction,omitempty"` + LocaleSetting *LocaleSetting `protobuf:"bytes,16,opt,name=localeSetting" json:"localeSetting,omitempty"` + ArchiveChatAction *ArchiveChatAction `protobuf:"bytes,17,opt,name=archiveChatAction" json:"archiveChatAction,omitempty"` + DeleteMessageForMeAction *DeleteMessageForMeAction `protobuf:"bytes,18,opt,name=deleteMessageForMeAction" json:"deleteMessageForMeAction,omitempty"` + KeyExpiration *KeyExpiration `protobuf:"bytes,19,opt,name=keyExpiration" json:"keyExpiration,omitempty"` + MarkChatAsReadAction *MarkChatAsReadAction `protobuf:"bytes,20,opt,name=markChatAsReadAction" json:"markChatAsReadAction,omitempty"` + ClearChatAction *ClearChatAction `protobuf:"bytes,21,opt,name=clearChatAction" json:"clearChatAction,omitempty"` + DeleteChatAction *DeleteChatAction `protobuf:"bytes,22,opt,name=deleteChatAction" json:"deleteChatAction,omitempty"` + UnarchiveChatsSetting *UnarchiveChatsSetting `protobuf:"bytes,23,opt,name=unarchiveChatsSetting" json:"unarchiveChatsSetting,omitempty"` + PrimaryFeature *PrimaryFeature `protobuf:"bytes,24,opt,name=primaryFeature" json:"primaryFeature,omitempty"` + AndroidUnsupportedActions *AndroidUnsupportedActions `protobuf:"bytes,26,opt,name=androidUnsupportedActions" json:"androidUnsupportedActions,omitempty"` + AgentAction *AgentAction `protobuf:"bytes,27,opt,name=agentAction" json:"agentAction,omitempty"` + SubscriptionAction *SubscriptionAction `protobuf:"bytes,28,opt,name=subscriptionAction" json:"subscriptionAction,omitempty"` + UserStatusMuteAction *UserStatusMuteAction `protobuf:"bytes,29,opt,name=userStatusMuteAction" json:"userStatusMuteAction,omitempty"` + TimeFormatAction *TimeFormatAction `protobuf:"bytes,30,opt,name=timeFormatAction" json:"timeFormatAction,omitempty"` + NuxAction *NuxAction `protobuf:"bytes,31,opt,name=nuxAction" json:"nuxAction,omitempty"` + PrimaryVersionAction *PrimaryVersionAction `protobuf:"bytes,32,opt,name=primaryVersionAction" json:"primaryVersionAction,omitempty"` + StickerAction *StickerAction `protobuf:"bytes,33,opt,name=stickerAction" json:"stickerAction,omitempty"` + RemoveRecentStickerAction *RemoveRecentStickerAction `protobuf:"bytes,34,opt,name=removeRecentStickerAction" json:"removeRecentStickerAction,omitempty"` + ChatAssignment *ChatAssignmentAction `protobuf:"bytes,35,opt,name=chatAssignment" json:"chatAssignment,omitempty"` + ChatAssignmentOpenedStatus *ChatAssignmentOpenedStatusAction `protobuf:"bytes,36,opt,name=chatAssignmentOpenedStatus" json:"chatAssignmentOpenedStatus,omitempty"` + PnForLidChatAction *PnForLidChatAction `protobuf:"bytes,37,opt,name=pnForLidChatAction" json:"pnForLidChatAction,omitempty"` +} + +func (x *SyncActionValue) Reset() { + *x = SyncActionValue{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[103] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SyncActionValue) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SyncActionValue) ProtoMessage() {} + +func (x *SyncActionValue) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[103] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SyncActionValue.ProtoReflect.Descriptor instead. +func (*SyncActionValue) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{103} +} + +func (x *SyncActionValue) GetTimestamp() int64 { + if x != nil && x.Timestamp != nil { + return *x.Timestamp + } + return 0 +} + +func (x *SyncActionValue) GetStarAction() *StarAction { + if x != nil { + return x.StarAction + } + return nil +} + +func (x *SyncActionValue) GetContactAction() *ContactAction { + if x != nil { + return x.ContactAction + } + return nil +} + +func (x *SyncActionValue) GetMuteAction() *MuteAction { + if x != nil { + return x.MuteAction + } + return nil +} + +func (x *SyncActionValue) GetPinAction() *PinAction { + if x != nil { + return x.PinAction + } + return nil +} + +func (x *SyncActionValue) GetSecurityNotificationSetting() *SecurityNotificationSetting { + if x != nil { + return x.SecurityNotificationSetting + } + return nil +} + +func (x *SyncActionValue) GetPushNameSetting() *PushNameSetting { + if x != nil { + return x.PushNameSetting + } + return nil +} + +func (x *SyncActionValue) GetQuickReplyAction() *QuickReplyAction { + if x != nil { + return x.QuickReplyAction + } + return nil +} + +func (x *SyncActionValue) GetRecentEmojiWeightsAction() *RecentEmojiWeightsAction { + if x != nil { + return x.RecentEmojiWeightsAction + } + return nil +} + +func (x *SyncActionValue) GetLabelEditAction() *LabelEditAction { + if x != nil { + return x.LabelEditAction + } + return nil +} + +func (x *SyncActionValue) GetLabelAssociationAction() *LabelAssociationAction { + if x != nil { + return x.LabelAssociationAction + } + return nil +} + +func (x *SyncActionValue) GetLocaleSetting() *LocaleSetting { + if x != nil { + return x.LocaleSetting + } + return nil +} + +func (x *SyncActionValue) GetArchiveChatAction() *ArchiveChatAction { + if x != nil { + return x.ArchiveChatAction + } + return nil +} + +func (x *SyncActionValue) GetDeleteMessageForMeAction() *DeleteMessageForMeAction { + if x != nil { + return x.DeleteMessageForMeAction + } + return nil +} + +func (x *SyncActionValue) GetKeyExpiration() *KeyExpiration { + if x != nil { + return x.KeyExpiration + } + return nil +} + +func (x *SyncActionValue) GetMarkChatAsReadAction() *MarkChatAsReadAction { + if x != nil { + return x.MarkChatAsReadAction + } + return nil +} + +func (x *SyncActionValue) GetClearChatAction() *ClearChatAction { + if x != nil { + return x.ClearChatAction + } + return nil +} + +func (x *SyncActionValue) GetDeleteChatAction() *DeleteChatAction { + if x != nil { + return x.DeleteChatAction + } + return nil +} + +func (x *SyncActionValue) GetUnarchiveChatsSetting() *UnarchiveChatsSetting { + if x != nil { + return x.UnarchiveChatsSetting + } + return nil +} + +func (x *SyncActionValue) GetPrimaryFeature() *PrimaryFeature { + if x != nil { + return x.PrimaryFeature + } + return nil +} + +func (x *SyncActionValue) GetAndroidUnsupportedActions() *AndroidUnsupportedActions { + if x != nil { + return x.AndroidUnsupportedActions + } + return nil +} + +func (x *SyncActionValue) GetAgentAction() *AgentAction { + if x != nil { + return x.AgentAction + } + return nil +} + +func (x *SyncActionValue) GetSubscriptionAction() *SubscriptionAction { + if x != nil { + return x.SubscriptionAction + } + return nil +} + +func (x *SyncActionValue) GetUserStatusMuteAction() *UserStatusMuteAction { + if x != nil { + return x.UserStatusMuteAction + } + return nil +} + +func (x *SyncActionValue) GetTimeFormatAction() *TimeFormatAction { + if x != nil { + return x.TimeFormatAction + } + return nil +} + +func (x *SyncActionValue) GetNuxAction() *NuxAction { + if x != nil { + return x.NuxAction + } + return nil +} + +func (x *SyncActionValue) GetPrimaryVersionAction() *PrimaryVersionAction { + if x != nil { + return x.PrimaryVersionAction + } + return nil +} + +func (x *SyncActionValue) GetStickerAction() *StickerAction { + if x != nil { + return x.StickerAction + } + return nil +} + +func (x *SyncActionValue) GetRemoveRecentStickerAction() *RemoveRecentStickerAction { + if x != nil { + return x.RemoveRecentStickerAction + } + return nil +} + +func (x *SyncActionValue) GetChatAssignment() *ChatAssignmentAction { + if x != nil { + return x.ChatAssignment + } + return nil +} + +func (x *SyncActionValue) GetChatAssignmentOpenedStatus() *ChatAssignmentOpenedStatusAction { + if x != nil { + return x.ChatAssignmentOpenedStatus + } + return nil +} + +func (x *SyncActionValue) GetPnForLidChatAction() *PnForLidChatAction { + if x != nil { + return x.PnForLidChatAction + } + return nil +} + +type UserStatusMuteAction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Muted *bool `protobuf:"varint,1,opt,name=muted" json:"muted,omitempty"` +} + +func (x *UserStatusMuteAction) Reset() { + *x = UserStatusMuteAction{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[104] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserStatusMuteAction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserStatusMuteAction) ProtoMessage() {} + +func (x *UserStatusMuteAction) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[104] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserStatusMuteAction.ProtoReflect.Descriptor instead. +func (*UserStatusMuteAction) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{104} +} + +func (x *UserStatusMuteAction) GetMuted() bool { + if x != nil && x.Muted != nil { + return *x.Muted + } + return false +} + +type UnarchiveChatsSetting struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UnarchiveChats *bool `protobuf:"varint,1,opt,name=unarchiveChats" json:"unarchiveChats,omitempty"` +} + +func (x *UnarchiveChatsSetting) Reset() { + *x = UnarchiveChatsSetting{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[105] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UnarchiveChatsSetting) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UnarchiveChatsSetting) ProtoMessage() {} + +func (x *UnarchiveChatsSetting) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[105] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UnarchiveChatsSetting.ProtoReflect.Descriptor instead. +func (*UnarchiveChatsSetting) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{105} +} + +func (x *UnarchiveChatsSetting) GetUnarchiveChats() bool { + if x != nil && x.UnarchiveChats != nil { + return *x.UnarchiveChats + } + return false +} + +type TimeFormatAction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + IsTwentyFourHourFormatEnabled *bool `protobuf:"varint,1,opt,name=isTwentyFourHourFormatEnabled" json:"isTwentyFourHourFormatEnabled,omitempty"` +} + +func (x *TimeFormatAction) Reset() { + *x = TimeFormatAction{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[106] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TimeFormatAction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TimeFormatAction) ProtoMessage() {} + +func (x *TimeFormatAction) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[106] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TimeFormatAction.ProtoReflect.Descriptor instead. +func (*TimeFormatAction) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{106} +} + +func (x *TimeFormatAction) GetIsTwentyFourHourFormatEnabled() bool { + if x != nil && x.IsTwentyFourHourFormatEnabled != nil { + return *x.IsTwentyFourHourFormatEnabled + } + return false +} + +type SyncActionMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key *MessageKey `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` + Timestamp *int64 `protobuf:"varint,2,opt,name=timestamp" json:"timestamp,omitempty"` +} + +func (x *SyncActionMessage) Reset() { + *x = SyncActionMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[107] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SyncActionMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SyncActionMessage) ProtoMessage() {} + +func (x *SyncActionMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[107] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SyncActionMessage.ProtoReflect.Descriptor instead. +func (*SyncActionMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{107} +} + +func (x *SyncActionMessage) GetKey() *MessageKey { + if x != nil { + return x.Key + } + return nil +} + +func (x *SyncActionMessage) GetTimestamp() int64 { + if x != nil && x.Timestamp != nil { + return *x.Timestamp + } + return 0 +} + +type SyncActionMessageRange struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + LastMessageTimestamp *int64 `protobuf:"varint,1,opt,name=lastMessageTimestamp" json:"lastMessageTimestamp,omitempty"` + LastSystemMessageTimestamp *int64 `protobuf:"varint,2,opt,name=lastSystemMessageTimestamp" json:"lastSystemMessageTimestamp,omitempty"` + Messages []*SyncActionMessage `protobuf:"bytes,3,rep,name=messages" json:"messages,omitempty"` +} + +func (x *SyncActionMessageRange) Reset() { + *x = SyncActionMessageRange{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[108] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SyncActionMessageRange) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SyncActionMessageRange) ProtoMessage() {} + +func (x *SyncActionMessageRange) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[108] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SyncActionMessageRange.ProtoReflect.Descriptor instead. +func (*SyncActionMessageRange) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{108} +} + +func (x *SyncActionMessageRange) GetLastMessageTimestamp() int64 { + if x != nil && x.LastMessageTimestamp != nil { + return *x.LastMessageTimestamp + } + return 0 +} + +func (x *SyncActionMessageRange) GetLastSystemMessageTimestamp() int64 { + if x != nil && x.LastSystemMessageTimestamp != nil { + return *x.LastSystemMessageTimestamp + } + return 0 +} + +func (x *SyncActionMessageRange) GetMessages() []*SyncActionMessage { + if x != nil { + return x.Messages + } + return nil +} + +type SubscriptionAction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + IsDeactivated *bool `protobuf:"varint,1,opt,name=isDeactivated" json:"isDeactivated,omitempty"` + IsAutoRenewing *bool `protobuf:"varint,2,opt,name=isAutoRenewing" json:"isAutoRenewing,omitempty"` + ExpirationDate *int64 `protobuf:"varint,3,opt,name=expirationDate" json:"expirationDate,omitempty"` +} + +func (x *SubscriptionAction) Reset() { + *x = SubscriptionAction{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[109] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SubscriptionAction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubscriptionAction) ProtoMessage() {} + +func (x *SubscriptionAction) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[109] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SubscriptionAction.ProtoReflect.Descriptor instead. +func (*SubscriptionAction) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{109} +} + +func (x *SubscriptionAction) GetIsDeactivated() bool { + if x != nil && x.IsDeactivated != nil { + return *x.IsDeactivated + } + return false +} + +func (x *SubscriptionAction) GetIsAutoRenewing() bool { + if x != nil && x.IsAutoRenewing != nil { + return *x.IsAutoRenewing + } + return false +} + +func (x *SubscriptionAction) GetExpirationDate() int64 { + if x != nil && x.ExpirationDate != nil { + return *x.ExpirationDate + } + return 0 +} + +type StickerAction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Url *string `protobuf:"bytes,1,opt,name=url" json:"url,omitempty"` + FileEncSha256 []byte `protobuf:"bytes,2,opt,name=fileEncSha256" json:"fileEncSha256,omitempty"` + MediaKey []byte `protobuf:"bytes,3,opt,name=mediaKey" json:"mediaKey,omitempty"` + Mimetype *string `protobuf:"bytes,4,opt,name=mimetype" json:"mimetype,omitempty"` + Height *uint32 `protobuf:"varint,5,opt,name=height" json:"height,omitempty"` + Width *uint32 `protobuf:"varint,6,opt,name=width" json:"width,omitempty"` + DirectPath *string `protobuf:"bytes,7,opt,name=directPath" json:"directPath,omitempty"` + FileLength *uint64 `protobuf:"varint,8,opt,name=fileLength" json:"fileLength,omitempty"` + IsFavorite *bool `protobuf:"varint,9,opt,name=isFavorite" json:"isFavorite,omitempty"` + DeviceIdHint *uint32 `protobuf:"varint,10,opt,name=deviceIdHint" json:"deviceIdHint,omitempty"` +} + +func (x *StickerAction) Reset() { + *x = StickerAction{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[110] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StickerAction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StickerAction) ProtoMessage() {} + +func (x *StickerAction) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[110] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StickerAction.ProtoReflect.Descriptor instead. +func (*StickerAction) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{110} +} + +func (x *StickerAction) GetUrl() string { + if x != nil && x.Url != nil { + return *x.Url + } + return "" +} + +func (x *StickerAction) GetFileEncSha256() []byte { + if x != nil { + return x.FileEncSha256 + } + return nil +} + +func (x *StickerAction) GetMediaKey() []byte { + if x != nil { + return x.MediaKey + } + return nil +} + +func (x *StickerAction) GetMimetype() string { + if x != nil && x.Mimetype != nil { + return *x.Mimetype + } + return "" +} + +func (x *StickerAction) GetHeight() uint32 { + if x != nil && x.Height != nil { + return *x.Height + } + return 0 +} + +func (x *StickerAction) GetWidth() uint32 { + if x != nil && x.Width != nil { + return *x.Width + } + return 0 +} + +func (x *StickerAction) GetDirectPath() string { + if x != nil && x.DirectPath != nil { + return *x.DirectPath + } + return "" +} + +func (x *StickerAction) GetFileLength() uint64 { + if x != nil && x.FileLength != nil { + return *x.FileLength + } + return 0 +} + +func (x *StickerAction) GetIsFavorite() bool { + if x != nil && x.IsFavorite != nil { + return *x.IsFavorite + } + return false +} + +func (x *StickerAction) GetDeviceIdHint() uint32 { + if x != nil && x.DeviceIdHint != nil { + return *x.DeviceIdHint + } + return 0 +} + +type StarAction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Starred *bool `protobuf:"varint,1,opt,name=starred" json:"starred,omitempty"` +} + +func (x *StarAction) Reset() { + *x = StarAction{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[111] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StarAction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StarAction) ProtoMessage() {} + +func (x *StarAction) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[111] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StarAction.ProtoReflect.Descriptor instead. +func (*StarAction) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{111} +} + +func (x *StarAction) GetStarred() bool { + if x != nil && x.Starred != nil { + return *x.Starred + } + return false +} + +type SecurityNotificationSetting struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ShowNotification *bool `protobuf:"varint,1,opt,name=showNotification" json:"showNotification,omitempty"` +} + +func (x *SecurityNotificationSetting) Reset() { + *x = SecurityNotificationSetting{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[112] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SecurityNotificationSetting) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SecurityNotificationSetting) ProtoMessage() {} + +func (x *SecurityNotificationSetting) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[112] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SecurityNotificationSetting.ProtoReflect.Descriptor instead. +func (*SecurityNotificationSetting) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{112} +} + +func (x *SecurityNotificationSetting) GetShowNotification() bool { + if x != nil && x.ShowNotification != nil { + return *x.ShowNotification + } + return false +} + +type RemoveRecentStickerAction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + LastStickerSentTs *int64 `protobuf:"varint,1,opt,name=lastStickerSentTs" json:"lastStickerSentTs,omitempty"` +} + +func (x *RemoveRecentStickerAction) Reset() { + *x = RemoveRecentStickerAction{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[113] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RemoveRecentStickerAction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveRecentStickerAction) ProtoMessage() {} + +func (x *RemoveRecentStickerAction) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[113] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoveRecentStickerAction.ProtoReflect.Descriptor instead. +func (*RemoveRecentStickerAction) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{113} +} + +func (x *RemoveRecentStickerAction) GetLastStickerSentTs() int64 { + if x != nil && x.LastStickerSentTs != nil { + return *x.LastStickerSentTs + } + return 0 +} + +type RecentEmojiWeightsAction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Weights []*RecentEmojiWeight `protobuf:"bytes,1,rep,name=weights" json:"weights,omitempty"` +} + +func (x *RecentEmojiWeightsAction) Reset() { + *x = RecentEmojiWeightsAction{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[114] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RecentEmojiWeightsAction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RecentEmojiWeightsAction) ProtoMessage() {} + +func (x *RecentEmojiWeightsAction) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[114] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RecentEmojiWeightsAction.ProtoReflect.Descriptor instead. +func (*RecentEmojiWeightsAction) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{114} +} + +func (x *RecentEmojiWeightsAction) GetWeights() []*RecentEmojiWeight { + if x != nil { + return x.Weights + } + return nil +} + +type QuickReplyAction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Shortcut *string `protobuf:"bytes,1,opt,name=shortcut" json:"shortcut,omitempty"` + Message *string `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"` + Keywords []string `protobuf:"bytes,3,rep,name=keywords" json:"keywords,omitempty"` + Count *int32 `protobuf:"varint,4,opt,name=count" json:"count,omitempty"` + Deleted *bool `protobuf:"varint,5,opt,name=deleted" json:"deleted,omitempty"` +} + +func (x *QuickReplyAction) Reset() { + *x = QuickReplyAction{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[115] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QuickReplyAction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QuickReplyAction) ProtoMessage() {} + +func (x *QuickReplyAction) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[115] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QuickReplyAction.ProtoReflect.Descriptor instead. +func (*QuickReplyAction) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{115} +} + +func (x *QuickReplyAction) GetShortcut() string { + if x != nil && x.Shortcut != nil { + return *x.Shortcut + } + return "" +} + +func (x *QuickReplyAction) GetMessage() string { + if x != nil && x.Message != nil { + return *x.Message + } + return "" +} + +func (x *QuickReplyAction) GetKeywords() []string { + if x != nil { + return x.Keywords + } + return nil +} + +func (x *QuickReplyAction) GetCount() int32 { + if x != nil && x.Count != nil { + return *x.Count + } + return 0 +} + +func (x *QuickReplyAction) GetDeleted() bool { + if x != nil && x.Deleted != nil { + return *x.Deleted + } + return false +} + +type PushNameSetting struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` +} + +func (x *PushNameSetting) Reset() { + *x = PushNameSetting{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[116] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PushNameSetting) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PushNameSetting) ProtoMessage() {} + +func (x *PushNameSetting) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[116] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PushNameSetting.ProtoReflect.Descriptor instead. +func (*PushNameSetting) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{116} +} + +func (x *PushNameSetting) GetName() string { + if x != nil && x.Name != nil { + return *x.Name + } + return "" +} + +type PrimaryVersionAction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Version *string `protobuf:"bytes,1,opt,name=version" json:"version,omitempty"` +} + +func (x *PrimaryVersionAction) Reset() { + *x = PrimaryVersionAction{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[117] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PrimaryVersionAction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PrimaryVersionAction) ProtoMessage() {} + +func (x *PrimaryVersionAction) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[117] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PrimaryVersionAction.ProtoReflect.Descriptor instead. +func (*PrimaryVersionAction) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{117} +} + +func (x *PrimaryVersionAction) GetVersion() string { + if x != nil && x.Version != nil { + return *x.Version + } + return "" +} + +type PrimaryFeature struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Flags []string `protobuf:"bytes,1,rep,name=flags" json:"flags,omitempty"` +} + +func (x *PrimaryFeature) Reset() { + *x = PrimaryFeature{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[118] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PrimaryFeature) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PrimaryFeature) ProtoMessage() {} + +func (x *PrimaryFeature) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[118] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PrimaryFeature.ProtoReflect.Descriptor instead. +func (*PrimaryFeature) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{118} +} + +func (x *PrimaryFeature) GetFlags() []string { + if x != nil { + return x.Flags + } + return nil +} + +type PnForLidChatAction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PnJid *string `protobuf:"bytes,1,opt,name=pnJid" json:"pnJid,omitempty"` +} + +func (x *PnForLidChatAction) Reset() { + *x = PnForLidChatAction{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[119] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PnForLidChatAction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PnForLidChatAction) ProtoMessage() {} + +func (x *PnForLidChatAction) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[119] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PnForLidChatAction.ProtoReflect.Descriptor instead. +func (*PnForLidChatAction) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{119} +} + +func (x *PnForLidChatAction) GetPnJid() string { + if x != nil && x.PnJid != nil { + return *x.PnJid + } + return "" +} + +type PinAction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Pinned *bool `protobuf:"varint,1,opt,name=pinned" json:"pinned,omitempty"` +} + +func (x *PinAction) Reset() { + *x = PinAction{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[120] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PinAction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PinAction) ProtoMessage() {} + +func (x *PinAction) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[120] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PinAction.ProtoReflect.Descriptor instead. +func (*PinAction) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{120} +} + +func (x *PinAction) GetPinned() bool { + if x != nil && x.Pinned != nil { + return *x.Pinned + } + return false +} + +type NuxAction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Acknowledged *bool `protobuf:"varint,1,opt,name=acknowledged" json:"acknowledged,omitempty"` +} + +func (x *NuxAction) Reset() { + *x = NuxAction{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[121] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NuxAction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NuxAction) ProtoMessage() {} + +func (x *NuxAction) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[121] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NuxAction.ProtoReflect.Descriptor instead. +func (*NuxAction) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{121} +} + +func (x *NuxAction) GetAcknowledged() bool { + if x != nil && x.Acknowledged != nil { + return *x.Acknowledged + } + return false +} + +type MuteAction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Muted *bool `protobuf:"varint,1,opt,name=muted" json:"muted,omitempty"` + MuteEndTimestamp *int64 `protobuf:"varint,2,opt,name=muteEndTimestamp" json:"muteEndTimestamp,omitempty"` + AutoMuted *bool `protobuf:"varint,3,opt,name=autoMuted" json:"autoMuted,omitempty"` +} + +func (x *MuteAction) Reset() { + *x = MuteAction{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[122] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MuteAction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MuteAction) ProtoMessage() {} + +func (x *MuteAction) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[122] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MuteAction.ProtoReflect.Descriptor instead. +func (*MuteAction) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{122} +} + +func (x *MuteAction) GetMuted() bool { + if x != nil && x.Muted != nil { + return *x.Muted + } + return false +} + +func (x *MuteAction) GetMuteEndTimestamp() int64 { + if x != nil && x.MuteEndTimestamp != nil { + return *x.MuteEndTimestamp + } + return 0 +} + +func (x *MuteAction) GetAutoMuted() bool { + if x != nil && x.AutoMuted != nil { + return *x.AutoMuted + } + return false +} + +type MarkChatAsReadAction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Read *bool `protobuf:"varint,1,opt,name=read" json:"read,omitempty"` + MessageRange *SyncActionMessageRange `protobuf:"bytes,2,opt,name=messageRange" json:"messageRange,omitempty"` +} + +func (x *MarkChatAsReadAction) Reset() { + *x = MarkChatAsReadAction{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[123] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MarkChatAsReadAction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MarkChatAsReadAction) ProtoMessage() {} + +func (x *MarkChatAsReadAction) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[123] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MarkChatAsReadAction.ProtoReflect.Descriptor instead. +func (*MarkChatAsReadAction) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{123} +} + +func (x *MarkChatAsReadAction) GetRead() bool { + if x != nil && x.Read != nil { + return *x.Read + } + return false +} + +func (x *MarkChatAsReadAction) GetMessageRange() *SyncActionMessageRange { + if x != nil { + return x.MessageRange + } + return nil +} + +type LocaleSetting struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Locale *string `protobuf:"bytes,1,opt,name=locale" json:"locale,omitempty"` +} + +func (x *LocaleSetting) Reset() { + *x = LocaleSetting{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[124] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LocaleSetting) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LocaleSetting) ProtoMessage() {} + +func (x *LocaleSetting) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[124] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LocaleSetting.ProtoReflect.Descriptor instead. +func (*LocaleSetting) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{124} +} + +func (x *LocaleSetting) GetLocale() string { + if x != nil && x.Locale != nil { + return *x.Locale + } + return "" +} + +type LabelEditAction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Color *int32 `protobuf:"varint,2,opt,name=color" json:"color,omitempty"` + PredefinedId *int32 `protobuf:"varint,3,opt,name=predefinedId" json:"predefinedId,omitempty"` + Deleted *bool `protobuf:"varint,4,opt,name=deleted" json:"deleted,omitempty"` +} + +func (x *LabelEditAction) Reset() { + *x = LabelEditAction{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[125] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LabelEditAction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LabelEditAction) ProtoMessage() {} + +func (x *LabelEditAction) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[125] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LabelEditAction.ProtoReflect.Descriptor instead. +func (*LabelEditAction) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{125} +} + +func (x *LabelEditAction) GetName() string { + if x != nil && x.Name != nil { + return *x.Name + } + return "" +} + +func (x *LabelEditAction) GetColor() int32 { + if x != nil && x.Color != nil { + return *x.Color + } + return 0 +} + +func (x *LabelEditAction) GetPredefinedId() int32 { + if x != nil && x.PredefinedId != nil { + return *x.PredefinedId + } + return 0 +} + +func (x *LabelEditAction) GetDeleted() bool { + if x != nil && x.Deleted != nil { + return *x.Deleted + } + return false +} + +type LabelAssociationAction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Labeled *bool `protobuf:"varint,1,opt,name=labeled" json:"labeled,omitempty"` +} + +func (x *LabelAssociationAction) Reset() { + *x = LabelAssociationAction{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[126] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LabelAssociationAction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LabelAssociationAction) ProtoMessage() {} + +func (x *LabelAssociationAction) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[126] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LabelAssociationAction.ProtoReflect.Descriptor instead. +func (*LabelAssociationAction) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{126} +} + +func (x *LabelAssociationAction) GetLabeled() bool { + if x != nil && x.Labeled != nil { + return *x.Labeled + } + return false +} + +type KeyExpiration struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ExpiredKeyEpoch *int32 `protobuf:"varint,1,opt,name=expiredKeyEpoch" json:"expiredKeyEpoch,omitempty"` +} + +func (x *KeyExpiration) Reset() { + *x = KeyExpiration{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[127] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KeyExpiration) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeyExpiration) ProtoMessage() {} + +func (x *KeyExpiration) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[127] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KeyExpiration.ProtoReflect.Descriptor instead. +func (*KeyExpiration) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{127} +} + +func (x *KeyExpiration) GetExpiredKeyEpoch() int32 { + if x != nil && x.ExpiredKeyEpoch != nil { + return *x.ExpiredKeyEpoch + } + return 0 +} + +type DeleteMessageForMeAction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DeleteMedia *bool `protobuf:"varint,1,opt,name=deleteMedia" json:"deleteMedia,omitempty"` + MessageTimestamp *int64 `protobuf:"varint,2,opt,name=messageTimestamp" json:"messageTimestamp,omitempty"` +} + +func (x *DeleteMessageForMeAction) Reset() { + *x = DeleteMessageForMeAction{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[128] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteMessageForMeAction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteMessageForMeAction) ProtoMessage() {} + +func (x *DeleteMessageForMeAction) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[128] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteMessageForMeAction.ProtoReflect.Descriptor instead. +func (*DeleteMessageForMeAction) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{128} +} + +func (x *DeleteMessageForMeAction) GetDeleteMedia() bool { + if x != nil && x.DeleteMedia != nil { + return *x.DeleteMedia + } + return false +} + +func (x *DeleteMessageForMeAction) GetMessageTimestamp() int64 { + if x != nil && x.MessageTimestamp != nil { + return *x.MessageTimestamp + } + return 0 +} + +type DeleteChatAction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MessageRange *SyncActionMessageRange `protobuf:"bytes,1,opt,name=messageRange" json:"messageRange,omitempty"` +} + +func (x *DeleteChatAction) Reset() { + *x = DeleteChatAction{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[129] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteChatAction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteChatAction) ProtoMessage() {} + +func (x *DeleteChatAction) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[129] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteChatAction.ProtoReflect.Descriptor instead. +func (*DeleteChatAction) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{129} +} + +func (x *DeleteChatAction) GetMessageRange() *SyncActionMessageRange { + if x != nil { + return x.MessageRange + } + return nil +} + +type ContactAction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FullName *string `protobuf:"bytes,1,opt,name=fullName" json:"fullName,omitempty"` + FirstName *string `protobuf:"bytes,2,opt,name=firstName" json:"firstName,omitempty"` + LidJid *string `protobuf:"bytes,3,opt,name=lidJid" json:"lidJid,omitempty"` +} + +func (x *ContactAction) Reset() { + *x = ContactAction{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[130] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ContactAction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ContactAction) ProtoMessage() {} + +func (x *ContactAction) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[130] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ContactAction.ProtoReflect.Descriptor instead. +func (*ContactAction) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{130} +} + +func (x *ContactAction) GetFullName() string { + if x != nil && x.FullName != nil { + return *x.FullName + } + return "" +} + +func (x *ContactAction) GetFirstName() string { + if x != nil && x.FirstName != nil { + return *x.FirstName + } + return "" +} + +func (x *ContactAction) GetLidJid() string { + if x != nil && x.LidJid != nil { + return *x.LidJid + } + return "" +} + +type ClearChatAction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MessageRange *SyncActionMessageRange `protobuf:"bytes,1,opt,name=messageRange" json:"messageRange,omitempty"` +} + +func (x *ClearChatAction) Reset() { + *x = ClearChatAction{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[131] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ClearChatAction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClearChatAction) ProtoMessage() {} + +func (x *ClearChatAction) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[131] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ClearChatAction.ProtoReflect.Descriptor instead. +func (*ClearChatAction) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{131} +} + +func (x *ClearChatAction) GetMessageRange() *SyncActionMessageRange { + if x != nil { + return x.MessageRange + } + return nil +} + +type ChatAssignmentOpenedStatusAction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ChatOpened *bool `protobuf:"varint,1,opt,name=chatOpened" json:"chatOpened,omitempty"` +} + +func (x *ChatAssignmentOpenedStatusAction) Reset() { + *x = ChatAssignmentOpenedStatusAction{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[132] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ChatAssignmentOpenedStatusAction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChatAssignmentOpenedStatusAction) ProtoMessage() {} + +func (x *ChatAssignmentOpenedStatusAction) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[132] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ChatAssignmentOpenedStatusAction.ProtoReflect.Descriptor instead. +func (*ChatAssignmentOpenedStatusAction) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{132} +} + +func (x *ChatAssignmentOpenedStatusAction) GetChatOpened() bool { + if x != nil && x.ChatOpened != nil { + return *x.ChatOpened + } + return false +} + +type ChatAssignmentAction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DeviceAgentID *string `protobuf:"bytes,1,opt,name=deviceAgentID" json:"deviceAgentID,omitempty"` +} + +func (x *ChatAssignmentAction) Reset() { + *x = ChatAssignmentAction{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[133] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ChatAssignmentAction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChatAssignmentAction) ProtoMessage() {} + +func (x *ChatAssignmentAction) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[133] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ChatAssignmentAction.ProtoReflect.Descriptor instead. +func (*ChatAssignmentAction) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{133} +} + +func (x *ChatAssignmentAction) GetDeviceAgentID() string { + if x != nil && x.DeviceAgentID != nil { + return *x.DeviceAgentID + } + return "" +} + +type ArchiveChatAction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Archived *bool `protobuf:"varint,1,opt,name=archived" json:"archived,omitempty"` + MessageRange *SyncActionMessageRange `protobuf:"bytes,2,opt,name=messageRange" json:"messageRange,omitempty"` +} + +func (x *ArchiveChatAction) Reset() { + *x = ArchiveChatAction{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[134] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ArchiveChatAction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ArchiveChatAction) ProtoMessage() {} + +func (x *ArchiveChatAction) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[134] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ArchiveChatAction.ProtoReflect.Descriptor instead. +func (*ArchiveChatAction) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{134} +} + +func (x *ArchiveChatAction) GetArchived() bool { + if x != nil && x.Archived != nil { + return *x.Archived + } + return false +} + +func (x *ArchiveChatAction) GetMessageRange() *SyncActionMessageRange { + if x != nil { + return x.MessageRange + } + return nil +} + +type AndroidUnsupportedActions struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Allowed *bool `protobuf:"varint,1,opt,name=allowed" json:"allowed,omitempty"` +} + +func (x *AndroidUnsupportedActions) Reset() { + *x = AndroidUnsupportedActions{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[135] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AndroidUnsupportedActions) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AndroidUnsupportedActions) ProtoMessage() {} + +func (x *AndroidUnsupportedActions) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[135] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AndroidUnsupportedActions.ProtoReflect.Descriptor instead. +func (*AndroidUnsupportedActions) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{135} +} + +func (x *AndroidUnsupportedActions) GetAllowed() bool { + if x != nil && x.Allowed != nil { + return *x.Allowed + } + return false +} + +type AgentAction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + DeviceID *int32 `protobuf:"varint,2,opt,name=deviceID" json:"deviceID,omitempty"` + IsDeleted *bool `protobuf:"varint,3,opt,name=isDeleted" json:"isDeleted,omitempty"` +} + +func (x *AgentAction) Reset() { + *x = AgentAction{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[136] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AgentAction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AgentAction) ProtoMessage() {} + +func (x *AgentAction) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[136] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AgentAction.ProtoReflect.Descriptor instead. +func (*AgentAction) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{136} +} + +func (x *AgentAction) GetName() string { + if x != nil && x.Name != nil { + return *x.Name + } + return "" +} + +func (x *AgentAction) GetDeviceID() int32 { + if x != nil && x.DeviceID != nil { + return *x.DeviceID + } + return 0 +} + +func (x *AgentAction) GetIsDeleted() bool { + if x != nil && x.IsDeleted != nil { + return *x.IsDeleted + } + return false +} + +type SyncActionData struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Index []byte `protobuf:"bytes,1,opt,name=index" json:"index,omitempty"` + Value *SyncActionValue `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` + Padding []byte `protobuf:"bytes,3,opt,name=padding" json:"padding,omitempty"` + Version *int32 `protobuf:"varint,4,opt,name=version" json:"version,omitempty"` +} + +func (x *SyncActionData) Reset() { + *x = SyncActionData{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[137] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SyncActionData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SyncActionData) ProtoMessage() {} + +func (x *SyncActionData) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[137] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SyncActionData.ProtoReflect.Descriptor instead. +func (*SyncActionData) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{137} +} + +func (x *SyncActionData) GetIndex() []byte { + if x != nil { + return x.Index + } + return nil +} + +func (x *SyncActionData) GetValue() *SyncActionValue { + if x != nil { + return x.Value + } + return nil +} + +func (x *SyncActionData) GetPadding() []byte { + if x != nil { + return x.Padding + } + return nil +} + +func (x *SyncActionData) GetVersion() int32 { + if x != nil && x.Version != nil { + return *x.Version + } + return 0 +} + +type RecentEmojiWeight struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Emoji *string `protobuf:"bytes,1,opt,name=emoji" json:"emoji,omitempty"` + Weight *float32 `protobuf:"fixed32,2,opt,name=weight" json:"weight,omitempty"` +} + +func (x *RecentEmojiWeight) Reset() { + *x = RecentEmojiWeight{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[138] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RecentEmojiWeight) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RecentEmojiWeight) ProtoMessage() {} + +func (x *RecentEmojiWeight) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[138] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RecentEmojiWeight.ProtoReflect.Descriptor instead. +func (*RecentEmojiWeight) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{138} +} + +func (x *RecentEmojiWeight) GetEmoji() string { + if x != nil && x.Emoji != nil { + return *x.Emoji + } + return "" +} + +func (x *RecentEmojiWeight) GetWeight() float32 { + if x != nil && x.Weight != nil { + return *x.Weight + } + return 0 +} + +type VerifiedNameCertificate struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Details []byte `protobuf:"bytes,1,opt,name=details" json:"details,omitempty"` + Signature []byte `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"` + ServerSignature []byte `protobuf:"bytes,3,opt,name=serverSignature" json:"serverSignature,omitempty"` +} + +func (x *VerifiedNameCertificate) Reset() { + *x = VerifiedNameCertificate{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[139] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VerifiedNameCertificate) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VerifiedNameCertificate) ProtoMessage() {} + +func (x *VerifiedNameCertificate) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[139] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VerifiedNameCertificate.ProtoReflect.Descriptor instead. +func (*VerifiedNameCertificate) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{139} +} + +func (x *VerifiedNameCertificate) GetDetails() []byte { + if x != nil { + return x.Details + } + return nil +} + +func (x *VerifiedNameCertificate) GetSignature() []byte { + if x != nil { + return x.Signature + } + return nil +} + +func (x *VerifiedNameCertificate) GetServerSignature() []byte { + if x != nil { + return x.ServerSignature + } + return nil +} + +type LocalizedName struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Lg *string `protobuf:"bytes,1,opt,name=lg" json:"lg,omitempty"` + Lc *string `protobuf:"bytes,2,opt,name=lc" json:"lc,omitempty"` + VerifiedName *string `protobuf:"bytes,3,opt,name=verifiedName" json:"verifiedName,omitempty"` +} + +func (x *LocalizedName) Reset() { + *x = LocalizedName{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[140] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LocalizedName) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LocalizedName) ProtoMessage() {} + +func (x *LocalizedName) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[140] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LocalizedName.ProtoReflect.Descriptor instead. +func (*LocalizedName) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{140} +} + +func (x *LocalizedName) GetLg() string { + if x != nil && x.Lg != nil { + return *x.Lg + } + return "" +} + +func (x *LocalizedName) GetLc() string { + if x != nil && x.Lc != nil { + return *x.Lc + } + return "" +} + +func (x *LocalizedName) GetVerifiedName() string { + if x != nil && x.VerifiedName != nil { + return *x.VerifiedName + } + return "" +} + +type BizIdentityInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Vlevel *BizIdentityInfo_VerifiedLevelValue `protobuf:"varint,1,opt,name=vlevel,enum=proto.BizIdentityInfo_VerifiedLevelValue" json:"vlevel,omitempty"` + VnameCert *VerifiedNameCertificate `protobuf:"bytes,2,opt,name=vnameCert" json:"vnameCert,omitempty"` + Signed *bool `protobuf:"varint,3,opt,name=signed" json:"signed,omitempty"` + Revoked *bool `protobuf:"varint,4,opt,name=revoked" json:"revoked,omitempty"` + HostStorage *BizIdentityInfo_HostStorageType `protobuf:"varint,5,opt,name=hostStorage,enum=proto.BizIdentityInfo_HostStorageType" json:"hostStorage,omitempty"` + ActualActors *BizIdentityInfo_ActualActorsType `protobuf:"varint,6,opt,name=actualActors,enum=proto.BizIdentityInfo_ActualActorsType" json:"actualActors,omitempty"` + PrivacyModeTs *uint64 `protobuf:"varint,7,opt,name=privacyModeTs" json:"privacyModeTs,omitempty"` + FeatureControls *uint64 `protobuf:"varint,8,opt,name=featureControls" json:"featureControls,omitempty"` +} + +func (x *BizIdentityInfo) Reset() { + *x = BizIdentityInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[141] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BizIdentityInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BizIdentityInfo) ProtoMessage() {} + +func (x *BizIdentityInfo) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[141] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BizIdentityInfo.ProtoReflect.Descriptor instead. +func (*BizIdentityInfo) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{141} +} + +func (x *BizIdentityInfo) GetVlevel() BizIdentityInfo_VerifiedLevelValue { + if x != nil && x.Vlevel != nil { + return *x.Vlevel + } + return BizIdentityInfo_UNKNOWN +} + +func (x *BizIdentityInfo) GetVnameCert() *VerifiedNameCertificate { + if x != nil { + return x.VnameCert + } + return nil +} + +func (x *BizIdentityInfo) GetSigned() bool { + if x != nil && x.Signed != nil { + return *x.Signed + } + return false +} + +func (x *BizIdentityInfo) GetRevoked() bool { + if x != nil && x.Revoked != nil { + return *x.Revoked + } + return false +} + +func (x *BizIdentityInfo) GetHostStorage() BizIdentityInfo_HostStorageType { + if x != nil && x.HostStorage != nil { + return *x.HostStorage + } + return BizIdentityInfo_ON_PREMISE +} + +func (x *BizIdentityInfo) GetActualActors() BizIdentityInfo_ActualActorsType { + if x != nil && x.ActualActors != nil { + return *x.ActualActors + } + return BizIdentityInfo_SELF +} + +func (x *BizIdentityInfo) GetPrivacyModeTs() uint64 { + if x != nil && x.PrivacyModeTs != nil { + return *x.PrivacyModeTs + } + return 0 +} + +func (x *BizIdentityInfo) GetFeatureControls() uint64 { + if x != nil && x.FeatureControls != nil { + return *x.FeatureControls + } + return 0 +} + +type BizAccountPayload struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + VnameCert *VerifiedNameCertificate `protobuf:"bytes,1,opt,name=vnameCert" json:"vnameCert,omitempty"` + BizAcctLinkInfo []byte `protobuf:"bytes,2,opt,name=bizAcctLinkInfo" json:"bizAcctLinkInfo,omitempty"` +} + +func (x *BizAccountPayload) Reset() { + *x = BizAccountPayload{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[142] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BizAccountPayload) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BizAccountPayload) ProtoMessage() {} + +func (x *BizAccountPayload) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[142] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BizAccountPayload.ProtoReflect.Descriptor instead. +func (*BizAccountPayload) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{142} +} + +func (x *BizAccountPayload) GetVnameCert() *VerifiedNameCertificate { + if x != nil { + return x.VnameCert + } + return nil +} + +func (x *BizAccountPayload) GetBizAcctLinkInfo() []byte { + if x != nil { + return x.BizAcctLinkInfo + } + return nil +} + +type BizAccountLinkInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + WhatsappBizAcctFbid *uint64 `protobuf:"varint,1,opt,name=whatsappBizAcctFbid" json:"whatsappBizAcctFbid,omitempty"` + WhatsappAcctNumber *string `protobuf:"bytes,2,opt,name=whatsappAcctNumber" json:"whatsappAcctNumber,omitempty"` + IssueTime *uint64 `protobuf:"varint,3,opt,name=issueTime" json:"issueTime,omitempty"` + HostStorage *BizAccountLinkInfo_HostStorageType `protobuf:"varint,4,opt,name=hostStorage,enum=proto.BizAccountLinkInfo_HostStorageType" json:"hostStorage,omitempty"` + AccountType *BizAccountLinkInfo_AccountType `protobuf:"varint,5,opt,name=accountType,enum=proto.BizAccountLinkInfo_AccountType" json:"accountType,omitempty"` +} + +func (x *BizAccountLinkInfo) Reset() { + *x = BizAccountLinkInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[143] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BizAccountLinkInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BizAccountLinkInfo) ProtoMessage() {} + +func (x *BizAccountLinkInfo) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[143] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BizAccountLinkInfo.ProtoReflect.Descriptor instead. +func (*BizAccountLinkInfo) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{143} +} + +func (x *BizAccountLinkInfo) GetWhatsappBizAcctFbid() uint64 { + if x != nil && x.WhatsappBizAcctFbid != nil { + return *x.WhatsappBizAcctFbid + } + return 0 +} + +func (x *BizAccountLinkInfo) GetWhatsappAcctNumber() string { + if x != nil && x.WhatsappAcctNumber != nil { + return *x.WhatsappAcctNumber + } + return "" +} + +func (x *BizAccountLinkInfo) GetIssueTime() uint64 { + if x != nil && x.IssueTime != nil { + return *x.IssueTime + } + return 0 +} + +func (x *BizAccountLinkInfo) GetHostStorage() BizAccountLinkInfo_HostStorageType { + if x != nil && x.HostStorage != nil { + return *x.HostStorage + } + return BizAccountLinkInfo_ON_PREMISE +} + +func (x *BizAccountLinkInfo) GetAccountType() BizAccountLinkInfo_AccountType { + if x != nil && x.AccountType != nil { + return *x.AccountType + } + return BizAccountLinkInfo_ENTERPRISE +} + +type HandshakeMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ClientHello *HandshakeClientHello `protobuf:"bytes,2,opt,name=clientHello" json:"clientHello,omitempty"` + ServerHello *HandshakeServerHello `protobuf:"bytes,3,opt,name=serverHello" json:"serverHello,omitempty"` + ClientFinish *HandshakeClientFinish `protobuf:"bytes,4,opt,name=clientFinish" json:"clientFinish,omitempty"` +} + +func (x *HandshakeMessage) Reset() { + *x = HandshakeMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[144] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HandshakeMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HandshakeMessage) ProtoMessage() {} + +func (x *HandshakeMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[144] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HandshakeMessage.ProtoReflect.Descriptor instead. +func (*HandshakeMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{144} +} + +func (x *HandshakeMessage) GetClientHello() *HandshakeClientHello { + if x != nil { + return x.ClientHello + } + return nil +} + +func (x *HandshakeMessage) GetServerHello() *HandshakeServerHello { + if x != nil { + return x.ServerHello + } + return nil +} + +func (x *HandshakeMessage) GetClientFinish() *HandshakeClientFinish { + if x != nil { + return x.ClientFinish + } + return nil +} + +type HandshakeServerHello struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Ephemeral []byte `protobuf:"bytes,1,opt,name=ephemeral" json:"ephemeral,omitempty"` + Static []byte `protobuf:"bytes,2,opt,name=static" json:"static,omitempty"` + Payload []byte `protobuf:"bytes,3,opt,name=payload" json:"payload,omitempty"` +} + +func (x *HandshakeServerHello) Reset() { + *x = HandshakeServerHello{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[145] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HandshakeServerHello) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HandshakeServerHello) ProtoMessage() {} + +func (x *HandshakeServerHello) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[145] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HandshakeServerHello.ProtoReflect.Descriptor instead. +func (*HandshakeServerHello) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{145} +} + +func (x *HandshakeServerHello) GetEphemeral() []byte { + if x != nil { + return x.Ephemeral + } + return nil +} + +func (x *HandshakeServerHello) GetStatic() []byte { + if x != nil { + return x.Static + } + return nil +} + +func (x *HandshakeServerHello) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +type HandshakeClientHello struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Ephemeral []byte `protobuf:"bytes,1,opt,name=ephemeral" json:"ephemeral,omitempty"` + Static []byte `protobuf:"bytes,2,opt,name=static" json:"static,omitempty"` + Payload []byte `protobuf:"bytes,3,opt,name=payload" json:"payload,omitempty"` +} + +func (x *HandshakeClientHello) Reset() { + *x = HandshakeClientHello{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[146] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HandshakeClientHello) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HandshakeClientHello) ProtoMessage() {} + +func (x *HandshakeClientHello) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[146] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HandshakeClientHello.ProtoReflect.Descriptor instead. +func (*HandshakeClientHello) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{146} +} + +func (x *HandshakeClientHello) GetEphemeral() []byte { + if x != nil { + return x.Ephemeral + } + return nil +} + +func (x *HandshakeClientHello) GetStatic() []byte { + if x != nil { + return x.Static + } + return nil +} + +func (x *HandshakeClientHello) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +type HandshakeClientFinish struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Static []byte `protobuf:"bytes,1,opt,name=static" json:"static,omitempty"` + Payload []byte `protobuf:"bytes,2,opt,name=payload" json:"payload,omitempty"` +} + +func (x *HandshakeClientFinish) Reset() { + *x = HandshakeClientFinish{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[147] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HandshakeClientFinish) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HandshakeClientFinish) ProtoMessage() {} + +func (x *HandshakeClientFinish) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[147] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HandshakeClientFinish.ProtoReflect.Descriptor instead. +func (*HandshakeClientFinish) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{147} +} + +func (x *HandshakeClientFinish) GetStatic() []byte { + if x != nil { + return x.Static + } + return nil +} + +func (x *HandshakeClientFinish) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +type ClientPayload struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Username *uint64 `protobuf:"varint,1,opt,name=username" json:"username,omitempty"` + Passive *bool `protobuf:"varint,3,opt,name=passive" json:"passive,omitempty"` + UserAgent *ClientPayload_UserAgent `protobuf:"bytes,5,opt,name=userAgent" json:"userAgent,omitempty"` + WebInfo *ClientPayload_WebInfo `protobuf:"bytes,6,opt,name=webInfo" json:"webInfo,omitempty"` + PushName *string `protobuf:"bytes,7,opt,name=pushName" json:"pushName,omitempty"` + SessionId *int32 `protobuf:"fixed32,9,opt,name=sessionId" json:"sessionId,omitempty"` + ShortConnect *bool `protobuf:"varint,10,opt,name=shortConnect" json:"shortConnect,omitempty"` + ConnectType *ClientPayload_ConnectType `protobuf:"varint,12,opt,name=connectType,enum=proto.ClientPayload_ConnectType" json:"connectType,omitempty"` + ConnectReason *ClientPayload_ConnectReason `protobuf:"varint,13,opt,name=connectReason,enum=proto.ClientPayload_ConnectReason" json:"connectReason,omitempty"` + Shards []int32 `protobuf:"varint,14,rep,name=shards" json:"shards,omitempty"` + DnsSource *ClientPayload_DNSSource `protobuf:"bytes,15,opt,name=dnsSource" json:"dnsSource,omitempty"` + ConnectAttemptCount *uint32 `protobuf:"varint,16,opt,name=connectAttemptCount" json:"connectAttemptCount,omitempty"` + Device *uint32 `protobuf:"varint,18,opt,name=device" json:"device,omitempty"` + DevicePairingData *ClientPayload_DevicePairingRegistrationData `protobuf:"bytes,19,opt,name=devicePairingData" json:"devicePairingData,omitempty"` + Product *ClientPayload_Product `protobuf:"varint,20,opt,name=product,enum=proto.ClientPayload_Product" json:"product,omitempty"` + FbCat []byte `protobuf:"bytes,21,opt,name=fbCat" json:"fbCat,omitempty"` + FbUserAgent []byte `protobuf:"bytes,22,opt,name=fbUserAgent" json:"fbUserAgent,omitempty"` + Oc *bool `protobuf:"varint,23,opt,name=oc" json:"oc,omitempty"` + Lc *int32 `protobuf:"varint,24,opt,name=lc" json:"lc,omitempty"` + IosAppExtension *ClientPayload_IOSAppExtension `protobuf:"varint,30,opt,name=iosAppExtension,enum=proto.ClientPayload_IOSAppExtension" json:"iosAppExtension,omitempty"` + FbAppId *uint64 `protobuf:"varint,31,opt,name=fbAppId" json:"fbAppId,omitempty"` + FbDeviceId []byte `protobuf:"bytes,32,opt,name=fbDeviceId" json:"fbDeviceId,omitempty"` + Pull *bool `protobuf:"varint,33,opt,name=pull" json:"pull,omitempty"` + PaddingBytes []byte `protobuf:"bytes,34,opt,name=paddingBytes" json:"paddingBytes,omitempty"` + BizMarketSegment *ClientPayload_BizMarketSegment `protobuf:"varint,35,opt,name=bizMarketSegment,enum=proto.ClientPayload_BizMarketSegment" json:"bizMarketSegment,omitempty"` + YearClass *int32 `protobuf:"varint,36,opt,name=yearClass" json:"yearClass,omitempty"` + MemClass *int32 `protobuf:"varint,37,opt,name=memClass" json:"memClass,omitempty"` +} + +func (x *ClientPayload) Reset() { + *x = ClientPayload{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[148] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ClientPayload) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClientPayload) ProtoMessage() {} + +func (x *ClientPayload) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[148] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ClientPayload.ProtoReflect.Descriptor instead. +func (*ClientPayload) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{148} +} + +func (x *ClientPayload) GetUsername() uint64 { + if x != nil && x.Username != nil { + return *x.Username + } + return 0 +} + +func (x *ClientPayload) GetPassive() bool { + if x != nil && x.Passive != nil { + return *x.Passive + } + return false +} + +func (x *ClientPayload) GetUserAgent() *ClientPayload_UserAgent { + if x != nil { + return x.UserAgent + } + return nil +} + +func (x *ClientPayload) GetWebInfo() *ClientPayload_WebInfo { + if x != nil { + return x.WebInfo + } + return nil +} + +func (x *ClientPayload) GetPushName() string { + if x != nil && x.PushName != nil { + return *x.PushName + } + return "" +} + +func (x *ClientPayload) GetSessionId() int32 { + if x != nil && x.SessionId != nil { + return *x.SessionId + } + return 0 +} + +func (x *ClientPayload) GetShortConnect() bool { + if x != nil && x.ShortConnect != nil { + return *x.ShortConnect + } + return false +} + +func (x *ClientPayload) GetConnectType() ClientPayload_ConnectType { + if x != nil && x.ConnectType != nil { + return *x.ConnectType + } + return ClientPayload_CELLULAR_UNKNOWN +} + +func (x *ClientPayload) GetConnectReason() ClientPayload_ConnectReason { + if x != nil && x.ConnectReason != nil { + return *x.ConnectReason + } + return ClientPayload_PUSH +} + +func (x *ClientPayload) GetShards() []int32 { + if x != nil { + return x.Shards + } + return nil +} + +func (x *ClientPayload) GetDnsSource() *ClientPayload_DNSSource { + if x != nil { + return x.DnsSource + } + return nil +} + +func (x *ClientPayload) GetConnectAttemptCount() uint32 { + if x != nil && x.ConnectAttemptCount != nil { + return *x.ConnectAttemptCount + } + return 0 +} + +func (x *ClientPayload) GetDevice() uint32 { + if x != nil && x.Device != nil { + return *x.Device + } + return 0 +} + +func (x *ClientPayload) GetDevicePairingData() *ClientPayload_DevicePairingRegistrationData { + if x != nil { + return x.DevicePairingData + } + return nil +} + +func (x *ClientPayload) GetProduct() ClientPayload_Product { + if x != nil && x.Product != nil { + return *x.Product + } + return ClientPayload_WHATSAPP +} + +func (x *ClientPayload) GetFbCat() []byte { + if x != nil { + return x.FbCat + } + return nil +} + +func (x *ClientPayload) GetFbUserAgent() []byte { + if x != nil { + return x.FbUserAgent + } + return nil +} + +func (x *ClientPayload) GetOc() bool { + if x != nil && x.Oc != nil { + return *x.Oc + } + return false +} + +func (x *ClientPayload) GetLc() int32 { + if x != nil && x.Lc != nil { + return *x.Lc + } + return 0 +} + +func (x *ClientPayload) GetIosAppExtension() ClientPayload_IOSAppExtension { + if x != nil && x.IosAppExtension != nil { + return *x.IosAppExtension + } + return ClientPayload_SHARE_EXTENSION +} + +func (x *ClientPayload) GetFbAppId() uint64 { + if x != nil && x.FbAppId != nil { + return *x.FbAppId + } + return 0 +} + +func (x *ClientPayload) GetFbDeviceId() []byte { + if x != nil { + return x.FbDeviceId + } + return nil +} + +func (x *ClientPayload) GetPull() bool { + if x != nil && x.Pull != nil { + return *x.Pull + } + return false +} + +func (x *ClientPayload) GetPaddingBytes() []byte { + if x != nil { + return x.PaddingBytes + } + return nil +} + +func (x *ClientPayload) GetBizMarketSegment() ClientPayload_BizMarketSegment { + if x != nil && x.BizMarketSegment != nil { + return *x.BizMarketSegment + } + return ClientPayload_DEFAULT +} + +func (x *ClientPayload) GetYearClass() int32 { + if x != nil && x.YearClass != nil { + return *x.YearClass + } + return 0 +} + +func (x *ClientPayload) GetMemClass() int32 { + if x != nil && x.MemClass != nil { + return *x.MemClass + } + return 0 +} + +type WebNotificationsInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + 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 []*WebMessageInfo `protobuf:"bytes,5,rep,name=notifyMessages" json:"notifyMessages,omitempty"` +} + +func (x *WebNotificationsInfo) Reset() { + *x = WebNotificationsInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[149] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WebNotificationsInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WebNotificationsInfo) ProtoMessage() {} + +func (x *WebNotificationsInfo) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[149] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WebNotificationsInfo.ProtoReflect.Descriptor instead. +func (*WebNotificationsInfo) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{149} +} + +func (x *WebNotificationsInfo) GetTimestamp() uint64 { + if x != nil && x.Timestamp != nil { + return *x.Timestamp + } + return 0 +} + +func (x *WebNotificationsInfo) GetUnreadChats() uint32 { + if x != nil && x.UnreadChats != nil { + return *x.UnreadChats + } + return 0 +} + +func (x *WebNotificationsInfo) GetNotifyMessageCount() uint32 { + if x != nil && x.NotifyMessageCount != nil { + return *x.NotifyMessageCount + } + return 0 +} + +func (x *WebNotificationsInfo) GetNotifyMessages() []*WebMessageInfo { + if x != nil { + return x.NotifyMessages + } + return nil +} + +type WebMessageInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + 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" json:"status,omitempty"` + Participant *string `protobuf:"bytes,5,opt,name=participant" json:"participant,omitempty"` + MessageC2STimestamp *uint64 `protobuf:"varint,6,opt,name=messageC2STimestamp" json:"messageC2STimestamp,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"` + PaymentInfo *PaymentInfo `protobuf:"bytes,29,opt,name=paymentInfo" json:"paymentInfo,omitempty"` + FinalLiveLocation *LiveLocationMessage `protobuf:"bytes,30,opt,name=finalLiveLocation" json:"finalLiveLocation,omitempty"` + QuotedPaymentInfo *PaymentInfo `protobuf:"bytes,31,opt,name=quotedPaymentInfo" json:"quotedPaymentInfo,omitempty"` + EphemeralStartTimestamp *uint64 `protobuf:"varint,32,opt,name=ephemeralStartTimestamp" json:"ephemeralStartTimestamp,omitempty"` + EphemeralDuration *uint32 `protobuf:"varint,33,opt,name=ephemeralDuration" json:"ephemeralDuration,omitempty"` + EphemeralOffToOn *bool `protobuf:"varint,34,opt,name=ephemeralOffToOn" json:"ephemeralOffToOn,omitempty"` + EphemeralOutOfSync *bool `protobuf:"varint,35,opt,name=ephemeralOutOfSync" json:"ephemeralOutOfSync,omitempty"` + BizPrivacyStatus *WebMessageInfo_BizPrivacyStatus `protobuf:"varint,36,opt,name=bizPrivacyStatus,enum=proto.WebMessageInfo_BizPrivacyStatus" json:"bizPrivacyStatus,omitempty"` + VerifiedBizName *string `protobuf:"bytes,37,opt,name=verifiedBizName" json:"verifiedBizName,omitempty"` + MediaData *MediaData `protobuf:"bytes,38,opt,name=mediaData" json:"mediaData,omitempty"` + PhotoChange *PhotoChange `protobuf:"bytes,39,opt,name=photoChange" json:"photoChange,omitempty"` + UserReceipt []*UserReceipt `protobuf:"bytes,40,rep,name=userReceipt" json:"userReceipt,omitempty"` + Reactions []*Reaction `protobuf:"bytes,41,rep,name=reactions" json:"reactions,omitempty"` + QuotedStickerData *MediaData `protobuf:"bytes,42,opt,name=quotedStickerData" json:"quotedStickerData,omitempty"` + FutureproofData []byte `protobuf:"bytes,43,opt,name=futureproofData" json:"futureproofData,omitempty"` + StatusPsa *StatusPSA `protobuf:"bytes,44,opt,name=statusPsa" json:"statusPsa,omitempty"` + PollUpdates []*PollUpdate `protobuf:"bytes,45,rep,name=pollUpdates" json:"pollUpdates,omitempty"` + PollAdditionalMetadata *PollAdditionalMetadata `protobuf:"bytes,46,opt,name=pollAdditionalMetadata" json:"pollAdditionalMetadata,omitempty"` + AgentId *string `protobuf:"bytes,47,opt,name=agentId" json:"agentId,omitempty"` + StatusAlreadyViewed *bool `protobuf:"varint,48,opt,name=statusAlreadyViewed" json:"statusAlreadyViewed,omitempty"` + MessageSecret []byte `protobuf:"bytes,49,opt,name=messageSecret" json:"messageSecret,omitempty"` + KeepInChat *KeepInChat `protobuf:"bytes,50,opt,name=keepInChat" json:"keepInChat,omitempty"` + OriginalSelfAuthorUserJidString *string `protobuf:"bytes,51,opt,name=originalSelfAuthorUserJidString" json:"originalSelfAuthorUserJidString,omitempty"` + RevokeMessageTimestamp *uint64 `protobuf:"varint,52,opt,name=revokeMessageTimestamp" json:"revokeMessageTimestamp,omitempty"` +} + +func (x *WebMessageInfo) Reset() { + *x = WebMessageInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[150] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WebMessageInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WebMessageInfo) ProtoMessage() {} + +func (x *WebMessageInfo) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[150] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WebMessageInfo.ProtoReflect.Descriptor instead. +func (*WebMessageInfo) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{150} +} + +func (x *WebMessageInfo) GetKey() *MessageKey { + if x != nil { + return x.Key + } + return nil +} + +func (x *WebMessageInfo) GetMessage() *Message { + if x != nil { + return x.Message + } + return nil +} + +func (x *WebMessageInfo) GetMessageTimestamp() uint64 { + if x != nil && x.MessageTimestamp != nil { + return *x.MessageTimestamp + } + return 0 +} + +func (x *WebMessageInfo) GetStatus() WebMessageInfo_Status { + if x != nil && x.Status != nil { + return *x.Status + } + return WebMessageInfo_ERROR +} + +func (x *WebMessageInfo) GetParticipant() string { + if x != nil && x.Participant != nil { + return *x.Participant + } + return "" +} + +func (x *WebMessageInfo) GetMessageC2STimestamp() uint64 { + if x != nil && x.MessageC2STimestamp != nil { + return *x.MessageC2STimestamp + } + return 0 +} + +func (x *WebMessageInfo) GetIgnore() bool { + if x != nil && x.Ignore != nil { + return *x.Ignore + } + return false +} + +func (x *WebMessageInfo) GetStarred() bool { + if x != nil && x.Starred != nil { + return *x.Starred + } + return false +} + +func (x *WebMessageInfo) GetBroadcast() bool { + if x != nil && x.Broadcast != nil { + return *x.Broadcast + } + return false +} + +func (x *WebMessageInfo) GetPushName() string { + if x != nil && x.PushName != nil { + return *x.PushName + } + return "" +} + +func (x *WebMessageInfo) GetMediaCiphertextSha256() []byte { + if x != nil { + return x.MediaCiphertextSha256 + } + return nil +} + +func (x *WebMessageInfo) GetMulticast() bool { + if x != nil && x.Multicast != nil { + return *x.Multicast + } + return false +} + +func (x *WebMessageInfo) GetUrlText() bool { + if x != nil && x.UrlText != nil { + return *x.UrlText + } + return false +} + +func (x *WebMessageInfo) GetUrlNumber() bool { + if x != nil && x.UrlNumber != nil { + return *x.UrlNumber + } + return false +} + +func (x *WebMessageInfo) GetMessageStubType() WebMessageInfo_StubType { + if x != nil && x.MessageStubType != nil { + return *x.MessageStubType + } + return WebMessageInfo_UNKNOWN +} + +func (x *WebMessageInfo) GetClearMedia() bool { + if x != nil && x.ClearMedia != nil { + return *x.ClearMedia + } + return false +} + +func (x *WebMessageInfo) GetMessageStubParameters() []string { + if x != nil { + return x.MessageStubParameters + } + return nil +} + +func (x *WebMessageInfo) GetDuration() uint32 { + if x != nil && x.Duration != nil { + return *x.Duration + } + return 0 +} + +func (x *WebMessageInfo) GetLabels() []string { + if x != nil { + return x.Labels + } + return nil +} + +func (x *WebMessageInfo) GetPaymentInfo() *PaymentInfo { + if x != nil { + return x.PaymentInfo + } + return nil +} + +func (x *WebMessageInfo) GetFinalLiveLocation() *LiveLocationMessage { + if x != nil { + return x.FinalLiveLocation + } + return nil +} + +func (x *WebMessageInfo) GetQuotedPaymentInfo() *PaymentInfo { + if x != nil { + return x.QuotedPaymentInfo + } + return nil +} + +func (x *WebMessageInfo) GetEphemeralStartTimestamp() uint64 { + if x != nil && x.EphemeralStartTimestamp != nil { + return *x.EphemeralStartTimestamp + } + return 0 +} + +func (x *WebMessageInfo) GetEphemeralDuration() uint32 { + if x != nil && x.EphemeralDuration != nil { + return *x.EphemeralDuration + } + return 0 +} + +func (x *WebMessageInfo) GetEphemeralOffToOn() bool { + if x != nil && x.EphemeralOffToOn != nil { + return *x.EphemeralOffToOn + } + return false +} + +func (x *WebMessageInfo) GetEphemeralOutOfSync() bool { + if x != nil && x.EphemeralOutOfSync != nil { + return *x.EphemeralOutOfSync + } + return false +} + +func (x *WebMessageInfo) GetBizPrivacyStatus() WebMessageInfo_BizPrivacyStatus { + if x != nil && x.BizPrivacyStatus != nil { + return *x.BizPrivacyStatus + } + return WebMessageInfo_E2EE +} + +func (x *WebMessageInfo) GetVerifiedBizName() string { + if x != nil && x.VerifiedBizName != nil { + return *x.VerifiedBizName + } + return "" +} + +func (x *WebMessageInfo) GetMediaData() *MediaData { + if x != nil { + return x.MediaData + } + return nil +} + +func (x *WebMessageInfo) GetPhotoChange() *PhotoChange { + if x != nil { + return x.PhotoChange + } + return nil +} + +func (x *WebMessageInfo) GetUserReceipt() []*UserReceipt { + if x != nil { + return x.UserReceipt + } + return nil +} + +func (x *WebMessageInfo) GetReactions() []*Reaction { + if x != nil { + return x.Reactions + } + return nil +} + +func (x *WebMessageInfo) GetQuotedStickerData() *MediaData { + if x != nil { + return x.QuotedStickerData + } + return nil +} + +func (x *WebMessageInfo) GetFutureproofData() []byte { + if x != nil { + return x.FutureproofData + } + return nil +} + +func (x *WebMessageInfo) GetStatusPsa() *StatusPSA { + if x != nil { + return x.StatusPsa + } + return nil +} + +func (x *WebMessageInfo) GetPollUpdates() []*PollUpdate { + if x != nil { + return x.PollUpdates + } + return nil +} + +func (x *WebMessageInfo) GetPollAdditionalMetadata() *PollAdditionalMetadata { + if x != nil { + return x.PollAdditionalMetadata + } + return nil +} + +func (x *WebMessageInfo) GetAgentId() string { + if x != nil && x.AgentId != nil { + return *x.AgentId + } + return "" +} + +func (x *WebMessageInfo) GetStatusAlreadyViewed() bool { + if x != nil && x.StatusAlreadyViewed != nil { + return *x.StatusAlreadyViewed + } + return false +} + +func (x *WebMessageInfo) GetMessageSecret() []byte { + if x != nil { + return x.MessageSecret + } + return nil +} + +func (x *WebMessageInfo) GetKeepInChat() *KeepInChat { + if x != nil { + return x.KeepInChat + } + return nil +} + +func (x *WebMessageInfo) GetOriginalSelfAuthorUserJidString() string { + if x != nil && x.OriginalSelfAuthorUserJidString != nil { + return *x.OriginalSelfAuthorUserJidString + } + return "" +} + +func (x *WebMessageInfo) GetRevokeMessageTimestamp() uint64 { + if x != nil && x.RevokeMessageTimestamp != nil { + return *x.RevokeMessageTimestamp + } + return 0 +} + +type WebFeatures struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + 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"` + Payments *WebFeatures_Flag `protobuf:"varint,11,opt,name=payments,enum=proto.WebFeatures_Flag" json:"payments,omitempty"` + StickerPackQuery *WebFeatures_Flag `protobuf:"varint,12,opt,name=stickerPackQuery,enum=proto.WebFeatures_Flag" json:"stickerPackQuery,omitempty"` + LiveLocationsFinal *WebFeatures_Flag `protobuf:"varint,13,opt,name=liveLocationsFinal,enum=proto.WebFeatures_Flag" json:"liveLocationsFinal,omitempty"` + LabelsEdit *WebFeatures_Flag `protobuf:"varint,14,opt,name=labelsEdit,enum=proto.WebFeatures_Flag" json:"labelsEdit,omitempty"` + MediaUpload *WebFeatures_Flag `protobuf:"varint,15,opt,name=mediaUpload,enum=proto.WebFeatures_Flag" json:"mediaUpload,omitempty"` + MediaUploadRichQuickReplies *WebFeatures_Flag `protobuf:"varint,18,opt,name=mediaUploadRichQuickReplies,enum=proto.WebFeatures_Flag" json:"mediaUploadRichQuickReplies,omitempty"` + VnameV2 *WebFeatures_Flag `protobuf:"varint,19,opt,name=vnameV2,enum=proto.WebFeatures_Flag" json:"vnameV2,omitempty"` + VideoPlaybackUrl *WebFeatures_Flag `protobuf:"varint,20,opt,name=videoPlaybackUrl,enum=proto.WebFeatures_Flag" json:"videoPlaybackUrl,omitempty"` + StatusRanking *WebFeatures_Flag `protobuf:"varint,21,opt,name=statusRanking,enum=proto.WebFeatures_Flag" json:"statusRanking,omitempty"` + VoipIndividualVideo *WebFeatures_Flag `protobuf:"varint,22,opt,name=voipIndividualVideo,enum=proto.WebFeatures_Flag" json:"voipIndividualVideo,omitempty"` + ThirdPartyStickers *WebFeatures_Flag `protobuf:"varint,23,opt,name=thirdPartyStickers,enum=proto.WebFeatures_Flag" json:"thirdPartyStickers,omitempty"` + FrequentlyForwardedSetting *WebFeatures_Flag `protobuf:"varint,24,opt,name=frequentlyForwardedSetting,enum=proto.WebFeatures_Flag" json:"frequentlyForwardedSetting,omitempty"` + GroupsV4JoinPermission *WebFeatures_Flag `protobuf:"varint,25,opt,name=groupsV4JoinPermission,enum=proto.WebFeatures_Flag" json:"groupsV4JoinPermission,omitempty"` + RecentStickers *WebFeatures_Flag `protobuf:"varint,26,opt,name=recentStickers,enum=proto.WebFeatures_Flag" json:"recentStickers,omitempty"` + Catalog *WebFeatures_Flag `protobuf:"varint,27,opt,name=catalog,enum=proto.WebFeatures_Flag" json:"catalog,omitempty"` + StarredStickers *WebFeatures_Flag `protobuf:"varint,28,opt,name=starredStickers,enum=proto.WebFeatures_Flag" json:"starredStickers,omitempty"` + VoipGroupCall *WebFeatures_Flag `protobuf:"varint,29,opt,name=voipGroupCall,enum=proto.WebFeatures_Flag" json:"voipGroupCall,omitempty"` + TemplateMessage *WebFeatures_Flag `protobuf:"varint,30,opt,name=templateMessage,enum=proto.WebFeatures_Flag" json:"templateMessage,omitempty"` + TemplateMessageInteractivity *WebFeatures_Flag `protobuf:"varint,31,opt,name=templateMessageInteractivity,enum=proto.WebFeatures_Flag" json:"templateMessageInteractivity,omitempty"` + EphemeralMessages *WebFeatures_Flag `protobuf:"varint,32,opt,name=ephemeralMessages,enum=proto.WebFeatures_Flag" json:"ephemeralMessages,omitempty"` + E2ENotificationSync *WebFeatures_Flag `protobuf:"varint,33,opt,name=e2ENotificationSync,enum=proto.WebFeatures_Flag" json:"e2ENotificationSync,omitempty"` + RecentStickersV2 *WebFeatures_Flag `protobuf:"varint,34,opt,name=recentStickersV2,enum=proto.WebFeatures_Flag" json:"recentStickersV2,omitempty"` + RecentStickersV3 *WebFeatures_Flag `protobuf:"varint,36,opt,name=recentStickersV3,enum=proto.WebFeatures_Flag" json:"recentStickersV3,omitempty"` + UserNotice *WebFeatures_Flag `protobuf:"varint,37,opt,name=userNotice,enum=proto.WebFeatures_Flag" json:"userNotice,omitempty"` + Support *WebFeatures_Flag `protobuf:"varint,39,opt,name=support,enum=proto.WebFeatures_Flag" json:"support,omitempty"` + GroupUiiCleanup *WebFeatures_Flag `protobuf:"varint,40,opt,name=groupUiiCleanup,enum=proto.WebFeatures_Flag" json:"groupUiiCleanup,omitempty"` + GroupDogfoodingInternalOnly *WebFeatures_Flag `protobuf:"varint,41,opt,name=groupDogfoodingInternalOnly,enum=proto.WebFeatures_Flag" json:"groupDogfoodingInternalOnly,omitempty"` + SettingsSync *WebFeatures_Flag `protobuf:"varint,42,opt,name=settingsSync,enum=proto.WebFeatures_Flag" json:"settingsSync,omitempty"` + ArchiveV2 *WebFeatures_Flag `protobuf:"varint,43,opt,name=archiveV2,enum=proto.WebFeatures_Flag" json:"archiveV2,omitempty"` + EphemeralAllowGroupMembers *WebFeatures_Flag `protobuf:"varint,44,opt,name=ephemeralAllowGroupMembers,enum=proto.WebFeatures_Flag" json:"ephemeralAllowGroupMembers,omitempty"` + Ephemeral24HDuration *WebFeatures_Flag `protobuf:"varint,45,opt,name=ephemeral24HDuration,enum=proto.WebFeatures_Flag" json:"ephemeral24HDuration,omitempty"` + MdForceUpgrade *WebFeatures_Flag `protobuf:"varint,46,opt,name=mdForceUpgrade,enum=proto.WebFeatures_Flag" json:"mdForceUpgrade,omitempty"` + DisappearingMode *WebFeatures_Flag `protobuf:"varint,47,opt,name=disappearingMode,enum=proto.WebFeatures_Flag" json:"disappearingMode,omitempty"` + ExternalMdOptInAvailable *WebFeatures_Flag `protobuf:"varint,48,opt,name=externalMdOptInAvailable,enum=proto.WebFeatures_Flag" json:"externalMdOptInAvailable,omitempty"` + NoDeleteMessageTimeLimit *WebFeatures_Flag `protobuf:"varint,49,opt,name=noDeleteMessageTimeLimit,enum=proto.WebFeatures_Flag" json:"noDeleteMessageTimeLimit,omitempty"` +} + +func (x *WebFeatures) Reset() { + *x = WebFeatures{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[151] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WebFeatures) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WebFeatures) ProtoMessage() {} + +func (x *WebFeatures) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[151] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WebFeatures.ProtoReflect.Descriptor instead. +func (*WebFeatures) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{151} +} + +func (x *WebFeatures) GetLabelsDisplay() WebFeatures_Flag { + if x != nil && x.LabelsDisplay != nil { + return *x.LabelsDisplay + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetVoipIndividualOutgoing() WebFeatures_Flag { + if x != nil && x.VoipIndividualOutgoing != nil { + return *x.VoipIndividualOutgoing + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetGroupsV3() WebFeatures_Flag { + if x != nil && x.GroupsV3 != nil { + return *x.GroupsV3 + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetGroupsV3Create() WebFeatures_Flag { + if x != nil && x.GroupsV3Create != nil { + return *x.GroupsV3Create + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetChangeNumberV2() WebFeatures_Flag { + if x != nil && x.ChangeNumberV2 != nil { + return *x.ChangeNumberV2 + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetQueryStatusV3Thumbnail() WebFeatures_Flag { + if x != nil && x.QueryStatusV3Thumbnail != nil { + return *x.QueryStatusV3Thumbnail + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetLiveLocations() WebFeatures_Flag { + if x != nil && x.LiveLocations != nil { + return *x.LiveLocations + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetQueryVname() WebFeatures_Flag { + if x != nil && x.QueryVname != nil { + return *x.QueryVname + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetVoipIndividualIncoming() WebFeatures_Flag { + if x != nil && x.VoipIndividualIncoming != nil { + return *x.VoipIndividualIncoming + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetQuickRepliesQuery() WebFeatures_Flag { + if x != nil && x.QuickRepliesQuery != nil { + return *x.QuickRepliesQuery + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetPayments() WebFeatures_Flag { + if x != nil && x.Payments != nil { + return *x.Payments + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetStickerPackQuery() WebFeatures_Flag { + if x != nil && x.StickerPackQuery != nil { + return *x.StickerPackQuery + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetLiveLocationsFinal() WebFeatures_Flag { + if x != nil && x.LiveLocationsFinal != nil { + return *x.LiveLocationsFinal + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetLabelsEdit() WebFeatures_Flag { + if x != nil && x.LabelsEdit != nil { + return *x.LabelsEdit + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetMediaUpload() WebFeatures_Flag { + if x != nil && x.MediaUpload != nil { + return *x.MediaUpload + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetMediaUploadRichQuickReplies() WebFeatures_Flag { + if x != nil && x.MediaUploadRichQuickReplies != nil { + return *x.MediaUploadRichQuickReplies + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetVnameV2() WebFeatures_Flag { + if x != nil && x.VnameV2 != nil { + return *x.VnameV2 + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetVideoPlaybackUrl() WebFeatures_Flag { + if x != nil && x.VideoPlaybackUrl != nil { + return *x.VideoPlaybackUrl + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetStatusRanking() WebFeatures_Flag { + if x != nil && x.StatusRanking != nil { + return *x.StatusRanking + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetVoipIndividualVideo() WebFeatures_Flag { + if x != nil && x.VoipIndividualVideo != nil { + return *x.VoipIndividualVideo + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetThirdPartyStickers() WebFeatures_Flag { + if x != nil && x.ThirdPartyStickers != nil { + return *x.ThirdPartyStickers + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetFrequentlyForwardedSetting() WebFeatures_Flag { + if x != nil && x.FrequentlyForwardedSetting != nil { + return *x.FrequentlyForwardedSetting + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetGroupsV4JoinPermission() WebFeatures_Flag { + if x != nil && x.GroupsV4JoinPermission != nil { + return *x.GroupsV4JoinPermission + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetRecentStickers() WebFeatures_Flag { + if x != nil && x.RecentStickers != nil { + return *x.RecentStickers + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetCatalog() WebFeatures_Flag { + if x != nil && x.Catalog != nil { + return *x.Catalog + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetStarredStickers() WebFeatures_Flag { + if x != nil && x.StarredStickers != nil { + return *x.StarredStickers + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetVoipGroupCall() WebFeatures_Flag { + if x != nil && x.VoipGroupCall != nil { + return *x.VoipGroupCall + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetTemplateMessage() WebFeatures_Flag { + if x != nil && x.TemplateMessage != nil { + return *x.TemplateMessage + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetTemplateMessageInteractivity() WebFeatures_Flag { + if x != nil && x.TemplateMessageInteractivity != nil { + return *x.TemplateMessageInteractivity + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetEphemeralMessages() WebFeatures_Flag { + if x != nil && x.EphemeralMessages != nil { + return *x.EphemeralMessages + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetE2ENotificationSync() WebFeatures_Flag { + if x != nil && x.E2ENotificationSync != nil { + return *x.E2ENotificationSync + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetRecentStickersV2() WebFeatures_Flag { + if x != nil && x.RecentStickersV2 != nil { + return *x.RecentStickersV2 + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetRecentStickersV3() WebFeatures_Flag { + if x != nil && x.RecentStickersV3 != nil { + return *x.RecentStickersV3 + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetUserNotice() WebFeatures_Flag { + if x != nil && x.UserNotice != nil { + return *x.UserNotice + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetSupport() WebFeatures_Flag { + if x != nil && x.Support != nil { + return *x.Support + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetGroupUiiCleanup() WebFeatures_Flag { + if x != nil && x.GroupUiiCleanup != nil { + return *x.GroupUiiCleanup + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetGroupDogfoodingInternalOnly() WebFeatures_Flag { + if x != nil && x.GroupDogfoodingInternalOnly != nil { + return *x.GroupDogfoodingInternalOnly + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetSettingsSync() WebFeatures_Flag { + if x != nil && x.SettingsSync != nil { + return *x.SettingsSync + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetArchiveV2() WebFeatures_Flag { + if x != nil && x.ArchiveV2 != nil { + return *x.ArchiveV2 + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetEphemeralAllowGroupMembers() WebFeatures_Flag { + if x != nil && x.EphemeralAllowGroupMembers != nil { + return *x.EphemeralAllowGroupMembers + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetEphemeral24HDuration() WebFeatures_Flag { + if x != nil && x.Ephemeral24HDuration != nil { + return *x.Ephemeral24HDuration + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetMdForceUpgrade() WebFeatures_Flag { + if x != nil && x.MdForceUpgrade != nil { + return *x.MdForceUpgrade + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetDisappearingMode() WebFeatures_Flag { + if x != nil && x.DisappearingMode != nil { + return *x.DisappearingMode + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetExternalMdOptInAvailable() WebFeatures_Flag { + if x != nil && x.ExternalMdOptInAvailable != nil { + return *x.ExternalMdOptInAvailable + } + return WebFeatures_NOT_STARTED +} + +func (x *WebFeatures) GetNoDeleteMessageTimeLimit() WebFeatures_Flag { + if x != nil && x.NoDeleteMessageTimeLimit != nil { + return *x.NoDeleteMessageTimeLimit + } + return WebFeatures_NOT_STARTED +} + +type UserReceipt struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UserJid *string `protobuf:"bytes,1,req,name=userJid" json:"userJid,omitempty"` + ReceiptTimestamp *int64 `protobuf:"varint,2,opt,name=receiptTimestamp" json:"receiptTimestamp,omitempty"` + ReadTimestamp *int64 `protobuf:"varint,3,opt,name=readTimestamp" json:"readTimestamp,omitempty"` + PlayedTimestamp *int64 `protobuf:"varint,4,opt,name=playedTimestamp" json:"playedTimestamp,omitempty"` + PendingDeviceJid []string `protobuf:"bytes,5,rep,name=pendingDeviceJid" json:"pendingDeviceJid,omitempty"` + DeliveredDeviceJid []string `protobuf:"bytes,6,rep,name=deliveredDeviceJid" json:"deliveredDeviceJid,omitempty"` +} + +func (x *UserReceipt) Reset() { + *x = UserReceipt{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[152] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserReceipt) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserReceipt) ProtoMessage() {} + +func (x *UserReceipt) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[152] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UserReceipt.ProtoReflect.Descriptor instead. +func (*UserReceipt) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{152} +} + +func (x *UserReceipt) GetUserJid() string { + if x != nil && x.UserJid != nil { + return *x.UserJid + } + return "" +} + +func (x *UserReceipt) GetReceiptTimestamp() int64 { + if x != nil && x.ReceiptTimestamp != nil { + return *x.ReceiptTimestamp + } + return 0 +} + +func (x *UserReceipt) GetReadTimestamp() int64 { + if x != nil && x.ReadTimestamp != nil { + return *x.ReadTimestamp + } + return 0 +} + +func (x *UserReceipt) GetPlayedTimestamp() int64 { + if x != nil && x.PlayedTimestamp != nil { + return *x.PlayedTimestamp + } + return 0 +} + +func (x *UserReceipt) GetPendingDeviceJid() []string { + if x != nil { + return x.PendingDeviceJid + } + return nil +} + +func (x *UserReceipt) GetDeliveredDeviceJid() []string { + if x != nil { + return x.DeliveredDeviceJid + } + return nil +} + +type StatusPSA struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CampaignId *uint64 `protobuf:"varint,44,req,name=campaignId" json:"campaignId,omitempty"` + CampaignExpirationTimestamp *uint64 `protobuf:"varint,45,opt,name=campaignExpirationTimestamp" json:"campaignExpirationTimestamp,omitempty"` +} + +func (x *StatusPSA) Reset() { + *x = StatusPSA{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[153] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StatusPSA) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StatusPSA) ProtoMessage() {} + +func (x *StatusPSA) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[153] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StatusPSA.ProtoReflect.Descriptor instead. +func (*StatusPSA) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{153} +} + +func (x *StatusPSA) GetCampaignId() uint64 { + if x != nil && x.CampaignId != nil { + return *x.CampaignId + } + return 0 +} + +func (x *StatusPSA) GetCampaignExpirationTimestamp() uint64 { + if x != nil && x.CampaignExpirationTimestamp != nil { + return *x.CampaignExpirationTimestamp + } + return 0 +} + +type Reaction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key *MessageKey `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` + Text *string `protobuf:"bytes,2,opt,name=text" json:"text,omitempty"` + GroupingKey *string `protobuf:"bytes,3,opt,name=groupingKey" json:"groupingKey,omitempty"` + SenderTimestampMs *int64 `protobuf:"varint,4,opt,name=senderTimestampMs" json:"senderTimestampMs,omitempty"` + Unread *bool `protobuf:"varint,5,opt,name=unread" json:"unread,omitempty"` +} + +func (x *Reaction) Reset() { + *x = Reaction{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[154] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Reaction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Reaction) ProtoMessage() {} + +func (x *Reaction) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[154] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Reaction.ProtoReflect.Descriptor instead. +func (*Reaction) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{154} +} + +func (x *Reaction) GetKey() *MessageKey { + if x != nil { + return x.Key + } + return nil +} + +func (x *Reaction) GetText() string { + if x != nil && x.Text != nil { + return *x.Text + } + return "" +} + +func (x *Reaction) GetGroupingKey() string { + if x != nil && x.GroupingKey != nil { + return *x.GroupingKey + } + return "" +} + +func (x *Reaction) GetSenderTimestampMs() int64 { + if x != nil && x.SenderTimestampMs != nil { + return *x.SenderTimestampMs + } + return 0 +} + +func (x *Reaction) GetUnread() bool { + if x != nil && x.Unread != nil { + return *x.Unread + } + return false +} + +type PollUpdate struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PollUpdateMessageKey *MessageKey `protobuf:"bytes,1,opt,name=pollUpdateMessageKey" json:"pollUpdateMessageKey,omitempty"` + Vote *PollVoteMessage `protobuf:"bytes,2,opt,name=vote" json:"vote,omitempty"` + SenderTimestampMs *int64 `protobuf:"varint,3,opt,name=senderTimestampMs" json:"senderTimestampMs,omitempty"` + ServerTimestampMs *int64 `protobuf:"varint,4,opt,name=serverTimestampMs" json:"serverTimestampMs,omitempty"` +} + +func (x *PollUpdate) Reset() { + *x = PollUpdate{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[155] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PollUpdate) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PollUpdate) ProtoMessage() {} + +func (x *PollUpdate) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[155] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PollUpdate.ProtoReflect.Descriptor instead. +func (*PollUpdate) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{155} +} + +func (x *PollUpdate) GetPollUpdateMessageKey() *MessageKey { + if x != nil { + return x.PollUpdateMessageKey + } + return nil +} + +func (x *PollUpdate) GetVote() *PollVoteMessage { + if x != nil { + return x.Vote + } + return nil +} + +func (x *PollUpdate) GetSenderTimestampMs() int64 { + if x != nil && x.SenderTimestampMs != nil { + return *x.SenderTimestampMs + } + return 0 +} + +func (x *PollUpdate) GetServerTimestampMs() int64 { + if x != nil && x.ServerTimestampMs != nil { + return *x.ServerTimestampMs + } + return 0 +} + +type PollAdditionalMetadata struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PollInvalidated *bool `protobuf:"varint,1,opt,name=pollInvalidated" json:"pollInvalidated,omitempty"` +} + +func (x *PollAdditionalMetadata) Reset() { + *x = PollAdditionalMetadata{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[156] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PollAdditionalMetadata) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PollAdditionalMetadata) ProtoMessage() {} + +func (x *PollAdditionalMetadata) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[156] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PollAdditionalMetadata.ProtoReflect.Descriptor instead. +func (*PollAdditionalMetadata) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{156} +} + +func (x *PollAdditionalMetadata) GetPollInvalidated() bool { + if x != nil && x.PollInvalidated != nil { + return *x.PollInvalidated + } + return false +} + +type PhotoChange struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + OldPhoto []byte `protobuf:"bytes,1,opt,name=oldPhoto" json:"oldPhoto,omitempty"` + NewPhoto []byte `protobuf:"bytes,2,opt,name=newPhoto" json:"newPhoto,omitempty"` + NewPhotoId *uint32 `protobuf:"varint,3,opt,name=newPhotoId" json:"newPhotoId,omitempty"` +} + +func (x *PhotoChange) Reset() { + *x = PhotoChange{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[157] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PhotoChange) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PhotoChange) ProtoMessage() {} + +func (x *PhotoChange) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[157] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PhotoChange.ProtoReflect.Descriptor instead. +func (*PhotoChange) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{157} +} + +func (x *PhotoChange) GetOldPhoto() []byte { + if x != nil { + return x.OldPhoto + } + return nil +} + +func (x *PhotoChange) GetNewPhoto() []byte { + if x != nil { + return x.NewPhoto + } + return nil +} + +func (x *PhotoChange) GetNewPhotoId() uint32 { + if x != nil && x.NewPhotoId != nil { + return *x.NewPhotoId + } + return 0 +} + +type PaymentInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CurrencyDeprecated *PaymentInfo_Currency `protobuf:"varint,1,opt,name=currencyDeprecated,enum=proto.PaymentInfo_Currency" json:"currencyDeprecated,omitempty"` + Amount1000 *uint64 `protobuf:"varint,2,opt,name=amount1000" json:"amount1000,omitempty"` + ReceiverJid *string `protobuf:"bytes,3,opt,name=receiverJid" json:"receiverJid,omitempty"` + Status *PaymentInfo_Status `protobuf:"varint,4,opt,name=status,enum=proto.PaymentInfo_Status" json:"status,omitempty"` + TransactionTimestamp *uint64 `protobuf:"varint,5,opt,name=transactionTimestamp" json:"transactionTimestamp,omitempty"` + RequestMessageKey *MessageKey `protobuf:"bytes,6,opt,name=requestMessageKey" json:"requestMessageKey,omitempty"` + ExpiryTimestamp *uint64 `protobuf:"varint,7,opt,name=expiryTimestamp" json:"expiryTimestamp,omitempty"` + Futureproofed *bool `protobuf:"varint,8,opt,name=futureproofed" json:"futureproofed,omitempty"` + Currency *string `protobuf:"bytes,9,opt,name=currency" json:"currency,omitempty"` + TxnStatus *PaymentInfo_TxnStatus `protobuf:"varint,10,opt,name=txnStatus,enum=proto.PaymentInfo_TxnStatus" json:"txnStatus,omitempty"` + UseNoviFiatFormat *bool `protobuf:"varint,11,opt,name=useNoviFiatFormat" json:"useNoviFiatFormat,omitempty"` + PrimaryAmount *Money `protobuf:"bytes,12,opt,name=primaryAmount" json:"primaryAmount,omitempty"` + ExchangeAmount *Money `protobuf:"bytes,13,opt,name=exchangeAmount" json:"exchangeAmount,omitempty"` +} + +func (x *PaymentInfo) Reset() { + *x = PaymentInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[158] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PaymentInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PaymentInfo) ProtoMessage() {} + +func (x *PaymentInfo) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[158] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PaymentInfo.ProtoReflect.Descriptor instead. +func (*PaymentInfo) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{158} +} + +func (x *PaymentInfo) GetCurrencyDeprecated() PaymentInfo_Currency { + if x != nil && x.CurrencyDeprecated != nil { + return *x.CurrencyDeprecated + } + return PaymentInfo_UNKNOWN_CURRENCY +} + +func (x *PaymentInfo) GetAmount1000() uint64 { + if x != nil && x.Amount1000 != nil { + return *x.Amount1000 + } + return 0 +} + +func (x *PaymentInfo) GetReceiverJid() string { + if x != nil && x.ReceiverJid != nil { + return *x.ReceiverJid + } + return "" +} + +func (x *PaymentInfo) GetStatus() PaymentInfo_Status { + if x != nil && x.Status != nil { + return *x.Status + } + return PaymentInfo_UNKNOWN_STATUS +} + +func (x *PaymentInfo) GetTransactionTimestamp() uint64 { + if x != nil && x.TransactionTimestamp != nil { + return *x.TransactionTimestamp + } + return 0 +} + +func (x *PaymentInfo) GetRequestMessageKey() *MessageKey { + if x != nil { + return x.RequestMessageKey + } + return nil +} + +func (x *PaymentInfo) GetExpiryTimestamp() uint64 { + if x != nil && x.ExpiryTimestamp != nil { + return *x.ExpiryTimestamp + } + return 0 +} + +func (x *PaymentInfo) GetFutureproofed() bool { + if x != nil && x.Futureproofed != nil { + return *x.Futureproofed + } + return false +} + +func (x *PaymentInfo) GetCurrency() string { + if x != nil && x.Currency != nil { + return *x.Currency + } + return "" +} + +func (x *PaymentInfo) GetTxnStatus() PaymentInfo_TxnStatus { + if x != nil && x.TxnStatus != nil { + return *x.TxnStatus + } + return PaymentInfo_UNKNOWN +} + +func (x *PaymentInfo) GetUseNoviFiatFormat() bool { + if x != nil && x.UseNoviFiatFormat != nil { + return *x.UseNoviFiatFormat + } + return false +} + +func (x *PaymentInfo) GetPrimaryAmount() *Money { + if x != nil { + return x.PrimaryAmount + } + return nil +} + +func (x *PaymentInfo) GetExchangeAmount() *Money { + if x != nil { + return x.ExchangeAmount + } + return nil +} + +type NotificationMessageInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + 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"` +} + +func (x *NotificationMessageInfo) Reset() { + *x = NotificationMessageInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[159] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NotificationMessageInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NotificationMessageInfo) ProtoMessage() {} + +func (x *NotificationMessageInfo) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[159] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NotificationMessageInfo.ProtoReflect.Descriptor instead. +func (*NotificationMessageInfo) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{159} +} + +func (x *NotificationMessageInfo) GetKey() *MessageKey { + if x != nil { + return x.Key + } + return nil +} + +func (x *NotificationMessageInfo) GetMessage() *Message { + if x != nil { + return x.Message + } + return nil +} + +func (x *NotificationMessageInfo) GetMessageTimestamp() uint64 { + if x != nil && x.MessageTimestamp != nil { + return *x.MessageTimestamp + } + return 0 +} + +func (x *NotificationMessageInfo) GetParticipant() string { + if x != nil && x.Participant != nil { + return *x.Participant + } + return "" +} + +type MediaData struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + LocalPath *string `protobuf:"bytes,1,opt,name=localPath" json:"localPath,omitempty"` +} + +func (x *MediaData) Reset() { + *x = MediaData{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[160] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MediaData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MediaData) ProtoMessage() {} + +func (x *MediaData) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[160] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MediaData.ProtoReflect.Descriptor instead. +func (*MediaData) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{160} +} + +func (x *MediaData) GetLocalPath() string { + if x != nil && x.LocalPath != nil { + return *x.LocalPath + } + return "" +} + +type KeepInChat struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + KeepType *KeepType `protobuf:"varint,1,opt,name=keepType,enum=proto.KeepType" json:"keepType,omitempty"` + ServerTimestamp *int64 `protobuf:"varint,2,opt,name=serverTimestamp" json:"serverTimestamp,omitempty"` + Key *MessageKey `protobuf:"bytes,3,opt,name=key" json:"key,omitempty"` + DeviceJid *string `protobuf:"bytes,4,opt,name=deviceJid" json:"deviceJid,omitempty"` + ClientTimestampMs *int64 `protobuf:"varint,5,opt,name=clientTimestampMs" json:"clientTimestampMs,omitempty"` + ServerTimestampMs *int64 `protobuf:"varint,6,opt,name=serverTimestampMs" json:"serverTimestampMs,omitempty"` +} + +func (x *KeepInChat) Reset() { + *x = KeepInChat{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[161] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KeepInChat) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeepInChat) ProtoMessage() {} + +func (x *KeepInChat) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[161] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KeepInChat.ProtoReflect.Descriptor instead. +func (*KeepInChat) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{161} +} + +func (x *KeepInChat) GetKeepType() KeepType { + if x != nil && x.KeepType != nil { + return *x.KeepType + } + return KeepType_UNKNOWN +} + +func (x *KeepInChat) GetServerTimestamp() int64 { + if x != nil && x.ServerTimestamp != nil { + return *x.ServerTimestamp + } + return 0 +} + +func (x *KeepInChat) GetKey() *MessageKey { + if x != nil { + return x.Key + } + return nil +} + +func (x *KeepInChat) GetDeviceJid() string { + if x != nil && x.DeviceJid != nil { + return *x.DeviceJid + } + return "" +} + +func (x *KeepInChat) GetClientTimestampMs() int64 { + if x != nil && x.ClientTimestampMs != nil { + return *x.ClientTimestampMs + } + return 0 +} + +func (x *KeepInChat) GetServerTimestampMs() int64 { + if x != nil && x.ServerTimestampMs != nil { + return *x.ServerTimestampMs + } + return 0 +} + +type NoiseCertificate struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Details []byte `protobuf:"bytes,1,opt,name=details" json:"details,omitempty"` + Signature []byte `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"` +} + +func (x *NoiseCertificate) Reset() { + *x = NoiseCertificate{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[162] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NoiseCertificate) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NoiseCertificate) ProtoMessage() {} + +func (x *NoiseCertificate) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[162] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NoiseCertificate.ProtoReflect.Descriptor instead. +func (*NoiseCertificate) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{162} +} + +func (x *NoiseCertificate) GetDetails() []byte { + if x != nil { + return x.Details + } + return nil +} + +func (x *NoiseCertificate) GetSignature() []byte { + if x != nil { + return x.Signature + } + return nil +} + +type CertChain struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Leaf *CertChain_NoiseCertificate `protobuf:"bytes,1,opt,name=leaf" json:"leaf,omitempty"` + Intermediate *CertChain_NoiseCertificate `protobuf:"bytes,2,opt,name=intermediate" json:"intermediate,omitempty"` +} + +func (x *CertChain) Reset() { + *x = CertChain{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[163] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CertChain) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CertChain) ProtoMessage() {} + +func (x *CertChain) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[163] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CertChain.ProtoReflect.Descriptor instead. +func (*CertChain) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{163} +} + +func (x *CertChain) GetLeaf() *CertChain_NoiseCertificate { + if x != nil { + return x.Leaf + } + return nil +} + +func (x *CertChain) GetIntermediate() *CertChain_NoiseCertificate { + if x != nil { + return x.Intermediate + } + return nil +} + +type DeviceProps_HistorySyncConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FullSyncDaysLimit *uint32 `protobuf:"varint,1,opt,name=fullSyncDaysLimit" json:"fullSyncDaysLimit,omitempty"` + FullSyncSizeMbLimit *uint32 `protobuf:"varint,2,opt,name=fullSyncSizeMbLimit" json:"fullSyncSizeMbLimit,omitempty"` + StorageQuotaMb *uint32 `protobuf:"varint,3,opt,name=storageQuotaMb" json:"storageQuotaMb,omitempty"` +} + +func (x *DeviceProps_HistorySyncConfig) Reset() { + *x = DeviceProps_HistorySyncConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[164] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeviceProps_HistorySyncConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeviceProps_HistorySyncConfig) ProtoMessage() {} + +func (x *DeviceProps_HistorySyncConfig) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[164] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeviceProps_HistorySyncConfig.ProtoReflect.Descriptor instead. +func (*DeviceProps_HistorySyncConfig) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{5, 0} +} + +func (x *DeviceProps_HistorySyncConfig) GetFullSyncDaysLimit() uint32 { + if x != nil && x.FullSyncDaysLimit != nil { + return *x.FullSyncDaysLimit + } + return 0 +} + +func (x *DeviceProps_HistorySyncConfig) GetFullSyncSizeMbLimit() uint32 { + if x != nil && x.FullSyncSizeMbLimit != nil { + return *x.FullSyncSizeMbLimit + } + return 0 +} + +func (x *DeviceProps_HistorySyncConfig) GetStorageQuotaMb() uint32 { + if x != nil && x.StorageQuotaMb != nil { + return *x.StorageQuotaMb + } + return 0 +} + +type DeviceProps_AppVersion struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Primary *uint32 `protobuf:"varint,1,opt,name=primary" json:"primary,omitempty"` + Secondary *uint32 `protobuf:"varint,2,opt,name=secondary" json:"secondary,omitempty"` + Tertiary *uint32 `protobuf:"varint,3,opt,name=tertiary" json:"tertiary,omitempty"` + Quaternary *uint32 `protobuf:"varint,4,opt,name=quaternary" json:"quaternary,omitempty"` + Quinary *uint32 `protobuf:"varint,5,opt,name=quinary" json:"quinary,omitempty"` +} + +func (x *DeviceProps_AppVersion) Reset() { + *x = DeviceProps_AppVersion{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[165] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeviceProps_AppVersion) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeviceProps_AppVersion) ProtoMessage() {} + +func (x *DeviceProps_AppVersion) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[165] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeviceProps_AppVersion.ProtoReflect.Descriptor instead. +func (*DeviceProps_AppVersion) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{5, 1} +} + +func (x *DeviceProps_AppVersion) GetPrimary() uint32 { + if x != nil && x.Primary != nil { + return *x.Primary + } + return 0 +} + +func (x *DeviceProps_AppVersion) GetSecondary() uint32 { + if x != nil && x.Secondary != nil { + return *x.Secondary + } + return 0 +} + +func (x *DeviceProps_AppVersion) GetTertiary() uint32 { + if x != nil && x.Tertiary != nil { + return *x.Tertiary + } + return 0 +} + +func (x *DeviceProps_AppVersion) GetQuaternary() uint32 { + if x != nil && x.Quaternary != nil { + return *x.Quaternary + } + return 0 +} + +func (x *DeviceProps_AppVersion) GetQuinary() uint32 { + if x != nil && x.Quinary != nil { + return *x.Quinary + } + return 0 +} + +type PeerDataOperationRequestResponseMessage_PeerDataOperationResult struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MediaUploadResult *MediaRetryNotification_ResultType `protobuf:"varint,1,opt,name=mediaUploadResult,enum=proto.MediaRetryNotification_ResultType" json:"mediaUploadResult,omitempty"` + StickerMessage *StickerMessage `protobuf:"bytes,2,opt,name=stickerMessage" json:"stickerMessage,omitempty"` + LinkPreviewResponse *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse `protobuf:"bytes,3,opt,name=linkPreviewResponse" json:"linkPreviewResponse,omitempty"` +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult) Reset() { + *x = PeerDataOperationRequestResponseMessage_PeerDataOperationResult{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[166] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult) ProtoMessage() {} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[166] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PeerDataOperationRequestResponseMessage_PeerDataOperationResult.ProtoReflect.Descriptor instead. +func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{6, 0} +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult) GetMediaUploadResult() MediaRetryNotification_ResultType { + if x != nil && x.MediaUploadResult != nil { + return *x.MediaUploadResult + } + return MediaRetryNotification_GENERAL_ERROR +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult) GetStickerMessage() *StickerMessage { + if x != nil { + return x.StickerMessage + } + return nil +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult) GetLinkPreviewResponse() *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse { + if x != nil { + return x.LinkPreviewResponse + } + return nil +} + +type PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Url *string `protobuf:"bytes,1,opt,name=url" json:"url,omitempty"` + Title *string `protobuf:"bytes,2,opt,name=title" json:"title,omitempty"` + Description *string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"` + ThumbData []byte `protobuf:"bytes,4,opt,name=thumbData" json:"thumbData,omitempty"` + CanonicalUrl *string `protobuf:"bytes,5,opt,name=canonicalUrl" json:"canonicalUrl,omitempty"` + MatchText *string `protobuf:"bytes,6,opt,name=matchText" json:"matchText,omitempty"` + PreviewType *string `protobuf:"bytes,7,opt,name=previewType" json:"previewType,omitempty"` +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) Reset() { + *x = PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[167] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) ProtoMessage() { +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[167] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse.ProtoReflect.Descriptor instead. +func (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{6, 0, 0} +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) GetUrl() string { + if x != nil && x.Url != nil { + return *x.Url + } + return "" +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) GetTitle() string { + if x != nil && x.Title != nil { + return *x.Title + } + return "" +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) GetDescription() string { + if x != nil && x.Description != nil { + return *x.Description + } + return "" +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) GetThumbData() []byte { + if x != nil { + return x.ThumbData + } + return nil +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) GetCanonicalUrl() string { + if x != nil && x.CanonicalUrl != nil { + return *x.CanonicalUrl + } + return "" +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) GetMatchText() string { + if x != nil && x.MatchText != nil { + return *x.MatchText + } + return "" +} + +func (x *PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse) GetPreviewType() string { + if x != nil && x.PreviewType != nil { + return *x.PreviewType + } + return "" +} + +type PeerDataOperationRequestMessage_RequestUrlPreview struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Url *string `protobuf:"bytes,1,opt,name=url" json:"url,omitempty"` +} + +func (x *PeerDataOperationRequestMessage_RequestUrlPreview) Reset() { + *x = PeerDataOperationRequestMessage_RequestUrlPreview{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[168] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PeerDataOperationRequestMessage_RequestUrlPreview) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PeerDataOperationRequestMessage_RequestUrlPreview) ProtoMessage() {} + +func (x *PeerDataOperationRequestMessage_RequestUrlPreview) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[168] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PeerDataOperationRequestMessage_RequestUrlPreview.ProtoReflect.Descriptor instead. +func (*PeerDataOperationRequestMessage_RequestUrlPreview) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{7, 0} +} + +func (x *PeerDataOperationRequestMessage_RequestUrlPreview) GetUrl() string { + if x != nil && x.Url != nil { + return *x.Url + } + return "" +} + +type PeerDataOperationRequestMessage_RequestStickerReupload struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FileSha256 *string `protobuf:"bytes,1,opt,name=fileSha256" json:"fileSha256,omitempty"` +} + +func (x *PeerDataOperationRequestMessage_RequestStickerReupload) Reset() { + *x = PeerDataOperationRequestMessage_RequestStickerReupload{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[169] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PeerDataOperationRequestMessage_RequestStickerReupload) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PeerDataOperationRequestMessage_RequestStickerReupload) ProtoMessage() {} + +func (x *PeerDataOperationRequestMessage_RequestStickerReupload) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[169] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PeerDataOperationRequestMessage_RequestStickerReupload.ProtoReflect.Descriptor instead. +func (*PeerDataOperationRequestMessage_RequestStickerReupload) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{7, 1} +} + +func (x *PeerDataOperationRequestMessage_RequestStickerReupload) GetFileSha256() string { + if x != nil && x.FileSha256 != nil { + return *x.FileSha256 + } + return "" +} + +type ListResponseMessage_SingleSelectReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SelectedRowId *string `protobuf:"bytes,1,opt,name=selectedRowId" json:"selectedRowId,omitempty"` +} + +func (x *ListResponseMessage_SingleSelectReply) Reset() { + *x = ListResponseMessage_SingleSelectReply{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[170] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListResponseMessage_SingleSelectReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListResponseMessage_SingleSelectReply) ProtoMessage() {} + +func (x *ListResponseMessage_SingleSelectReply) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[170] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListResponseMessage_SingleSelectReply.ProtoReflect.Descriptor instead. +func (*ListResponseMessage_SingleSelectReply) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{12, 0} +} + +func (x *ListResponseMessage_SingleSelectReply) GetSelectedRowId() string { + if x != nil && x.SelectedRowId != nil { + return *x.SelectedRowId + } + return "" +} + +type ListMessage_Section struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Title *string `protobuf:"bytes,1,opt,name=title" json:"title,omitempty"` + Rows []*ListMessage_Row `protobuf:"bytes,2,rep,name=rows" json:"rows,omitempty"` +} + +func (x *ListMessage_Section) Reset() { + *x = ListMessage_Section{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[171] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListMessage_Section) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListMessage_Section) ProtoMessage() {} + +func (x *ListMessage_Section) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[171] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListMessage_Section.ProtoReflect.Descriptor instead. +func (*ListMessage_Section) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{13, 0} +} + +func (x *ListMessage_Section) GetTitle() string { + if x != nil && x.Title != nil { + return *x.Title + } + return "" +} + +func (x *ListMessage_Section) GetRows() []*ListMessage_Row { + if x != nil { + return x.Rows + } + return nil +} + +type ListMessage_Row struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Title *string `protobuf:"bytes,1,opt,name=title" json:"title,omitempty"` + Description *string `protobuf:"bytes,2,opt,name=description" json:"description,omitempty"` + RowId *string `protobuf:"bytes,3,opt,name=rowId" json:"rowId,omitempty"` +} + +func (x *ListMessage_Row) Reset() { + *x = ListMessage_Row{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[172] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListMessage_Row) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListMessage_Row) ProtoMessage() {} + +func (x *ListMessage_Row) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[172] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListMessage_Row.ProtoReflect.Descriptor instead. +func (*ListMessage_Row) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{13, 1} +} + +func (x *ListMessage_Row) GetTitle() string { + if x != nil && x.Title != nil { + return *x.Title + } + return "" +} + +func (x *ListMessage_Row) GetDescription() string { + if x != nil && x.Description != nil { + return *x.Description + } + return "" +} + +func (x *ListMessage_Row) GetRowId() string { + if x != nil && x.RowId != nil { + return *x.RowId + } + return "" +} + +type ListMessage_Product struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ProductId *string `protobuf:"bytes,1,opt,name=productId" json:"productId,omitempty"` +} + +func (x *ListMessage_Product) Reset() { + *x = ListMessage_Product{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[173] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListMessage_Product) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListMessage_Product) ProtoMessage() {} + +func (x *ListMessage_Product) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[173] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListMessage_Product.ProtoReflect.Descriptor instead. +func (*ListMessage_Product) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{13, 2} +} + +func (x *ListMessage_Product) GetProductId() string { + if x != nil && x.ProductId != nil { + return *x.ProductId + } + return "" +} + +type ListMessage_ProductSection struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Title *string `protobuf:"bytes,1,opt,name=title" json:"title,omitempty"` + Products []*ListMessage_Product `protobuf:"bytes,2,rep,name=products" json:"products,omitempty"` +} + +func (x *ListMessage_ProductSection) Reset() { + *x = ListMessage_ProductSection{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[174] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListMessage_ProductSection) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListMessage_ProductSection) ProtoMessage() {} + +func (x *ListMessage_ProductSection) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[174] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListMessage_ProductSection.ProtoReflect.Descriptor instead. +func (*ListMessage_ProductSection) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{13, 3} +} + +func (x *ListMessage_ProductSection) GetTitle() string { + if x != nil && x.Title != nil { + return *x.Title + } + return "" +} + +func (x *ListMessage_ProductSection) GetProducts() []*ListMessage_Product { + if x != nil { + return x.Products + } + return nil +} + +type ListMessage_ProductListInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ProductSections []*ListMessage_ProductSection `protobuf:"bytes,1,rep,name=productSections" json:"productSections,omitempty"` + HeaderImage *ListMessage_ProductListHeaderImage `protobuf:"bytes,2,opt,name=headerImage" json:"headerImage,omitempty"` + BusinessOwnerJid *string `protobuf:"bytes,3,opt,name=businessOwnerJid" json:"businessOwnerJid,omitempty"` +} + +func (x *ListMessage_ProductListInfo) Reset() { + *x = ListMessage_ProductListInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[175] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListMessage_ProductListInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListMessage_ProductListInfo) ProtoMessage() {} + +func (x *ListMessage_ProductListInfo) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[175] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListMessage_ProductListInfo.ProtoReflect.Descriptor instead. +func (*ListMessage_ProductListInfo) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{13, 4} +} + +func (x *ListMessage_ProductListInfo) GetProductSections() []*ListMessage_ProductSection { + if x != nil { + return x.ProductSections + } + return nil +} + +func (x *ListMessage_ProductListInfo) GetHeaderImage() *ListMessage_ProductListHeaderImage { + if x != nil { + return x.HeaderImage + } + return nil +} + +func (x *ListMessage_ProductListInfo) GetBusinessOwnerJid() string { + if x != nil && x.BusinessOwnerJid != nil { + return *x.BusinessOwnerJid + } + return "" +} + +type ListMessage_ProductListHeaderImage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ProductId *string `protobuf:"bytes,1,opt,name=productId" json:"productId,omitempty"` + JpegThumbnail []byte `protobuf:"bytes,2,opt,name=jpegThumbnail" json:"jpegThumbnail,omitempty"` +} + +func (x *ListMessage_ProductListHeaderImage) Reset() { + *x = ListMessage_ProductListHeaderImage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[176] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListMessage_ProductListHeaderImage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListMessage_ProductListHeaderImage) ProtoMessage() {} + +func (x *ListMessage_ProductListHeaderImage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[176] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListMessage_ProductListHeaderImage.ProtoReflect.Descriptor instead. +func (*ListMessage_ProductListHeaderImage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{13, 5} +} + +func (x *ListMessage_ProductListHeaderImage) GetProductId() string { + if x != nil && x.ProductId != nil { + return *x.ProductId + } + return "" +} + +func (x *ListMessage_ProductListHeaderImage) GetJpegThumbnail() []byte { + if x != nil { + return x.JpegThumbnail + } + return nil +} + +type InteractiveResponseMessage_NativeFlowResponseMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + ParamsJson *string `protobuf:"bytes,2,opt,name=paramsJson" json:"paramsJson,omitempty"` + Version *int32 `protobuf:"varint,3,opt,name=version" json:"version,omitempty"` +} + +func (x *InteractiveResponseMessage_NativeFlowResponseMessage) Reset() { + *x = InteractiveResponseMessage_NativeFlowResponseMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[177] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InteractiveResponseMessage_NativeFlowResponseMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InteractiveResponseMessage_NativeFlowResponseMessage) ProtoMessage() {} + +func (x *InteractiveResponseMessage_NativeFlowResponseMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[177] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InteractiveResponseMessage_NativeFlowResponseMessage.ProtoReflect.Descriptor instead. +func (*InteractiveResponseMessage_NativeFlowResponseMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{16, 0} +} + +func (x *InteractiveResponseMessage_NativeFlowResponseMessage) GetName() string { + if x != nil && x.Name != nil { + return *x.Name + } + return "" +} + +func (x *InteractiveResponseMessage_NativeFlowResponseMessage) GetParamsJson() string { + if x != nil && x.ParamsJson != nil { + return *x.ParamsJson + } + return "" +} + +func (x *InteractiveResponseMessage_NativeFlowResponseMessage) GetVersion() int32 { + if x != nil && x.Version != nil { + return *x.Version + } + return 0 +} + +type InteractiveResponseMessage_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Text *string `protobuf:"bytes,1,opt,name=text" json:"text,omitempty"` +} + +func (x *InteractiveResponseMessage_Body) Reset() { + *x = InteractiveResponseMessage_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[178] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InteractiveResponseMessage_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InteractiveResponseMessage_Body) ProtoMessage() {} + +func (x *InteractiveResponseMessage_Body) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[178] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InteractiveResponseMessage_Body.ProtoReflect.Descriptor instead. +func (*InteractiveResponseMessage_Body) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{16, 1} +} + +func (x *InteractiveResponseMessage_Body) GetText() string { + if x != nil && x.Text != nil { + return *x.Text + } + return "" +} + +type InteractiveMessage_ShopMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id *string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + Surface *InteractiveMessage_ShopMessage_Surface `protobuf:"varint,2,opt,name=surface,enum=proto.InteractiveMessage_ShopMessage_Surface" json:"surface,omitempty"` + MessageVersion *int32 `protobuf:"varint,3,opt,name=messageVersion" json:"messageVersion,omitempty"` +} + +func (x *InteractiveMessage_ShopMessage) Reset() { + *x = InteractiveMessage_ShopMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[179] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InteractiveMessage_ShopMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InteractiveMessage_ShopMessage) ProtoMessage() {} + +func (x *InteractiveMessage_ShopMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[179] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InteractiveMessage_ShopMessage.ProtoReflect.Descriptor instead. +func (*InteractiveMessage_ShopMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{17, 0} +} + +func (x *InteractiveMessage_ShopMessage) GetId() string { + if x != nil && x.Id != nil { + return *x.Id + } + return "" +} + +func (x *InteractiveMessage_ShopMessage) GetSurface() InteractiveMessage_ShopMessage_Surface { + if x != nil && x.Surface != nil { + return *x.Surface + } + return InteractiveMessage_ShopMessage_UNKNOWN_SURFACE +} + +func (x *InteractiveMessage_ShopMessage) GetMessageVersion() int32 { + if x != nil && x.MessageVersion != nil { + return *x.MessageVersion + } + return 0 +} + +type InteractiveMessage_NativeFlowMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Buttons []*InteractiveMessage_NativeFlowMessage_NativeFlowButton `protobuf:"bytes,1,rep,name=buttons" json:"buttons,omitempty"` + MessageParamsJson *string `protobuf:"bytes,2,opt,name=messageParamsJson" json:"messageParamsJson,omitempty"` + MessageVersion *int32 `protobuf:"varint,3,opt,name=messageVersion" json:"messageVersion,omitempty"` +} + +func (x *InteractiveMessage_NativeFlowMessage) Reset() { + *x = InteractiveMessage_NativeFlowMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[180] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InteractiveMessage_NativeFlowMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InteractiveMessage_NativeFlowMessage) ProtoMessage() {} + +func (x *InteractiveMessage_NativeFlowMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[180] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InteractiveMessage_NativeFlowMessage.ProtoReflect.Descriptor instead. +func (*InteractiveMessage_NativeFlowMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{17, 1} +} + +func (x *InteractiveMessage_NativeFlowMessage) GetButtons() []*InteractiveMessage_NativeFlowMessage_NativeFlowButton { + if x != nil { + return x.Buttons + } + return nil +} + +func (x *InteractiveMessage_NativeFlowMessage) GetMessageParamsJson() string { + if x != nil && x.MessageParamsJson != nil { + return *x.MessageParamsJson + } + return "" +} + +func (x *InteractiveMessage_NativeFlowMessage) GetMessageVersion() int32 { + if x != nil && x.MessageVersion != nil { + return *x.MessageVersion + } + return 0 +} + +type InteractiveMessage_Header struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Title *string `protobuf:"bytes,1,opt,name=title" json:"title,omitempty"` + Subtitle *string `protobuf:"bytes,2,opt,name=subtitle" json:"subtitle,omitempty"` + HasMediaAttachment *bool `protobuf:"varint,5,opt,name=hasMediaAttachment" json:"hasMediaAttachment,omitempty"` + // Types that are assignable to Media: + // + // *InteractiveMessage_Header_DocumentMessage + // *InteractiveMessage_Header_ImageMessage + // *InteractiveMessage_Header_JpegThumbnail + // *InteractiveMessage_Header_VideoMessage + Media isInteractiveMessage_Header_Media `protobuf_oneof:"media"` +} + +func (x *InteractiveMessage_Header) Reset() { + *x = InteractiveMessage_Header{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[181] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InteractiveMessage_Header) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InteractiveMessage_Header) ProtoMessage() {} + +func (x *InteractiveMessage_Header) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[181] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InteractiveMessage_Header.ProtoReflect.Descriptor instead. +func (*InteractiveMessage_Header) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{17, 2} +} + +func (x *InteractiveMessage_Header) GetTitle() string { + if x != nil && x.Title != nil { + return *x.Title + } + return "" +} + +func (x *InteractiveMessage_Header) GetSubtitle() string { + if x != nil && x.Subtitle != nil { + return *x.Subtitle + } + return "" +} + +func (x *InteractiveMessage_Header) GetHasMediaAttachment() bool { + if x != nil && x.HasMediaAttachment != nil { + return *x.HasMediaAttachment + } + return false +} + +func (m *InteractiveMessage_Header) GetMedia() isInteractiveMessage_Header_Media { + if m != nil { + return m.Media + } + return nil +} + +func (x *InteractiveMessage_Header) GetDocumentMessage() *DocumentMessage { + if x, ok := x.GetMedia().(*InteractiveMessage_Header_DocumentMessage); ok { + return x.DocumentMessage + } + return nil +} + +func (x *InteractiveMessage_Header) GetImageMessage() *ImageMessage { + if x, ok := x.GetMedia().(*InteractiveMessage_Header_ImageMessage); ok { + return x.ImageMessage + } + return nil +} + +func (x *InteractiveMessage_Header) GetJpegThumbnail() []byte { + if x, ok := x.GetMedia().(*InteractiveMessage_Header_JpegThumbnail); ok { + return x.JpegThumbnail + } + return nil +} + +func (x *InteractiveMessage_Header) GetVideoMessage() *VideoMessage { + if x, ok := x.GetMedia().(*InteractiveMessage_Header_VideoMessage); ok { + return x.VideoMessage + } + return nil +} + +type isInteractiveMessage_Header_Media interface { + isInteractiveMessage_Header_Media() +} + +type InteractiveMessage_Header_DocumentMessage struct { + DocumentMessage *DocumentMessage `protobuf:"bytes,3,opt,name=documentMessage,oneof"` +} + +type InteractiveMessage_Header_ImageMessage struct { + ImageMessage *ImageMessage `protobuf:"bytes,4,opt,name=imageMessage,oneof"` +} + +type InteractiveMessage_Header_JpegThumbnail struct { + JpegThumbnail []byte `protobuf:"bytes,6,opt,name=jpegThumbnail,oneof"` +} + +type InteractiveMessage_Header_VideoMessage struct { + VideoMessage *VideoMessage `protobuf:"bytes,7,opt,name=videoMessage,oneof"` +} + +func (*InteractiveMessage_Header_DocumentMessage) isInteractiveMessage_Header_Media() {} + +func (*InteractiveMessage_Header_ImageMessage) isInteractiveMessage_Header_Media() {} + +func (*InteractiveMessage_Header_JpegThumbnail) isInteractiveMessage_Header_Media() {} + +func (*InteractiveMessage_Header_VideoMessage) isInteractiveMessage_Header_Media() {} + +type InteractiveMessage_Footer struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Text *string `protobuf:"bytes,1,opt,name=text" json:"text,omitempty"` +} + +func (x *InteractiveMessage_Footer) Reset() { + *x = InteractiveMessage_Footer{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[182] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InteractiveMessage_Footer) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InteractiveMessage_Footer) ProtoMessage() {} + +func (x *InteractiveMessage_Footer) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[182] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InteractiveMessage_Footer.ProtoReflect.Descriptor instead. +func (*InteractiveMessage_Footer) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{17, 3} +} + +func (x *InteractiveMessage_Footer) GetText() string { + if x != nil && x.Text != nil { + return *x.Text + } + return "" +} + +type InteractiveMessage_CollectionMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + BizJid *string `protobuf:"bytes,1,opt,name=bizJid" json:"bizJid,omitempty"` + Id *string `protobuf:"bytes,2,opt,name=id" json:"id,omitempty"` + MessageVersion *int32 `protobuf:"varint,3,opt,name=messageVersion" json:"messageVersion,omitempty"` +} + +func (x *InteractiveMessage_CollectionMessage) Reset() { + *x = InteractiveMessage_CollectionMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[183] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InteractiveMessage_CollectionMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InteractiveMessage_CollectionMessage) ProtoMessage() {} + +func (x *InteractiveMessage_CollectionMessage) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[183] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InteractiveMessage_CollectionMessage.ProtoReflect.Descriptor instead. +func (*InteractiveMessage_CollectionMessage) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{17, 4} +} + +func (x *InteractiveMessage_CollectionMessage) GetBizJid() string { + if x != nil && x.BizJid != nil { + return *x.BizJid + } + return "" +} + +func (x *InteractiveMessage_CollectionMessage) GetId() string { + if x != nil && x.Id != nil { + return *x.Id + } + return "" +} + +func (x *InteractiveMessage_CollectionMessage) GetMessageVersion() int32 { + if x != nil && x.MessageVersion != nil { + return *x.MessageVersion + } + return 0 +} + +type InteractiveMessage_Body struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Text *string `protobuf:"bytes,1,opt,name=text" json:"text,omitempty"` +} + +func (x *InteractiveMessage_Body) Reset() { + *x = InteractiveMessage_Body{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[184] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InteractiveMessage_Body) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InteractiveMessage_Body) ProtoMessage() {} + +func (x *InteractiveMessage_Body) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[184] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InteractiveMessage_Body.ProtoReflect.Descriptor instead. +func (*InteractiveMessage_Body) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{17, 5} +} + +func (x *InteractiveMessage_Body) GetText() string { + if x != nil && x.Text != nil { + return *x.Text + } + return "" +} + +type InteractiveMessage_NativeFlowMessage_NativeFlowButton struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + ButtonParamsJson *string `protobuf:"bytes,2,opt,name=buttonParamsJson" json:"buttonParamsJson,omitempty"` +} + +func (x *InteractiveMessage_NativeFlowMessage_NativeFlowButton) Reset() { + *x = InteractiveMessage_NativeFlowMessage_NativeFlowButton{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[185] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *InteractiveMessage_NativeFlowMessage_NativeFlowButton) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InteractiveMessage_NativeFlowMessage_NativeFlowButton) ProtoMessage() {} + +func (x *InteractiveMessage_NativeFlowMessage_NativeFlowButton) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[185] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InteractiveMessage_NativeFlowMessage_NativeFlowButton.ProtoReflect.Descriptor instead. +func (*InteractiveMessage_NativeFlowMessage_NativeFlowButton) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{17, 1, 0} +} + +func (x *InteractiveMessage_NativeFlowMessage_NativeFlowButton) GetName() string { + if x != nil && x.Name != nil { + return *x.Name + } + return "" +} + +func (x *InteractiveMessage_NativeFlowMessage_NativeFlowButton) GetButtonParamsJson() string { + if x != nil && x.ButtonParamsJson != nil { + return *x.ButtonParamsJson + } + return "" +} + +type HighlyStructuredMessage_HSMLocalizableParameter struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Default *string `protobuf:"bytes,1,opt,name=default" json:"default,omitempty"` + // Types that are assignable to ParamOneof: + // + // *HighlyStructuredMessage_HSMLocalizableParameter_Currency + // *HighlyStructuredMessage_HSMLocalizableParameter_DateTime + ParamOneof isHighlyStructuredMessage_HSMLocalizableParameter_ParamOneof `protobuf_oneof:"paramOneof"` +} + +func (x *HighlyStructuredMessage_HSMLocalizableParameter) Reset() { + *x = HighlyStructuredMessage_HSMLocalizableParameter{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[186] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HighlyStructuredMessage_HSMLocalizableParameter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HighlyStructuredMessage_HSMLocalizableParameter) ProtoMessage() {} + +func (x *HighlyStructuredMessage_HSMLocalizableParameter) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[186] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HighlyStructuredMessage_HSMLocalizableParameter.ProtoReflect.Descriptor instead. +func (*HighlyStructuredMessage_HSMLocalizableParameter) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{21, 0} +} + +func (x *HighlyStructuredMessage_HSMLocalizableParameter) GetDefault() string { + if x != nil && x.Default != nil { + return *x.Default + } + return "" +} + +func (m *HighlyStructuredMessage_HSMLocalizableParameter) GetParamOneof() isHighlyStructuredMessage_HSMLocalizableParameter_ParamOneof { + if m != nil { + return m.ParamOneof + } + return nil +} + +func (x *HighlyStructuredMessage_HSMLocalizableParameter) GetCurrency() *HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency { + if x, ok := x.GetParamOneof().(*HighlyStructuredMessage_HSMLocalizableParameter_Currency); ok { + return x.Currency + } + return nil +} + +func (x *HighlyStructuredMessage_HSMLocalizableParameter) GetDateTime() *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime { + if x, ok := x.GetParamOneof().(*HighlyStructuredMessage_HSMLocalizableParameter_DateTime); ok { + return x.DateTime + } + return nil +} + +type isHighlyStructuredMessage_HSMLocalizableParameter_ParamOneof interface { + isHighlyStructuredMessage_HSMLocalizableParameter_ParamOneof() +} + +type HighlyStructuredMessage_HSMLocalizableParameter_Currency struct { + Currency *HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency `protobuf:"bytes,2,opt,name=currency,oneof"` +} + +type HighlyStructuredMessage_HSMLocalizableParameter_DateTime struct { + DateTime *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime `protobuf:"bytes,3,opt,name=dateTime,oneof"` +} + +func (*HighlyStructuredMessage_HSMLocalizableParameter_Currency) isHighlyStructuredMessage_HSMLocalizableParameter_ParamOneof() { +} + +func (*HighlyStructuredMessage_HSMLocalizableParameter_DateTime) isHighlyStructuredMessage_HSMLocalizableParameter_ParamOneof() { +} + +type HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to DatetimeOneof: + // + // *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_Component + // *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_UnixEpoch + DatetimeOneof isHighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_DatetimeOneof `protobuf_oneof:"datetimeOneof"` +} + +func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime) Reset() { + *x = HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[187] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime) ProtoMessage() {} + +func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[187] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime.ProtoReflect.Descriptor instead. +func (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{21, 0, 0} +} + +func (m *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime) GetDatetimeOneof() isHighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_DatetimeOneof { + if m != nil { + return m.DatetimeOneof + } + return nil +} + +func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime) GetComponent() *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent { + if x, ok := x.GetDatetimeOneof().(*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_Component); ok { + return x.Component + } + return nil +} + +func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime) GetUnixEpoch() *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUnixEpoch { + if x, ok := x.GetDatetimeOneof().(*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_UnixEpoch); ok { + return x.UnixEpoch + } + return nil +} + +type isHighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_DatetimeOneof interface { + isHighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_DatetimeOneof() +} + +type HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_Component struct { + Component *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent `protobuf:"bytes,1,opt,name=component,oneof"` +} + +type HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_UnixEpoch struct { + UnixEpoch *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUnixEpoch `protobuf:"bytes,2,opt,name=unixEpoch,oneof"` +} + +func (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_Component) isHighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_DatetimeOneof() { +} + +func (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_UnixEpoch) isHighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_DatetimeOneof() { +} + +type HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CurrencyCode *string `protobuf:"bytes,1,opt,name=currencyCode" json:"currencyCode,omitempty"` + Amount1000 *int64 `protobuf:"varint,2,opt,name=amount1000" json:"amount1000,omitempty"` +} + +func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency) Reset() { + *x = HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[188] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency) ProtoMessage() {} + +func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[188] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency.ProtoReflect.Descriptor instead. +func (*HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{21, 0, 1} +} + +func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency) GetCurrencyCode() string { + if x != nil && x.CurrencyCode != nil { + return *x.CurrencyCode + } + return "" +} + +func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency) GetAmount1000() int64 { + if x != nil && x.Amount1000 != nil { + return *x.Amount1000 + } + return 0 +} + +type HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUnixEpoch struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Timestamp *int64 `protobuf:"varint,1,opt,name=timestamp" json:"timestamp,omitempty"` +} + +func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUnixEpoch) Reset() { + *x = HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUnixEpoch{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[189] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUnixEpoch) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUnixEpoch) ProtoMessage() { +} + +func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUnixEpoch) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[189] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUnixEpoch.ProtoReflect.Descriptor instead. +func (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUnixEpoch) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{21, 0, 0, 0} +} + +func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUnixEpoch) GetTimestamp() int64 { + if x != nil && x.Timestamp != nil { + return *x.Timestamp + } + return 0 +} + +type HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DayOfWeek *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType `protobuf:"varint,1,opt,name=dayOfWeek,enum=proto.HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_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 *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType `protobuf:"varint,7,opt,name=calendar,enum=proto.HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType" json:"calendar,omitempty"` +} + +func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent) Reset() { + *x = HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[190] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent) ProtoMessage() { +} + +func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[190] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent.ProtoReflect.Descriptor instead. +func (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{21, 0, 0, 1} +} + +func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent) GetDayOfWeek() HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType { + if x != nil && x.DayOfWeek != nil { + return *x.DayOfWeek + } + return HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_MONDAY +} + +func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent) GetYear() uint32 { + if x != nil && x.Year != nil { + return *x.Year + } + return 0 +} + +func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent) GetMonth() uint32 { + if x != nil && x.Month != nil { + return *x.Month + } + return 0 +} + +func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent) GetDayOfMonth() uint32 { + if x != nil && x.DayOfMonth != nil { + return *x.DayOfMonth + } + return 0 +} + +func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent) GetHour() uint32 { + if x != nil && x.Hour != nil { + return *x.Hour + } + return 0 +} + +func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent) GetMinute() uint32 { + if x != nil && x.Minute != nil { + return *x.Minute + } + return 0 +} + +func (x *HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent) GetCalendar() HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType { + if x != nil && x.Calendar != nil { + return *x.Calendar + } + return HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_GREGORIAN +} + +type ButtonsMessage_Button struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ButtonId *string `protobuf:"bytes,1,opt,name=buttonId" json:"buttonId,omitempty"` + ButtonText *ButtonsMessage_Button_ButtonText `protobuf:"bytes,2,opt,name=buttonText" json:"buttonText,omitempty"` + Type *ButtonsMessage_Button_Type `protobuf:"varint,3,opt,name=type,enum=proto.ButtonsMessage_Button_Type" json:"type,omitempty"` + NativeFlowInfo *ButtonsMessage_Button_NativeFlowInfo `protobuf:"bytes,4,opt,name=nativeFlowInfo" json:"nativeFlowInfo,omitempty"` +} + +func (x *ButtonsMessage_Button) Reset() { + *x = ButtonsMessage_Button{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[191] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ButtonsMessage_Button) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ButtonsMessage_Button) ProtoMessage() {} + +func (x *ButtonsMessage_Button) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[191] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ButtonsMessage_Button.ProtoReflect.Descriptor instead. +func (*ButtonsMessage_Button) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{35, 0} +} + +func (x *ButtonsMessage_Button) GetButtonId() string { + if x != nil && x.ButtonId != nil { + return *x.ButtonId + } + return "" +} + +func (x *ButtonsMessage_Button) GetButtonText() *ButtonsMessage_Button_ButtonText { + if x != nil { + return x.ButtonText + } + return nil +} + +func (x *ButtonsMessage_Button) GetType() ButtonsMessage_Button_Type { + if x != nil && x.Type != nil { + return *x.Type + } + return ButtonsMessage_Button_UNKNOWN +} + +func (x *ButtonsMessage_Button) GetNativeFlowInfo() *ButtonsMessage_Button_NativeFlowInfo { + if x != nil { + return x.NativeFlowInfo + } + return nil +} + +type ButtonsMessage_Button_NativeFlowInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + ParamsJson *string `protobuf:"bytes,2,opt,name=paramsJson" json:"paramsJson,omitempty"` +} + +func (x *ButtonsMessage_Button_NativeFlowInfo) Reset() { + *x = ButtonsMessage_Button_NativeFlowInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[192] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ButtonsMessage_Button_NativeFlowInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ButtonsMessage_Button_NativeFlowInfo) ProtoMessage() {} + +func (x *ButtonsMessage_Button_NativeFlowInfo) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[192] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ButtonsMessage_Button_NativeFlowInfo.ProtoReflect.Descriptor instead. +func (*ButtonsMessage_Button_NativeFlowInfo) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{35, 0, 0} +} + +func (x *ButtonsMessage_Button_NativeFlowInfo) GetName() string { + if x != nil && x.Name != nil { + return *x.Name + } + return "" +} + +func (x *ButtonsMessage_Button_NativeFlowInfo) GetParamsJson() string { + if x != nil && x.ParamsJson != nil { + return *x.ParamsJson + } + return "" +} + +type ButtonsMessage_Button_ButtonText struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DisplayText *string `protobuf:"bytes,1,opt,name=displayText" json:"displayText,omitempty"` +} + +func (x *ButtonsMessage_Button_ButtonText) Reset() { + *x = ButtonsMessage_Button_ButtonText{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[193] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ButtonsMessage_Button_ButtonText) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ButtonsMessage_Button_ButtonText) ProtoMessage() {} + +func (x *ButtonsMessage_Button_ButtonText) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[193] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ButtonsMessage_Button_ButtonText.ProtoReflect.Descriptor instead. +func (*ButtonsMessage_Button_ButtonText) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{35, 0, 1} +} + +func (x *ButtonsMessage_Button_ButtonText) GetDisplayText() string { + if x != nil && x.DisplayText != nil { + return *x.DisplayText + } + return "" +} + +type HydratedTemplateButton_HydratedURLButton struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DisplayText *string `protobuf:"bytes,1,opt,name=displayText" json:"displayText,omitempty"` + Url *string `protobuf:"bytes,2,opt,name=url" json:"url,omitempty"` +} + +func (x *HydratedTemplateButton_HydratedURLButton) Reset() { + *x = HydratedTemplateButton_HydratedURLButton{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[194] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HydratedTemplateButton_HydratedURLButton) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HydratedTemplateButton_HydratedURLButton) ProtoMessage() {} + +func (x *HydratedTemplateButton_HydratedURLButton) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[194] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HydratedTemplateButton_HydratedURLButton.ProtoReflect.Descriptor instead. +func (*HydratedTemplateButton_HydratedURLButton) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{46, 0} +} + +func (x *HydratedTemplateButton_HydratedURLButton) GetDisplayText() string { + if x != nil && x.DisplayText != nil { + return *x.DisplayText + } + return "" +} + +func (x *HydratedTemplateButton_HydratedURLButton) GetUrl() string { + if x != nil && x.Url != nil { + return *x.Url + } + return "" +} + +type HydratedTemplateButton_HydratedQuickReplyButton struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DisplayText *string `protobuf:"bytes,1,opt,name=displayText" json:"displayText,omitempty"` + Id *string `protobuf:"bytes,2,opt,name=id" json:"id,omitempty"` +} + +func (x *HydratedTemplateButton_HydratedQuickReplyButton) Reset() { + *x = HydratedTemplateButton_HydratedQuickReplyButton{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[195] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HydratedTemplateButton_HydratedQuickReplyButton) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HydratedTemplateButton_HydratedQuickReplyButton) ProtoMessage() {} + +func (x *HydratedTemplateButton_HydratedQuickReplyButton) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[195] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HydratedTemplateButton_HydratedQuickReplyButton.ProtoReflect.Descriptor instead. +func (*HydratedTemplateButton_HydratedQuickReplyButton) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{46, 1} +} + +func (x *HydratedTemplateButton_HydratedQuickReplyButton) GetDisplayText() string { + if x != nil && x.DisplayText != nil { + return *x.DisplayText + } + return "" +} + +func (x *HydratedTemplateButton_HydratedQuickReplyButton) GetId() string { + if x != nil && x.Id != nil { + return *x.Id + } + return "" +} + +type HydratedTemplateButton_HydratedCallButton struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DisplayText *string `protobuf:"bytes,1,opt,name=displayText" json:"displayText,omitempty"` + PhoneNumber *string `protobuf:"bytes,2,opt,name=phoneNumber" json:"phoneNumber,omitempty"` +} + +func (x *HydratedTemplateButton_HydratedCallButton) Reset() { + *x = HydratedTemplateButton_HydratedCallButton{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[196] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HydratedTemplateButton_HydratedCallButton) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HydratedTemplateButton_HydratedCallButton) ProtoMessage() {} + +func (x *HydratedTemplateButton_HydratedCallButton) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[196] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HydratedTemplateButton_HydratedCallButton.ProtoReflect.Descriptor instead. +func (*HydratedTemplateButton_HydratedCallButton) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{46, 2} +} + +func (x *HydratedTemplateButton_HydratedCallButton) GetDisplayText() string { + if x != nil && x.DisplayText != nil { + return *x.DisplayText + } + return "" +} + +func (x *HydratedTemplateButton_HydratedCallButton) GetPhoneNumber() string { + if x != nil && x.PhoneNumber != nil { + return *x.PhoneNumber + } + return "" +} + +type ContextInfo_ExternalAdReplyInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Title *string `protobuf:"bytes,1,opt,name=title" json:"title,omitempty"` + Body *string `protobuf:"bytes,2,opt,name=body" json:"body,omitempty"` + MediaType *ContextInfo_ExternalAdReplyInfo_MediaType `protobuf:"varint,3,opt,name=mediaType,enum=proto.ContextInfo_ExternalAdReplyInfo_MediaType" json:"mediaType,omitempty"` + ThumbnailUrl *string `protobuf:"bytes,4,opt,name=thumbnailUrl" json:"thumbnailUrl,omitempty"` + MediaUrl *string `protobuf:"bytes,5,opt,name=mediaUrl" json:"mediaUrl,omitempty"` + Thumbnail []byte `protobuf:"bytes,6,opt,name=thumbnail" json:"thumbnail,omitempty"` + SourceType *string `protobuf:"bytes,7,opt,name=sourceType" json:"sourceType,omitempty"` + SourceId *string `protobuf:"bytes,8,opt,name=sourceId" json:"sourceId,omitempty"` + SourceUrl *string `protobuf:"bytes,9,opt,name=sourceUrl" json:"sourceUrl,omitempty"` + ContainsAutoReply *bool `protobuf:"varint,10,opt,name=containsAutoReply" json:"containsAutoReply,omitempty"` + RenderLargerThumbnail *bool `protobuf:"varint,11,opt,name=renderLargerThumbnail" json:"renderLargerThumbnail,omitempty"` + ShowAdAttribution *bool `protobuf:"varint,12,opt,name=showAdAttribution" json:"showAdAttribution,omitempty"` + CtwaClid *string `protobuf:"bytes,13,opt,name=ctwaClid" json:"ctwaClid,omitempty"` +} + +func (x *ContextInfo_ExternalAdReplyInfo) Reset() { + *x = ContextInfo_ExternalAdReplyInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[197] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ContextInfo_ExternalAdReplyInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ContextInfo_ExternalAdReplyInfo) ProtoMessage() {} + +func (x *ContextInfo_ExternalAdReplyInfo) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[197] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ContextInfo_ExternalAdReplyInfo.ProtoReflect.Descriptor instead. +func (*ContextInfo_ExternalAdReplyInfo) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{49, 0} +} + +func (x *ContextInfo_ExternalAdReplyInfo) GetTitle() string { + if x != nil && x.Title != nil { + return *x.Title + } + return "" +} + +func (x *ContextInfo_ExternalAdReplyInfo) GetBody() string { + if x != nil && x.Body != nil { + return *x.Body + } + return "" +} + +func (x *ContextInfo_ExternalAdReplyInfo) GetMediaType() ContextInfo_ExternalAdReplyInfo_MediaType { + if x != nil && x.MediaType != nil { + return *x.MediaType + } + return ContextInfo_ExternalAdReplyInfo_NONE +} + +func (x *ContextInfo_ExternalAdReplyInfo) GetThumbnailUrl() string { + if x != nil && x.ThumbnailUrl != nil { + return *x.ThumbnailUrl + } + return "" +} + +func (x *ContextInfo_ExternalAdReplyInfo) GetMediaUrl() string { + if x != nil && x.MediaUrl != nil { + return *x.MediaUrl + } + return "" +} + +func (x *ContextInfo_ExternalAdReplyInfo) GetThumbnail() []byte { + if x != nil { + return x.Thumbnail + } + return nil +} + +func (x *ContextInfo_ExternalAdReplyInfo) GetSourceType() string { + if x != nil && x.SourceType != nil { + return *x.SourceType + } + return "" +} + +func (x *ContextInfo_ExternalAdReplyInfo) GetSourceId() string { + if x != nil && x.SourceId != nil { + return *x.SourceId + } + return "" +} + +func (x *ContextInfo_ExternalAdReplyInfo) GetSourceUrl() string { + if x != nil && x.SourceUrl != nil { + return *x.SourceUrl + } + return "" +} + +func (x *ContextInfo_ExternalAdReplyInfo) GetContainsAutoReply() bool { + if x != nil && x.ContainsAutoReply != nil { + return *x.ContainsAutoReply + } + return false +} + +func (x *ContextInfo_ExternalAdReplyInfo) GetRenderLargerThumbnail() bool { + if x != nil && x.RenderLargerThumbnail != nil { + return *x.RenderLargerThumbnail + } + return false +} + +func (x *ContextInfo_ExternalAdReplyInfo) GetShowAdAttribution() bool { + if x != nil && x.ShowAdAttribution != nil { + return *x.ShowAdAttribution + } + return false +} + +func (x *ContextInfo_ExternalAdReplyInfo) GetCtwaClid() string { + if x != nil && x.CtwaClid != nil { + return *x.CtwaClid + } + return "" +} + +type ContextInfo_AdReplyInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AdvertiserName *string `protobuf:"bytes,1,opt,name=advertiserName" json:"advertiserName,omitempty"` + MediaType *ContextInfo_AdReplyInfo_MediaType `protobuf:"varint,2,opt,name=mediaType,enum=proto.ContextInfo_AdReplyInfo_MediaType" json:"mediaType,omitempty"` + JpegThumbnail []byte `protobuf:"bytes,16,opt,name=jpegThumbnail" json:"jpegThumbnail,omitempty"` + Caption *string `protobuf:"bytes,17,opt,name=caption" json:"caption,omitempty"` +} + +func (x *ContextInfo_AdReplyInfo) Reset() { + *x = ContextInfo_AdReplyInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[198] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ContextInfo_AdReplyInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ContextInfo_AdReplyInfo) ProtoMessage() {} + +func (x *ContextInfo_AdReplyInfo) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[198] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ContextInfo_AdReplyInfo.ProtoReflect.Descriptor instead. +func (*ContextInfo_AdReplyInfo) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{49, 1} +} + +func (x *ContextInfo_AdReplyInfo) GetAdvertiserName() string { + if x != nil && x.AdvertiserName != nil { + return *x.AdvertiserName + } + return "" +} + +func (x *ContextInfo_AdReplyInfo) GetMediaType() ContextInfo_AdReplyInfo_MediaType { + if x != nil && x.MediaType != nil { + return *x.MediaType + } + return ContextInfo_AdReplyInfo_NONE +} + +func (x *ContextInfo_AdReplyInfo) GetJpegThumbnail() []byte { + if x != nil { + return x.JpegThumbnail + } + return nil +} + +func (x *ContextInfo_AdReplyInfo) GetCaption() string { + if x != nil && x.Caption != nil { + return *x.Caption + } + return "" +} + +type TemplateButton_URLButton struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DisplayText *HighlyStructuredMessage `protobuf:"bytes,1,opt,name=displayText" json:"displayText,omitempty"` + Url *HighlyStructuredMessage `protobuf:"bytes,2,opt,name=url" json:"url,omitempty"` +} + +func (x *TemplateButton_URLButton) Reset() { + *x = TemplateButton_URLButton{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[199] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TemplateButton_URLButton) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TemplateButton_URLButton) ProtoMessage() {} + +func (x *TemplateButton_URLButton) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[199] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TemplateButton_URLButton.ProtoReflect.Descriptor instead. +func (*TemplateButton_URLButton) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{51, 0} +} + +func (x *TemplateButton_URLButton) GetDisplayText() *HighlyStructuredMessage { + if x != nil { + return x.DisplayText + } + return nil +} + +func (x *TemplateButton_URLButton) GetUrl() *HighlyStructuredMessage { + if x != nil { + return x.Url + } + return nil +} + +type TemplateButton_QuickReplyButton struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DisplayText *HighlyStructuredMessage `protobuf:"bytes,1,opt,name=displayText" json:"displayText,omitempty"` + Id *string `protobuf:"bytes,2,opt,name=id" json:"id,omitempty"` +} + +func (x *TemplateButton_QuickReplyButton) Reset() { + *x = TemplateButton_QuickReplyButton{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[200] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TemplateButton_QuickReplyButton) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TemplateButton_QuickReplyButton) ProtoMessage() {} + +func (x *TemplateButton_QuickReplyButton) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[200] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TemplateButton_QuickReplyButton.ProtoReflect.Descriptor instead. +func (*TemplateButton_QuickReplyButton) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{51, 1} +} + +func (x *TemplateButton_QuickReplyButton) GetDisplayText() *HighlyStructuredMessage { + if x != nil { + return x.DisplayText + } + return nil +} + +func (x *TemplateButton_QuickReplyButton) GetId() string { + if x != nil && x.Id != nil { + return *x.Id + } + return "" +} + +type TemplateButton_CallButton struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DisplayText *HighlyStructuredMessage `protobuf:"bytes,1,opt,name=displayText" json:"displayText,omitempty"` + PhoneNumber *HighlyStructuredMessage `protobuf:"bytes,2,opt,name=phoneNumber" json:"phoneNumber,omitempty"` +} + +func (x *TemplateButton_CallButton) Reset() { + *x = TemplateButton_CallButton{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[201] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TemplateButton_CallButton) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TemplateButton_CallButton) ProtoMessage() {} + +func (x *TemplateButton_CallButton) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[201] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TemplateButton_CallButton.ProtoReflect.Descriptor instead. +func (*TemplateButton_CallButton) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{51, 2} +} + +func (x *TemplateButton_CallButton) GetDisplayText() *HighlyStructuredMessage { + if x != nil { + return x.DisplayText + } + return nil +} + +func (x *TemplateButton_CallButton) GetPhoneNumber() *HighlyStructuredMessage { + if x != nil { + return x.PhoneNumber + } + return nil +} + +type PaymentBackground_MediaData struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MediaKey []byte `protobuf:"bytes,1,opt,name=mediaKey" json:"mediaKey,omitempty"` + MediaKeyTimestamp *int64 `protobuf:"varint,2,opt,name=mediaKeyTimestamp" json:"mediaKeyTimestamp,omitempty"` + FileSha256 []byte `protobuf:"bytes,3,opt,name=fileSha256" json:"fileSha256,omitempty"` + FileEncSha256 []byte `protobuf:"bytes,4,opt,name=fileEncSha256" json:"fileEncSha256,omitempty"` + DirectPath *string `protobuf:"bytes,5,opt,name=directPath" json:"directPath,omitempty"` +} + +func (x *PaymentBackground_MediaData) Reset() { + *x = PaymentBackground_MediaData{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[202] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PaymentBackground_MediaData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PaymentBackground_MediaData) ProtoMessage() {} + +func (x *PaymentBackground_MediaData) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[202] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PaymentBackground_MediaData.ProtoReflect.Descriptor instead. +func (*PaymentBackground_MediaData) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{53, 0} +} + +func (x *PaymentBackground_MediaData) GetMediaKey() []byte { + if x != nil { + return x.MediaKey + } + return nil +} + +func (x *PaymentBackground_MediaData) GetMediaKeyTimestamp() int64 { + if x != nil && x.MediaKeyTimestamp != nil { + return *x.MediaKeyTimestamp + } + return 0 +} + +func (x *PaymentBackground_MediaData) GetFileSha256() []byte { + if x != nil { + return x.FileSha256 + } + return nil +} + +func (x *PaymentBackground_MediaData) GetFileEncSha256() []byte { + if x != nil { + return x.FileEncSha256 + } + return nil +} + +func (x *PaymentBackground_MediaData) GetDirectPath() string { + if x != nil && x.DirectPath != nil { + return *x.DirectPath + } + return "" +} + +type TemplateMessage_HydratedFourRowTemplate struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + HydratedContentText *string `protobuf:"bytes,6,opt,name=hydratedContentText" json:"hydratedContentText,omitempty"` + HydratedFooterText *string `protobuf:"bytes,7,opt,name=hydratedFooterText" json:"hydratedFooterText,omitempty"` + HydratedButtons []*HydratedTemplateButton `protobuf:"bytes,8,rep,name=hydratedButtons" json:"hydratedButtons,omitempty"` + TemplateId *string `protobuf:"bytes,9,opt,name=templateId" json:"templateId,omitempty"` + // Types that are assignable to Title: + // + // *TemplateMessage_HydratedFourRowTemplate_DocumentMessage + // *TemplateMessage_HydratedFourRowTemplate_HydratedTitleText + // *TemplateMessage_HydratedFourRowTemplate_ImageMessage + // *TemplateMessage_HydratedFourRowTemplate_VideoMessage + // *TemplateMessage_HydratedFourRowTemplate_LocationMessage + Title isTemplateMessage_HydratedFourRowTemplate_Title `protobuf_oneof:"title"` +} + +func (x *TemplateMessage_HydratedFourRowTemplate) Reset() { + *x = TemplateMessage_HydratedFourRowTemplate{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[203] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TemplateMessage_HydratedFourRowTemplate) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TemplateMessage_HydratedFourRowTemplate) ProtoMessage() {} + +func (x *TemplateMessage_HydratedFourRowTemplate) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[203] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TemplateMessage_HydratedFourRowTemplate.ProtoReflect.Descriptor instead. +func (*TemplateMessage_HydratedFourRowTemplate) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{58, 0} +} + +func (x *TemplateMessage_HydratedFourRowTemplate) GetHydratedContentText() string { + if x != nil && x.HydratedContentText != nil { + return *x.HydratedContentText + } + return "" +} + +func (x *TemplateMessage_HydratedFourRowTemplate) GetHydratedFooterText() string { + if x != nil && x.HydratedFooterText != nil { + return *x.HydratedFooterText + } + return "" +} + +func (x *TemplateMessage_HydratedFourRowTemplate) GetHydratedButtons() []*HydratedTemplateButton { + if x != nil { + return x.HydratedButtons + } + return nil +} + +func (x *TemplateMessage_HydratedFourRowTemplate) GetTemplateId() string { + if x != nil && x.TemplateId != nil { + return *x.TemplateId + } + return "" +} + +func (m *TemplateMessage_HydratedFourRowTemplate) GetTitle() isTemplateMessage_HydratedFourRowTemplate_Title { + if m != nil { + return m.Title + } + return nil +} + +func (x *TemplateMessage_HydratedFourRowTemplate) GetDocumentMessage() *DocumentMessage { + if x, ok := x.GetTitle().(*TemplateMessage_HydratedFourRowTemplate_DocumentMessage); ok { + return x.DocumentMessage + } + return nil +} + +func (x *TemplateMessage_HydratedFourRowTemplate) GetHydratedTitleText() string { + if x, ok := x.GetTitle().(*TemplateMessage_HydratedFourRowTemplate_HydratedTitleText); ok { + return x.HydratedTitleText + } + return "" +} + +func (x *TemplateMessage_HydratedFourRowTemplate) GetImageMessage() *ImageMessage { + if x, ok := x.GetTitle().(*TemplateMessage_HydratedFourRowTemplate_ImageMessage); ok { + return x.ImageMessage + } + return nil +} + +func (x *TemplateMessage_HydratedFourRowTemplate) GetVideoMessage() *VideoMessage { + if x, ok := x.GetTitle().(*TemplateMessage_HydratedFourRowTemplate_VideoMessage); ok { + return x.VideoMessage + } + return nil +} + +func (x *TemplateMessage_HydratedFourRowTemplate) GetLocationMessage() *LocationMessage { + if x, ok := x.GetTitle().(*TemplateMessage_HydratedFourRowTemplate_LocationMessage); ok { + return x.LocationMessage + } + return nil +} + +type isTemplateMessage_HydratedFourRowTemplate_Title interface { + isTemplateMessage_HydratedFourRowTemplate_Title() +} + +type TemplateMessage_HydratedFourRowTemplate_DocumentMessage struct { + DocumentMessage *DocumentMessage `protobuf:"bytes,1,opt,name=documentMessage,oneof"` +} + +type TemplateMessage_HydratedFourRowTemplate_HydratedTitleText struct { + HydratedTitleText string `protobuf:"bytes,2,opt,name=hydratedTitleText,oneof"` +} + +type TemplateMessage_HydratedFourRowTemplate_ImageMessage struct { + ImageMessage *ImageMessage `protobuf:"bytes,3,opt,name=imageMessage,oneof"` +} + +type TemplateMessage_HydratedFourRowTemplate_VideoMessage struct { + VideoMessage *VideoMessage `protobuf:"bytes,4,opt,name=videoMessage,oneof"` +} + +type TemplateMessage_HydratedFourRowTemplate_LocationMessage struct { + LocationMessage *LocationMessage `protobuf:"bytes,5,opt,name=locationMessage,oneof"` +} + +func (*TemplateMessage_HydratedFourRowTemplate_DocumentMessage) isTemplateMessage_HydratedFourRowTemplate_Title() { +} + +func (*TemplateMessage_HydratedFourRowTemplate_HydratedTitleText) isTemplateMessage_HydratedFourRowTemplate_Title() { +} + +func (*TemplateMessage_HydratedFourRowTemplate_ImageMessage) isTemplateMessage_HydratedFourRowTemplate_Title() { +} + +func (*TemplateMessage_HydratedFourRowTemplate_VideoMessage) isTemplateMessage_HydratedFourRowTemplate_Title() { +} + +func (*TemplateMessage_HydratedFourRowTemplate_LocationMessage) isTemplateMessage_HydratedFourRowTemplate_Title() { +} + +type TemplateMessage_FourRowTemplate struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Content *HighlyStructuredMessage `protobuf:"bytes,6,opt,name=content" json:"content,omitempty"` + Footer *HighlyStructuredMessage `protobuf:"bytes,7,opt,name=footer" json:"footer,omitempty"` + Buttons []*TemplateButton `protobuf:"bytes,8,rep,name=buttons" json:"buttons,omitempty"` + // Types that are assignable to Title: + // + // *TemplateMessage_FourRowTemplate_DocumentMessage + // *TemplateMessage_FourRowTemplate_HighlyStructuredMessage + // *TemplateMessage_FourRowTemplate_ImageMessage + // *TemplateMessage_FourRowTemplate_VideoMessage + // *TemplateMessage_FourRowTemplate_LocationMessage + Title isTemplateMessage_FourRowTemplate_Title `protobuf_oneof:"title"` +} + +func (x *TemplateMessage_FourRowTemplate) Reset() { + *x = TemplateMessage_FourRowTemplate{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[204] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TemplateMessage_FourRowTemplate) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TemplateMessage_FourRowTemplate) ProtoMessage() {} + +func (x *TemplateMessage_FourRowTemplate) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[204] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TemplateMessage_FourRowTemplate.ProtoReflect.Descriptor instead. +func (*TemplateMessage_FourRowTemplate) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{58, 1} +} + +func (x *TemplateMessage_FourRowTemplate) GetContent() *HighlyStructuredMessage { + if x != nil { + return x.Content + } + return nil +} + +func (x *TemplateMessage_FourRowTemplate) GetFooter() *HighlyStructuredMessage { + if x != nil { + return x.Footer + } + return nil +} + +func (x *TemplateMessage_FourRowTemplate) GetButtons() []*TemplateButton { + if x != nil { + return x.Buttons + } + return nil +} + +func (m *TemplateMessage_FourRowTemplate) GetTitle() isTemplateMessage_FourRowTemplate_Title { + if m != nil { + return m.Title + } + return nil +} + +func (x *TemplateMessage_FourRowTemplate) GetDocumentMessage() *DocumentMessage { + if x, ok := x.GetTitle().(*TemplateMessage_FourRowTemplate_DocumentMessage); ok { + return x.DocumentMessage + } + return nil +} + +func (x *TemplateMessage_FourRowTemplate) GetHighlyStructuredMessage() *HighlyStructuredMessage { + if x, ok := x.GetTitle().(*TemplateMessage_FourRowTemplate_HighlyStructuredMessage); ok { + return x.HighlyStructuredMessage + } + return nil +} + +func (x *TemplateMessage_FourRowTemplate) GetImageMessage() *ImageMessage { + if x, ok := x.GetTitle().(*TemplateMessage_FourRowTemplate_ImageMessage); ok { + return x.ImageMessage + } + return nil +} + +func (x *TemplateMessage_FourRowTemplate) GetVideoMessage() *VideoMessage { + if x, ok := x.GetTitle().(*TemplateMessage_FourRowTemplate_VideoMessage); ok { + return x.VideoMessage + } + return nil +} + +func (x *TemplateMessage_FourRowTemplate) GetLocationMessage() *LocationMessage { + if x, ok := x.GetTitle().(*TemplateMessage_FourRowTemplate_LocationMessage); ok { + return x.LocationMessage + } + return nil +} + +type isTemplateMessage_FourRowTemplate_Title interface { + isTemplateMessage_FourRowTemplate_Title() +} + +type TemplateMessage_FourRowTemplate_DocumentMessage struct { + DocumentMessage *DocumentMessage `protobuf:"bytes,1,opt,name=documentMessage,oneof"` +} + +type TemplateMessage_FourRowTemplate_HighlyStructuredMessage struct { + HighlyStructuredMessage *HighlyStructuredMessage `protobuf:"bytes,2,opt,name=highlyStructuredMessage,oneof"` +} + +type TemplateMessage_FourRowTemplate_ImageMessage struct { + ImageMessage *ImageMessage `protobuf:"bytes,3,opt,name=imageMessage,oneof"` +} + +type TemplateMessage_FourRowTemplate_VideoMessage struct { + VideoMessage *VideoMessage `protobuf:"bytes,4,opt,name=videoMessage,oneof"` +} + +type TemplateMessage_FourRowTemplate_LocationMessage struct { + LocationMessage *LocationMessage `protobuf:"bytes,5,opt,name=locationMessage,oneof"` +} + +func (*TemplateMessage_FourRowTemplate_DocumentMessage) isTemplateMessage_FourRowTemplate_Title() {} + +func (*TemplateMessage_FourRowTemplate_HighlyStructuredMessage) isTemplateMessage_FourRowTemplate_Title() { +} + +func (*TemplateMessage_FourRowTemplate_ImageMessage) isTemplateMessage_FourRowTemplate_Title() {} + +func (*TemplateMessage_FourRowTemplate_VideoMessage) isTemplateMessage_FourRowTemplate_Title() {} + +func (*TemplateMessage_FourRowTemplate_LocationMessage) isTemplateMessage_FourRowTemplate_Title() {} + +type ProductMessage_ProductSnapshot struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ProductImage *ImageMessage `protobuf:"bytes,1,opt,name=productImage" json:"productImage,omitempty"` + ProductId *string `protobuf:"bytes,2,opt,name=productId" json:"productId,omitempty"` + Title *string `protobuf:"bytes,3,opt,name=title" json:"title,omitempty"` + Description *string `protobuf:"bytes,4,opt,name=description" json:"description,omitempty"` + CurrencyCode *string `protobuf:"bytes,5,opt,name=currencyCode" json:"currencyCode,omitempty"` + PriceAmount1000 *int64 `protobuf:"varint,6,opt,name=priceAmount1000" json:"priceAmount1000,omitempty"` + RetailerId *string `protobuf:"bytes,7,opt,name=retailerId" json:"retailerId,omitempty"` + Url *string `protobuf:"bytes,8,opt,name=url" json:"url,omitempty"` + ProductImageCount *uint32 `protobuf:"varint,9,opt,name=productImageCount" json:"productImageCount,omitempty"` + FirstImageId *string `protobuf:"bytes,11,opt,name=firstImageId" json:"firstImageId,omitempty"` + SalePriceAmount1000 *int64 `protobuf:"varint,12,opt,name=salePriceAmount1000" json:"salePriceAmount1000,omitempty"` +} + +func (x *ProductMessage_ProductSnapshot) Reset() { + *x = ProductMessage_ProductSnapshot{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[205] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ProductMessage_ProductSnapshot) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProductMessage_ProductSnapshot) ProtoMessage() {} + +func (x *ProductMessage_ProductSnapshot) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[205] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ProductMessage_ProductSnapshot.ProtoReflect.Descriptor instead. +func (*ProductMessage_ProductSnapshot) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{68, 0} +} + +func (x *ProductMessage_ProductSnapshot) GetProductImage() *ImageMessage { + if x != nil { + return x.ProductImage + } + return nil +} + +func (x *ProductMessage_ProductSnapshot) GetProductId() string { + if x != nil && x.ProductId != nil { + return *x.ProductId + } + return "" +} + +func (x *ProductMessage_ProductSnapshot) GetTitle() string { + if x != nil && x.Title != nil { + return *x.Title + } + return "" +} + +func (x *ProductMessage_ProductSnapshot) GetDescription() string { + if x != nil && x.Description != nil { + return *x.Description + } + return "" +} + +func (x *ProductMessage_ProductSnapshot) GetCurrencyCode() string { + if x != nil && x.CurrencyCode != nil { + return *x.CurrencyCode + } + return "" +} + +func (x *ProductMessage_ProductSnapshot) GetPriceAmount1000() int64 { + if x != nil && x.PriceAmount1000 != nil { + return *x.PriceAmount1000 + } + return 0 +} + +func (x *ProductMessage_ProductSnapshot) GetRetailerId() string { + if x != nil && x.RetailerId != nil { + return *x.RetailerId + } + return "" +} + +func (x *ProductMessage_ProductSnapshot) GetUrl() string { + if x != nil && x.Url != nil { + return *x.Url + } + return "" +} + +func (x *ProductMessage_ProductSnapshot) GetProductImageCount() uint32 { + if x != nil && x.ProductImageCount != nil { + return *x.ProductImageCount + } + return 0 +} + +func (x *ProductMessage_ProductSnapshot) GetFirstImageId() string { + if x != nil && x.FirstImageId != nil { + return *x.FirstImageId + } + return "" +} + +func (x *ProductMessage_ProductSnapshot) GetSalePriceAmount1000() int64 { + if x != nil && x.SalePriceAmount1000 != nil { + return *x.SalePriceAmount1000 + } + return 0 +} + +type ProductMessage_CatalogSnapshot struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + CatalogImage *ImageMessage `protobuf:"bytes,1,opt,name=catalogImage" json:"catalogImage,omitempty"` + Title *string `protobuf:"bytes,2,opt,name=title" json:"title,omitempty"` + Description *string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"` +} + +func (x *ProductMessage_CatalogSnapshot) Reset() { + *x = ProductMessage_CatalogSnapshot{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[206] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ProductMessage_CatalogSnapshot) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProductMessage_CatalogSnapshot) ProtoMessage() {} + +func (x *ProductMessage_CatalogSnapshot) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[206] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ProductMessage_CatalogSnapshot.ProtoReflect.Descriptor instead. +func (*ProductMessage_CatalogSnapshot) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{68, 1} +} + +func (x *ProductMessage_CatalogSnapshot) GetCatalogImage() *ImageMessage { + if x != nil { + return x.CatalogImage + } + return nil +} + +func (x *ProductMessage_CatalogSnapshot) GetTitle() string { + if x != nil && x.Title != nil { + return *x.Title + } + return "" +} + +func (x *ProductMessage_CatalogSnapshot) GetDescription() string { + if x != nil && x.Description != nil { + return *x.Description + } + return "" +} + +type PollCreationMessage_Option struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + OptionName *string `protobuf:"bytes,1,opt,name=optionName" json:"optionName,omitempty"` +} + +func (x *PollCreationMessage_Option) Reset() { + *x = PollCreationMessage_Option{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[207] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PollCreationMessage_Option) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PollCreationMessage_Option) ProtoMessage() {} + +func (x *PollCreationMessage_Option) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[207] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PollCreationMessage_Option.ProtoReflect.Descriptor instead. +func (*PollCreationMessage_Option) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{73, 0} +} + +func (x *PollCreationMessage_Option) GetOptionName() string { + if x != nil && x.OptionName != nil { + return *x.OptionName + } + return "" +} + +type MsgOpaqueData_PollOption struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` +} + +func (x *MsgOpaqueData_PollOption) Reset() { + *x = MsgOpaqueData_PollOption{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[208] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgOpaqueData_PollOption) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgOpaqueData_PollOption) ProtoMessage() {} + +func (x *MsgOpaqueData_PollOption) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[208] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MsgOpaqueData_PollOption.ProtoReflect.Descriptor instead. +func (*MsgOpaqueData_PollOption) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{88, 0} +} + +func (x *MsgOpaqueData_PollOption) GetName() string { + if x != nil && x.Name != nil { + return *x.Name + } + return "" +} + +type VerifiedNameCertificate_Details struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Serial *uint64 `protobuf:"varint,1,opt,name=serial" json:"serial,omitempty"` + Issuer *string `protobuf:"bytes,2,opt,name=issuer" json:"issuer,omitempty"` + VerifiedName *string `protobuf:"bytes,4,opt,name=verifiedName" json:"verifiedName,omitempty"` + LocalizedNames []*LocalizedName `protobuf:"bytes,8,rep,name=localizedNames" json:"localizedNames,omitempty"` + IssueTime *uint64 `protobuf:"varint,10,opt,name=issueTime" json:"issueTime,omitempty"` +} + +func (x *VerifiedNameCertificate_Details) Reset() { + *x = VerifiedNameCertificate_Details{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[209] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VerifiedNameCertificate_Details) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VerifiedNameCertificate_Details) ProtoMessage() {} + +func (x *VerifiedNameCertificate_Details) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[209] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VerifiedNameCertificate_Details.ProtoReflect.Descriptor instead. +func (*VerifiedNameCertificate_Details) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{139, 0} +} + +func (x *VerifiedNameCertificate_Details) GetSerial() uint64 { + if x != nil && x.Serial != nil { + return *x.Serial + } + return 0 +} + +func (x *VerifiedNameCertificate_Details) GetIssuer() string { + if x != nil && x.Issuer != nil { + return *x.Issuer + } + return "" +} + +func (x *VerifiedNameCertificate_Details) GetVerifiedName() string { + if x != nil && x.VerifiedName != nil { + return *x.VerifiedName + } + return "" +} + +func (x *VerifiedNameCertificate_Details) GetLocalizedNames() []*LocalizedName { + if x != nil { + return x.LocalizedNames + } + return nil +} + +func (x *VerifiedNameCertificate_Details) GetIssueTime() uint64 { + if x != nil && x.IssueTime != nil { + return *x.IssueTime + } + return 0 +} + +type ClientPayload_WebInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + RefToken *string `protobuf:"bytes,1,opt,name=refToken" json:"refToken,omitempty"` + Version *string `protobuf:"bytes,2,opt,name=version" json:"version,omitempty"` + WebdPayload *ClientPayload_WebInfo_WebdPayload `protobuf:"bytes,3,opt,name=webdPayload" json:"webdPayload,omitempty"` + WebSubPlatform *ClientPayload_WebInfo_WebSubPlatform `protobuf:"varint,4,opt,name=webSubPlatform,enum=proto.ClientPayload_WebInfo_WebSubPlatform" json:"webSubPlatform,omitempty"` +} + +func (x *ClientPayload_WebInfo) Reset() { + *x = ClientPayload_WebInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[210] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ClientPayload_WebInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClientPayload_WebInfo) ProtoMessage() {} + +func (x *ClientPayload_WebInfo) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[210] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ClientPayload_WebInfo.ProtoReflect.Descriptor instead. +func (*ClientPayload_WebInfo) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{148, 0} +} + +func (x *ClientPayload_WebInfo) GetRefToken() string { + if x != nil && x.RefToken != nil { + return *x.RefToken + } + return "" +} + +func (x *ClientPayload_WebInfo) GetVersion() string { + if x != nil && x.Version != nil { + return *x.Version + } + return "" +} + +func (x *ClientPayload_WebInfo) GetWebdPayload() *ClientPayload_WebInfo_WebdPayload { + if x != nil { + return x.WebdPayload + } + return nil +} + +func (x *ClientPayload_WebInfo) GetWebSubPlatform() ClientPayload_WebInfo_WebSubPlatform { + if x != nil && x.WebSubPlatform != nil { + return *x.WebSubPlatform + } + return ClientPayload_WebInfo_WEB_BROWSER +} + +type ClientPayload_UserAgent struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Platform *ClientPayload_UserAgent_Platform `protobuf:"varint,1,opt,name=platform,enum=proto.ClientPayload_UserAgent_Platform" json:"platform,omitempty"` + AppVersion *ClientPayload_UserAgent_AppVersion `protobuf:"bytes,2,opt,name=appVersion" json:"appVersion,omitempty"` + Mcc *string `protobuf:"bytes,3,opt,name=mcc" json:"mcc,omitempty"` + Mnc *string `protobuf:"bytes,4,opt,name=mnc" json:"mnc,omitempty"` + OsVersion *string `protobuf:"bytes,5,opt,name=osVersion" json:"osVersion,omitempty"` + Manufacturer *string `protobuf:"bytes,6,opt,name=manufacturer" json:"manufacturer,omitempty"` + Device *string `protobuf:"bytes,7,opt,name=device" json:"device,omitempty"` + OsBuildNumber *string `protobuf:"bytes,8,opt,name=osBuildNumber" json:"osBuildNumber,omitempty"` + PhoneId *string `protobuf:"bytes,9,opt,name=phoneId" json:"phoneId,omitempty"` + ReleaseChannel *ClientPayload_UserAgent_ReleaseChannel `protobuf:"varint,10,opt,name=releaseChannel,enum=proto.ClientPayload_UserAgent_ReleaseChannel" json:"releaseChannel,omitempty"` + LocaleLanguageIso6391 *string `protobuf:"bytes,11,opt,name=localeLanguageIso6391" json:"localeLanguageIso6391,omitempty"` + LocaleCountryIso31661Alpha2 *string `protobuf:"bytes,12,opt,name=localeCountryIso31661Alpha2" json:"localeCountryIso31661Alpha2,omitempty"` + DeviceBoard *string `protobuf:"bytes,13,opt,name=deviceBoard" json:"deviceBoard,omitempty"` +} + +func (x *ClientPayload_UserAgent) Reset() { + *x = ClientPayload_UserAgent{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[211] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ClientPayload_UserAgent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClientPayload_UserAgent) ProtoMessage() {} + +func (x *ClientPayload_UserAgent) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[211] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ClientPayload_UserAgent.ProtoReflect.Descriptor instead. +func (*ClientPayload_UserAgent) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{148, 1} +} + +func (x *ClientPayload_UserAgent) GetPlatform() ClientPayload_UserAgent_Platform { + if x != nil && x.Platform != nil { + return *x.Platform + } + return ClientPayload_UserAgent_ANDROID +} + +func (x *ClientPayload_UserAgent) GetAppVersion() *ClientPayload_UserAgent_AppVersion { + if x != nil { + return x.AppVersion + } + return nil +} + +func (x *ClientPayload_UserAgent) GetMcc() string { + if x != nil && x.Mcc != nil { + return *x.Mcc + } + return "" +} + +func (x *ClientPayload_UserAgent) GetMnc() string { + if x != nil && x.Mnc != nil { + return *x.Mnc + } + return "" +} + +func (x *ClientPayload_UserAgent) GetOsVersion() string { + if x != nil && x.OsVersion != nil { + return *x.OsVersion + } + return "" +} + +func (x *ClientPayload_UserAgent) GetManufacturer() string { + if x != nil && x.Manufacturer != nil { + return *x.Manufacturer + } + return "" +} + +func (x *ClientPayload_UserAgent) GetDevice() string { + if x != nil && x.Device != nil { + return *x.Device + } + return "" +} + +func (x *ClientPayload_UserAgent) GetOsBuildNumber() string { + if x != nil && x.OsBuildNumber != nil { + return *x.OsBuildNumber + } + return "" +} + +func (x *ClientPayload_UserAgent) GetPhoneId() string { + if x != nil && x.PhoneId != nil { + return *x.PhoneId + } + return "" +} + +func (x *ClientPayload_UserAgent) GetReleaseChannel() ClientPayload_UserAgent_ReleaseChannel { + if x != nil && x.ReleaseChannel != nil { + return *x.ReleaseChannel + } + return ClientPayload_UserAgent_RELEASE +} + +func (x *ClientPayload_UserAgent) GetLocaleLanguageIso6391() string { + if x != nil && x.LocaleLanguageIso6391 != nil { + return *x.LocaleLanguageIso6391 + } + return "" +} + +func (x *ClientPayload_UserAgent) GetLocaleCountryIso31661Alpha2() string { + if x != nil && x.LocaleCountryIso31661Alpha2 != nil { + return *x.LocaleCountryIso31661Alpha2 + } + return "" +} + +func (x *ClientPayload_UserAgent) GetDeviceBoard() string { + if x != nil && x.DeviceBoard != nil { + return *x.DeviceBoard + } + return "" +} + +type ClientPayload_DevicePairingRegistrationData struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ERegid []byte `protobuf:"bytes,1,opt,name=eRegid" json:"eRegid,omitempty"` + EKeytype []byte `protobuf:"bytes,2,opt,name=eKeytype" json:"eKeytype,omitempty"` + EIdent []byte `protobuf:"bytes,3,opt,name=eIdent" json:"eIdent,omitempty"` + ESkeyId []byte `protobuf:"bytes,4,opt,name=eSkeyId" json:"eSkeyId,omitempty"` + ESkeyVal []byte `protobuf:"bytes,5,opt,name=eSkeyVal" json:"eSkeyVal,omitempty"` + ESkeySig []byte `protobuf:"bytes,6,opt,name=eSkeySig" json:"eSkeySig,omitempty"` + BuildHash []byte `protobuf:"bytes,7,opt,name=buildHash" json:"buildHash,omitempty"` + DeviceProps []byte `protobuf:"bytes,8,opt,name=deviceProps" json:"deviceProps,omitempty"` +} + +func (x *ClientPayload_DevicePairingRegistrationData) Reset() { + *x = ClientPayload_DevicePairingRegistrationData{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[212] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ClientPayload_DevicePairingRegistrationData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClientPayload_DevicePairingRegistrationData) ProtoMessage() {} + +func (x *ClientPayload_DevicePairingRegistrationData) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[212] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ClientPayload_DevicePairingRegistrationData.ProtoReflect.Descriptor instead. +func (*ClientPayload_DevicePairingRegistrationData) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{148, 2} +} + +func (x *ClientPayload_DevicePairingRegistrationData) GetERegid() []byte { + if x != nil { + return x.ERegid + } + return nil +} + +func (x *ClientPayload_DevicePairingRegistrationData) GetEKeytype() []byte { + if x != nil { + return x.EKeytype + } + return nil +} + +func (x *ClientPayload_DevicePairingRegistrationData) GetEIdent() []byte { + if x != nil { + return x.EIdent + } + return nil +} + +func (x *ClientPayload_DevicePairingRegistrationData) GetESkeyId() []byte { + if x != nil { + return x.ESkeyId + } + return nil +} + +func (x *ClientPayload_DevicePairingRegistrationData) GetESkeyVal() []byte { + if x != nil { + return x.ESkeyVal + } + return nil +} + +func (x *ClientPayload_DevicePairingRegistrationData) GetESkeySig() []byte { + if x != nil { + return x.ESkeySig + } + return nil +} + +func (x *ClientPayload_DevicePairingRegistrationData) GetBuildHash() []byte { + if x != nil { + return x.BuildHash + } + return nil +} + +func (x *ClientPayload_DevicePairingRegistrationData) GetDeviceProps() []byte { + if x != nil { + return x.DeviceProps + } + return nil +} + +type ClientPayload_DNSSource struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DnsMethod *ClientPayload_DNSSource_DNSResolutionMethod `protobuf:"varint,15,opt,name=dnsMethod,enum=proto.ClientPayload_DNSSource_DNSResolutionMethod" json:"dnsMethod,omitempty"` + AppCached *bool `protobuf:"varint,16,opt,name=appCached" json:"appCached,omitempty"` +} + +func (x *ClientPayload_DNSSource) Reset() { + *x = ClientPayload_DNSSource{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[213] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ClientPayload_DNSSource) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClientPayload_DNSSource) ProtoMessage() {} + +func (x *ClientPayload_DNSSource) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[213] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ClientPayload_DNSSource.ProtoReflect.Descriptor instead. +func (*ClientPayload_DNSSource) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{148, 3} +} + +func (x *ClientPayload_DNSSource) GetDnsMethod() ClientPayload_DNSSource_DNSResolutionMethod { + if x != nil && x.DnsMethod != nil { + return *x.DnsMethod + } + return ClientPayload_DNSSource_SYSTEM +} + +func (x *ClientPayload_DNSSource) GetAppCached() bool { + if x != nil && x.AppCached != nil { + return *x.AppCached + } + return false +} + +type ClientPayload_WebInfo_WebdPayload struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UsesParticipantInKey *bool `protobuf:"varint,1,opt,name=usesParticipantInKey" json:"usesParticipantInKey,omitempty"` + SupportsStarredMessages *bool `protobuf:"varint,2,opt,name=supportsStarredMessages" json:"supportsStarredMessages,omitempty"` + SupportsDocumentMessages *bool `protobuf:"varint,3,opt,name=supportsDocumentMessages" json:"supportsDocumentMessages,omitempty"` + SupportsUrlMessages *bool `protobuf:"varint,4,opt,name=supportsUrlMessages" json:"supportsUrlMessages,omitempty"` + SupportsMediaRetry *bool `protobuf:"varint,5,opt,name=supportsMediaRetry" json:"supportsMediaRetry,omitempty"` + SupportsE2EImage *bool `protobuf:"varint,6,opt,name=supportsE2EImage" json:"supportsE2EImage,omitempty"` + SupportsE2EVideo *bool `protobuf:"varint,7,opt,name=supportsE2EVideo" json:"supportsE2EVideo,omitempty"` + SupportsE2EAudio *bool `protobuf:"varint,8,opt,name=supportsE2EAudio" json:"supportsE2EAudio,omitempty"` + SupportsE2EDocument *bool `protobuf:"varint,9,opt,name=supportsE2EDocument" json:"supportsE2EDocument,omitempty"` + DocumentTypes *string `protobuf:"bytes,10,opt,name=documentTypes" json:"documentTypes,omitempty"` + Features []byte `protobuf:"bytes,11,opt,name=features" json:"features,omitempty"` +} + +func (x *ClientPayload_WebInfo_WebdPayload) Reset() { + *x = ClientPayload_WebInfo_WebdPayload{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[214] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ClientPayload_WebInfo_WebdPayload) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClientPayload_WebInfo_WebdPayload) ProtoMessage() {} + +func (x *ClientPayload_WebInfo_WebdPayload) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[214] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ClientPayload_WebInfo_WebdPayload.ProtoReflect.Descriptor instead. +func (*ClientPayload_WebInfo_WebdPayload) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{148, 0, 0} +} + +func (x *ClientPayload_WebInfo_WebdPayload) GetUsesParticipantInKey() bool { + if x != nil && x.UsesParticipantInKey != nil { + return *x.UsesParticipantInKey + } + return false +} + +func (x *ClientPayload_WebInfo_WebdPayload) GetSupportsStarredMessages() bool { + if x != nil && x.SupportsStarredMessages != nil { + return *x.SupportsStarredMessages + } + return false +} + +func (x *ClientPayload_WebInfo_WebdPayload) GetSupportsDocumentMessages() bool { + if x != nil && x.SupportsDocumentMessages != nil { + return *x.SupportsDocumentMessages + } + return false +} + +func (x *ClientPayload_WebInfo_WebdPayload) GetSupportsUrlMessages() bool { + if x != nil && x.SupportsUrlMessages != nil { + return *x.SupportsUrlMessages + } + return false +} + +func (x *ClientPayload_WebInfo_WebdPayload) GetSupportsMediaRetry() bool { + if x != nil && x.SupportsMediaRetry != nil { + return *x.SupportsMediaRetry + } + return false +} + +func (x *ClientPayload_WebInfo_WebdPayload) GetSupportsE2EImage() bool { + if x != nil && x.SupportsE2EImage != nil { + return *x.SupportsE2EImage + } + return false +} + +func (x *ClientPayload_WebInfo_WebdPayload) GetSupportsE2EVideo() bool { + if x != nil && x.SupportsE2EVideo != nil { + return *x.SupportsE2EVideo + } + return false +} + +func (x *ClientPayload_WebInfo_WebdPayload) GetSupportsE2EAudio() bool { + if x != nil && x.SupportsE2EAudio != nil { + return *x.SupportsE2EAudio + } + return false +} + +func (x *ClientPayload_WebInfo_WebdPayload) GetSupportsE2EDocument() bool { + if x != nil && x.SupportsE2EDocument != nil { + return *x.SupportsE2EDocument + } + return false +} + +func (x *ClientPayload_WebInfo_WebdPayload) GetDocumentTypes() string { + if x != nil && x.DocumentTypes != nil { + return *x.DocumentTypes + } + return "" +} + +func (x *ClientPayload_WebInfo_WebdPayload) GetFeatures() []byte { + if x != nil { + return x.Features + } + return nil +} + +type ClientPayload_UserAgent_AppVersion struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Primary *uint32 `protobuf:"varint,1,opt,name=primary" json:"primary,omitempty"` + Secondary *uint32 `protobuf:"varint,2,opt,name=secondary" json:"secondary,omitempty"` + Tertiary *uint32 `protobuf:"varint,3,opt,name=tertiary" json:"tertiary,omitempty"` + Quaternary *uint32 `protobuf:"varint,4,opt,name=quaternary" json:"quaternary,omitempty"` + Quinary *uint32 `protobuf:"varint,5,opt,name=quinary" json:"quinary,omitempty"` +} + +func (x *ClientPayload_UserAgent_AppVersion) Reset() { + *x = ClientPayload_UserAgent_AppVersion{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[215] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ClientPayload_UserAgent_AppVersion) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClientPayload_UserAgent_AppVersion) ProtoMessage() {} + +func (x *ClientPayload_UserAgent_AppVersion) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[215] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ClientPayload_UserAgent_AppVersion.ProtoReflect.Descriptor instead. +func (*ClientPayload_UserAgent_AppVersion) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{148, 1, 0} +} + +func (x *ClientPayload_UserAgent_AppVersion) GetPrimary() uint32 { + if x != nil && x.Primary != nil { + return *x.Primary + } + return 0 +} + +func (x *ClientPayload_UserAgent_AppVersion) GetSecondary() uint32 { + if x != nil && x.Secondary != nil { + return *x.Secondary + } + return 0 +} + +func (x *ClientPayload_UserAgent_AppVersion) GetTertiary() uint32 { + if x != nil && x.Tertiary != nil { + return *x.Tertiary + } + return 0 +} + +func (x *ClientPayload_UserAgent_AppVersion) GetQuaternary() uint32 { + if x != nil && x.Quaternary != nil { + return *x.Quaternary + } + return 0 +} + +func (x *ClientPayload_UserAgent_AppVersion) GetQuinary() uint32 { + if x != nil && x.Quinary != nil { + return *x.Quinary + } + return 0 +} + +type NoiseCertificate_Details struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Serial *uint32 `protobuf:"varint,1,opt,name=serial" json:"serial,omitempty"` + Issuer *string `protobuf:"bytes,2,opt,name=issuer" json:"issuer,omitempty"` + Expires *uint64 `protobuf:"varint,3,opt,name=expires" json:"expires,omitempty"` + Subject *string `protobuf:"bytes,4,opt,name=subject" json:"subject,omitempty"` + Key []byte `protobuf:"bytes,5,opt,name=key" json:"key,omitempty"` +} + +func (x *NoiseCertificate_Details) Reset() { + *x = NoiseCertificate_Details{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[216] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NoiseCertificate_Details) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NoiseCertificate_Details) ProtoMessage() {} + +func (x *NoiseCertificate_Details) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[216] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NoiseCertificate_Details.ProtoReflect.Descriptor instead. +func (*NoiseCertificate_Details) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{162, 0} +} + +func (x *NoiseCertificate_Details) GetSerial() uint32 { + if x != nil && x.Serial != nil { + return *x.Serial + } + return 0 +} + +func (x *NoiseCertificate_Details) GetIssuer() string { + if x != nil && x.Issuer != nil { + return *x.Issuer + } + return "" +} + +func (x *NoiseCertificate_Details) GetExpires() uint64 { + if x != nil && x.Expires != nil { + return *x.Expires + } + return 0 +} + +func (x *NoiseCertificate_Details) GetSubject() string { + if x != nil && x.Subject != nil { + return *x.Subject + } + return "" +} + +func (x *NoiseCertificate_Details) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +type CertChain_NoiseCertificate struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Details []byte `protobuf:"bytes,1,opt,name=details" json:"details,omitempty"` + Signature []byte `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"` +} + +func (x *CertChain_NoiseCertificate) Reset() { + *x = CertChain_NoiseCertificate{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[217] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CertChain_NoiseCertificate) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CertChain_NoiseCertificate) ProtoMessage() {} + +func (x *CertChain_NoiseCertificate) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[217] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CertChain_NoiseCertificate.ProtoReflect.Descriptor instead. +func (*CertChain_NoiseCertificate) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{163, 0} +} + +func (x *CertChain_NoiseCertificate) GetDetails() []byte { + if x != nil { + return x.Details + } + return nil +} + +func (x *CertChain_NoiseCertificate) GetSignature() []byte { + if x != nil { + return x.Signature + } + return nil +} + +type CertChain_NoiseCertificate_Details struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Serial *uint32 `protobuf:"varint,1,opt,name=serial" json:"serial,omitempty"` + IssuerSerial *uint32 `protobuf:"varint,2,opt,name=issuerSerial" json:"issuerSerial,omitempty"` + Key []byte `protobuf:"bytes,3,opt,name=key" json:"key,omitempty"` + NotBefore *uint64 `protobuf:"varint,4,opt,name=notBefore" json:"notBefore,omitempty"` + NotAfter *uint64 `protobuf:"varint,5,opt,name=notAfter" json:"notAfter,omitempty"` +} + +func (x *CertChain_NoiseCertificate_Details) Reset() { + *x = CertChain_NoiseCertificate_Details{} + if protoimpl.UnsafeEnabled { + mi := &file_binary_proto_def_proto_msgTypes[218] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CertChain_NoiseCertificate_Details) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CertChain_NoiseCertificate_Details) ProtoMessage() {} + +func (x *CertChain_NoiseCertificate_Details) ProtoReflect() protoreflect.Message { + mi := &file_binary_proto_def_proto_msgTypes[218] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CertChain_NoiseCertificate_Details.ProtoReflect.Descriptor instead. +func (*CertChain_NoiseCertificate_Details) Descriptor() ([]byte, []int) { + return file_binary_proto_def_proto_rawDescGZIP(), []int{163, 0, 0} +} + +func (x *CertChain_NoiseCertificate_Details) GetSerial() uint32 { + if x != nil && x.Serial != nil { + return *x.Serial + } + return 0 +} + +func (x *CertChain_NoiseCertificate_Details) GetIssuerSerial() uint32 { + if x != nil && x.IssuerSerial != nil { + return *x.IssuerSerial + } + return 0 +} + +func (x *CertChain_NoiseCertificate_Details) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +func (x *CertChain_NoiseCertificate_Details) GetNotBefore() uint64 { + if x != nil && x.NotBefore != nil { + return *x.NotBefore + } + return 0 +} + +func (x *CertChain_NoiseCertificate_Details) GetNotAfter() uint64 { + if x != nil && x.NotAfter != nil { + return *x.NotAfter + } + return 0 +} + +var File_binary_proto_def_proto protoreflect.FileDescriptor + +//go:embed def.pb.raw +var file_binary_proto_def_proto_rawDesc []byte + +var ( + file_binary_proto_def_proto_rawDescOnce sync.Once + file_binary_proto_def_proto_rawDescData = file_binary_proto_def_proto_rawDesc +) + +func file_binary_proto_def_proto_rawDescGZIP() []byte { + file_binary_proto_def_proto_rawDescOnce.Do(func() { + file_binary_proto_def_proto_rawDescData = protoimpl.X.CompressGZIP(file_binary_proto_def_proto_rawDescData) + }) + return file_binary_proto_def_proto_rawDescData +} + +var file_binary_proto_def_proto_enumTypes = make([]protoimpl.EnumInfo, 54) +var file_binary_proto_def_proto_msgTypes = make([]protoimpl.MessageInfo, 219) +var file_binary_proto_def_proto_goTypes = []interface{}{ + (PeerDataOperationRequestType)(0), // 0: proto.PeerDataOperationRequestType + (KeepType)(0), // 1: proto.KeepType + (MediaVisibility)(0), // 2: proto.MediaVisibility + (DeviceProps_PlatformType)(0), // 3: proto.DeviceProps.PlatformType + (PaymentInviteMessage_ServiceType)(0), // 4: proto.PaymentInviteMessage.ServiceType + (OrderMessage_OrderSurface)(0), // 5: proto.OrderMessage.OrderSurface + (OrderMessage_OrderStatus)(0), // 6: proto.OrderMessage.OrderStatus + (ListResponseMessage_ListType)(0), // 7: proto.ListResponseMessage.ListType + (ListMessage_ListType)(0), // 8: proto.ListMessage.ListType + (InvoiceMessage_AttachmentType)(0), // 9: proto.InvoiceMessage.AttachmentType + (InteractiveMessage_ShopMessage_Surface)(0), // 10: proto.InteractiveMessage.ShopMessage.Surface + (HistorySyncNotification_HistorySyncType)(0), // 11: proto.HistorySyncNotification.HistorySyncType + (HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_DayOfWeekType)(0), // 12: proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.DayOfWeekType + (HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent_CalendarType)(0), // 13: proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.CalendarType + (GroupInviteMessage_GroupType)(0), // 14: proto.GroupInviteMessage.GroupType + (ExtendedTextMessage_PreviewType)(0), // 15: proto.ExtendedTextMessage.PreviewType + (ExtendedTextMessage_InviteLinkGroupType)(0), // 16: proto.ExtendedTextMessage.InviteLinkGroupType + (ExtendedTextMessage_FontType)(0), // 17: proto.ExtendedTextMessage.FontType + (ButtonsResponseMessage_Type)(0), // 18: proto.ButtonsResponseMessage.Type + (ButtonsMessage_HeaderType)(0), // 19: proto.ButtonsMessage.HeaderType + (ButtonsMessage_Button_Type)(0), // 20: proto.ButtonsMessage.Button.Type + (DisappearingMode_Initiator)(0), // 21: proto.DisappearingMode.Initiator + (ContextInfo_ExternalAdReplyInfo_MediaType)(0), // 22: proto.ContextInfo.ExternalAdReplyInfo.MediaType + (ContextInfo_AdReplyInfo_MediaType)(0), // 23: proto.ContextInfo.AdReplyInfo.MediaType + (PaymentBackground_Type)(0), // 24: proto.PaymentBackground.Type + (VideoMessage_Attribution)(0), // 25: proto.VideoMessage.Attribution + (ProtocolMessage_Type)(0), // 26: proto.ProtocolMessage.Type + (PastParticipant_LeaveReason)(0), // 27: proto.PastParticipant.LeaveReason + (HistorySync_HistorySyncType)(0), // 28: proto.HistorySync.HistorySyncType + (GroupParticipant_Rank)(0), // 29: proto.GroupParticipant.Rank + (Conversation_EndOfHistoryTransferType)(0), // 30: proto.Conversation.EndOfHistoryTransferType + (MediaRetryNotification_ResultType)(0), // 31: proto.MediaRetryNotification.ResultType + (SyncdMutation_SyncdOperation)(0), // 32: proto.SyncdMutation.SyncdOperation + (BizIdentityInfo_VerifiedLevelValue)(0), // 33: proto.BizIdentityInfo.VerifiedLevelValue + (BizIdentityInfo_HostStorageType)(0), // 34: proto.BizIdentityInfo.HostStorageType + (BizIdentityInfo_ActualActorsType)(0), // 35: proto.BizIdentityInfo.ActualActorsType + (BizAccountLinkInfo_HostStorageType)(0), // 36: proto.BizAccountLinkInfo.HostStorageType + (BizAccountLinkInfo_AccountType)(0), // 37: proto.BizAccountLinkInfo.AccountType + (ClientPayload_Product)(0), // 38: proto.ClientPayload.Product + (ClientPayload_IOSAppExtension)(0), // 39: proto.ClientPayload.IOSAppExtension + (ClientPayload_ConnectType)(0), // 40: proto.ClientPayload.ConnectType + (ClientPayload_ConnectReason)(0), // 41: proto.ClientPayload.ConnectReason + (ClientPayload_BizMarketSegment)(0), // 42: proto.ClientPayload.BizMarketSegment + (ClientPayload_WebInfo_WebSubPlatform)(0), // 43: proto.ClientPayload.WebInfo.WebSubPlatform + (ClientPayload_UserAgent_ReleaseChannel)(0), // 44: proto.ClientPayload.UserAgent.ReleaseChannel + (ClientPayload_UserAgent_Platform)(0), // 45: proto.ClientPayload.UserAgent.Platform + (ClientPayload_DNSSource_DNSResolutionMethod)(0), // 46: proto.ClientPayload.DNSSource.DNSResolutionMethod + (WebMessageInfo_StubType)(0), // 47: proto.WebMessageInfo.StubType + (WebMessageInfo_Status)(0), // 48: proto.WebMessageInfo.Status + (WebMessageInfo_BizPrivacyStatus)(0), // 49: proto.WebMessageInfo.BizPrivacyStatus + (WebFeatures_Flag)(0), // 50: proto.WebFeatures.Flag + (PaymentInfo_TxnStatus)(0), // 51: proto.PaymentInfo.TxnStatus + (PaymentInfo_Status)(0), // 52: proto.PaymentInfo.Status + (PaymentInfo_Currency)(0), // 53: proto.PaymentInfo.Currency + (*ADVSignedKeyIndexList)(nil), // 54: proto.ADVSignedKeyIndexList + (*ADVSignedDeviceIdentity)(nil), // 55: proto.ADVSignedDeviceIdentity + (*ADVSignedDeviceIdentityHMAC)(nil), // 56: proto.ADVSignedDeviceIdentityHMAC + (*ADVKeyIndexList)(nil), // 57: proto.ADVKeyIndexList + (*ADVDeviceIdentity)(nil), // 58: proto.ADVDeviceIdentity + (*DeviceProps)(nil), // 59: proto.DeviceProps + (*PeerDataOperationRequestResponseMessage)(nil), // 60: proto.PeerDataOperationRequestResponseMessage + (*PeerDataOperationRequestMessage)(nil), // 61: proto.PeerDataOperationRequestMessage + (*PaymentInviteMessage)(nil), // 62: proto.PaymentInviteMessage + (*OrderMessage)(nil), // 63: proto.OrderMessage + (*LocationMessage)(nil), // 64: proto.LocationMessage + (*LiveLocationMessage)(nil), // 65: proto.LiveLocationMessage + (*ListResponseMessage)(nil), // 66: proto.ListResponseMessage + (*ListMessage)(nil), // 67: proto.ListMessage + (*KeepInChatMessage)(nil), // 68: proto.KeepInChatMessage + (*InvoiceMessage)(nil), // 69: proto.InvoiceMessage + (*InteractiveResponseMessage)(nil), // 70: proto.InteractiveResponseMessage + (*InteractiveMessage)(nil), // 71: proto.InteractiveMessage + (*InitialSecurityNotificationSettingSync)(nil), // 72: proto.InitialSecurityNotificationSettingSync + (*ImageMessage)(nil), // 73: proto.ImageMessage + (*HistorySyncNotification)(nil), // 74: proto.HistorySyncNotification + (*HighlyStructuredMessage)(nil), // 75: proto.HighlyStructuredMessage + (*GroupInviteMessage)(nil), // 76: proto.GroupInviteMessage + (*FutureProofMessage)(nil), // 77: proto.FutureProofMessage + (*ExtendedTextMessage)(nil), // 78: proto.ExtendedTextMessage + (*EncReactionMessage)(nil), // 79: proto.EncReactionMessage + (*DocumentMessage)(nil), // 80: proto.DocumentMessage + (*DeviceSentMessage)(nil), // 81: proto.DeviceSentMessage + (*DeclinePaymentRequestMessage)(nil), // 82: proto.DeclinePaymentRequestMessage + (*ContactsArrayMessage)(nil), // 83: proto.ContactsArrayMessage + (*ContactMessage)(nil), // 84: proto.ContactMessage + (*Chat)(nil), // 85: proto.Chat + (*CancelPaymentRequestMessage)(nil), // 86: proto.CancelPaymentRequestMessage + (*Call)(nil), // 87: proto.Call + (*ButtonsResponseMessage)(nil), // 88: proto.ButtonsResponseMessage + (*ButtonsMessage)(nil), // 89: proto.ButtonsMessage + (*AudioMessage)(nil), // 90: proto.AudioMessage + (*AppStateSyncKey)(nil), // 91: proto.AppStateSyncKey + (*AppStateSyncKeyShare)(nil), // 92: proto.AppStateSyncKeyShare + (*AppStateSyncKeyRequest)(nil), // 93: proto.AppStateSyncKeyRequest + (*AppStateSyncKeyId)(nil), // 94: proto.AppStateSyncKeyId + (*AppStateSyncKeyFingerprint)(nil), // 95: proto.AppStateSyncKeyFingerprint + (*AppStateSyncKeyData)(nil), // 96: proto.AppStateSyncKeyData + (*AppStateFatalExceptionNotification)(nil), // 97: proto.AppStateFatalExceptionNotification + (*Location)(nil), // 98: proto.Location + (*InteractiveAnnotation)(nil), // 99: proto.InteractiveAnnotation + (*HydratedTemplateButton)(nil), // 100: proto.HydratedTemplateButton + (*DisappearingMode)(nil), // 101: proto.DisappearingMode + (*DeviceListMetadata)(nil), // 102: proto.DeviceListMetadata + (*ContextInfo)(nil), // 103: proto.ContextInfo + (*ActionLink)(nil), // 104: proto.ActionLink + (*TemplateButton)(nil), // 105: proto.TemplateButton + (*Point)(nil), // 106: proto.Point + (*PaymentBackground)(nil), // 107: proto.PaymentBackground + (*Money)(nil), // 108: proto.Money + (*Message)(nil), // 109: proto.Message + (*MessageContextInfo)(nil), // 110: proto.MessageContextInfo + (*VideoMessage)(nil), // 111: proto.VideoMessage + (*TemplateMessage)(nil), // 112: proto.TemplateMessage + (*TemplateButtonReplyMessage)(nil), // 113: proto.TemplateButtonReplyMessage + (*StickerSyncRMRMessage)(nil), // 114: proto.StickerSyncRMRMessage + (*StickerMessage)(nil), // 115: proto.StickerMessage + (*SenderKeyDistributionMessage)(nil), // 116: proto.SenderKeyDistributionMessage + (*SendPaymentMessage)(nil), // 117: proto.SendPaymentMessage + (*RequestPhoneNumberMessage)(nil), // 118: proto.RequestPhoneNumberMessage + (*RequestPaymentMessage)(nil), // 119: proto.RequestPaymentMessage + (*ReactionMessage)(nil), // 120: proto.ReactionMessage + (*ProtocolMessage)(nil), // 121: proto.ProtocolMessage + (*ProductMessage)(nil), // 122: proto.ProductMessage + (*PollVoteMessage)(nil), // 123: proto.PollVoteMessage + (*PollUpdateMessage)(nil), // 124: proto.PollUpdateMessage + (*PollUpdateMessageMetadata)(nil), // 125: proto.PollUpdateMessageMetadata + (*PollEncValue)(nil), // 126: proto.PollEncValue + (*PollCreationMessage)(nil), // 127: proto.PollCreationMessage + (*EphemeralSetting)(nil), // 128: proto.EphemeralSetting + (*WallpaperSettings)(nil), // 129: proto.WallpaperSettings + (*StickerMetadata)(nil), // 130: proto.StickerMetadata + (*Pushname)(nil), // 131: proto.Pushname + (*PastParticipants)(nil), // 132: proto.PastParticipants + (*PastParticipant)(nil), // 133: proto.PastParticipant + (*HistorySync)(nil), // 134: proto.HistorySync + (*HistorySyncMsg)(nil), // 135: proto.HistorySyncMsg + (*GroupParticipant)(nil), // 136: proto.GroupParticipant + (*GlobalSettings)(nil), // 137: proto.GlobalSettings + (*Conversation)(nil), // 138: proto.Conversation + (*AvatarUserSettings)(nil), // 139: proto.AvatarUserSettings + (*AutoDownloadSettings)(nil), // 140: proto.AutoDownloadSettings + (*MsgRowOpaqueData)(nil), // 141: proto.MsgRowOpaqueData + (*MsgOpaqueData)(nil), // 142: proto.MsgOpaqueData + (*ServerErrorReceipt)(nil), // 143: proto.ServerErrorReceipt + (*MediaRetryNotification)(nil), // 144: proto.MediaRetryNotification + (*MessageKey)(nil), // 145: proto.MessageKey + (*SyncdVersion)(nil), // 146: proto.SyncdVersion + (*SyncdValue)(nil), // 147: proto.SyncdValue + (*SyncdSnapshot)(nil), // 148: proto.SyncdSnapshot + (*SyncdRecord)(nil), // 149: proto.SyncdRecord + (*SyncdPatch)(nil), // 150: proto.SyncdPatch + (*SyncdMutations)(nil), // 151: proto.SyncdMutations + (*SyncdMutation)(nil), // 152: proto.SyncdMutation + (*SyncdIndex)(nil), // 153: proto.SyncdIndex + (*KeyId)(nil), // 154: proto.KeyId + (*ExternalBlobReference)(nil), // 155: proto.ExternalBlobReference + (*ExitCode)(nil), // 156: proto.ExitCode + (*SyncActionValue)(nil), // 157: proto.SyncActionValue + (*UserStatusMuteAction)(nil), // 158: proto.UserStatusMuteAction + (*UnarchiveChatsSetting)(nil), // 159: proto.UnarchiveChatsSetting + (*TimeFormatAction)(nil), // 160: proto.TimeFormatAction + (*SyncActionMessage)(nil), // 161: proto.SyncActionMessage + (*SyncActionMessageRange)(nil), // 162: proto.SyncActionMessageRange + (*SubscriptionAction)(nil), // 163: proto.SubscriptionAction + (*StickerAction)(nil), // 164: proto.StickerAction + (*StarAction)(nil), // 165: proto.StarAction + (*SecurityNotificationSetting)(nil), // 166: proto.SecurityNotificationSetting + (*RemoveRecentStickerAction)(nil), // 167: proto.RemoveRecentStickerAction + (*RecentEmojiWeightsAction)(nil), // 168: proto.RecentEmojiWeightsAction + (*QuickReplyAction)(nil), // 169: proto.QuickReplyAction + (*PushNameSetting)(nil), // 170: proto.PushNameSetting + (*PrimaryVersionAction)(nil), // 171: proto.PrimaryVersionAction + (*PrimaryFeature)(nil), // 172: proto.PrimaryFeature + (*PnForLidChatAction)(nil), // 173: proto.PnForLidChatAction + (*PinAction)(nil), // 174: proto.PinAction + (*NuxAction)(nil), // 175: proto.NuxAction + (*MuteAction)(nil), // 176: proto.MuteAction + (*MarkChatAsReadAction)(nil), // 177: proto.MarkChatAsReadAction + (*LocaleSetting)(nil), // 178: proto.LocaleSetting + (*LabelEditAction)(nil), // 179: proto.LabelEditAction + (*LabelAssociationAction)(nil), // 180: proto.LabelAssociationAction + (*KeyExpiration)(nil), // 181: proto.KeyExpiration + (*DeleteMessageForMeAction)(nil), // 182: proto.DeleteMessageForMeAction + (*DeleteChatAction)(nil), // 183: proto.DeleteChatAction + (*ContactAction)(nil), // 184: proto.ContactAction + (*ClearChatAction)(nil), // 185: proto.ClearChatAction + (*ChatAssignmentOpenedStatusAction)(nil), // 186: proto.ChatAssignmentOpenedStatusAction + (*ChatAssignmentAction)(nil), // 187: proto.ChatAssignmentAction + (*ArchiveChatAction)(nil), // 188: proto.ArchiveChatAction + (*AndroidUnsupportedActions)(nil), // 189: proto.AndroidUnsupportedActions + (*AgentAction)(nil), // 190: proto.AgentAction + (*SyncActionData)(nil), // 191: proto.SyncActionData + (*RecentEmojiWeight)(nil), // 192: proto.RecentEmojiWeight + (*VerifiedNameCertificate)(nil), // 193: proto.VerifiedNameCertificate + (*LocalizedName)(nil), // 194: proto.LocalizedName + (*BizIdentityInfo)(nil), // 195: proto.BizIdentityInfo + (*BizAccountPayload)(nil), // 196: proto.BizAccountPayload + (*BizAccountLinkInfo)(nil), // 197: proto.BizAccountLinkInfo + (*HandshakeMessage)(nil), // 198: proto.HandshakeMessage + (*HandshakeServerHello)(nil), // 199: proto.HandshakeServerHello + (*HandshakeClientHello)(nil), // 200: proto.HandshakeClientHello + (*HandshakeClientFinish)(nil), // 201: proto.HandshakeClientFinish + (*ClientPayload)(nil), // 202: proto.ClientPayload + (*WebNotificationsInfo)(nil), // 203: proto.WebNotificationsInfo + (*WebMessageInfo)(nil), // 204: proto.WebMessageInfo + (*WebFeatures)(nil), // 205: proto.WebFeatures + (*UserReceipt)(nil), // 206: proto.UserReceipt + (*StatusPSA)(nil), // 207: proto.StatusPSA + (*Reaction)(nil), // 208: proto.Reaction + (*PollUpdate)(nil), // 209: proto.PollUpdate + (*PollAdditionalMetadata)(nil), // 210: proto.PollAdditionalMetadata + (*PhotoChange)(nil), // 211: proto.PhotoChange + (*PaymentInfo)(nil), // 212: proto.PaymentInfo + (*NotificationMessageInfo)(nil), // 213: proto.NotificationMessageInfo + (*MediaData)(nil), // 214: proto.MediaData + (*KeepInChat)(nil), // 215: proto.KeepInChat + (*NoiseCertificate)(nil), // 216: proto.NoiseCertificate + (*CertChain)(nil), // 217: proto.CertChain + (*DeviceProps_HistorySyncConfig)(nil), // 218: proto.DeviceProps.HistorySyncConfig + (*DeviceProps_AppVersion)(nil), // 219: proto.DeviceProps.AppVersion + (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult)(nil), // 220: proto.PeerDataOperationRequestResponseMessage.PeerDataOperationResult + (*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse)(nil), // 221: proto.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse + (*PeerDataOperationRequestMessage_RequestUrlPreview)(nil), // 222: proto.PeerDataOperationRequestMessage.RequestUrlPreview + (*PeerDataOperationRequestMessage_RequestStickerReupload)(nil), // 223: proto.PeerDataOperationRequestMessage.RequestStickerReupload + (*ListResponseMessage_SingleSelectReply)(nil), // 224: proto.ListResponseMessage.SingleSelectReply + (*ListMessage_Section)(nil), // 225: proto.ListMessage.Section + (*ListMessage_Row)(nil), // 226: proto.ListMessage.Row + (*ListMessage_Product)(nil), // 227: proto.ListMessage.Product + (*ListMessage_ProductSection)(nil), // 228: proto.ListMessage.ProductSection + (*ListMessage_ProductListInfo)(nil), // 229: proto.ListMessage.ProductListInfo + (*ListMessage_ProductListHeaderImage)(nil), // 230: proto.ListMessage.ProductListHeaderImage + (*InteractiveResponseMessage_NativeFlowResponseMessage)(nil), // 231: proto.InteractiveResponseMessage.NativeFlowResponseMessage + (*InteractiveResponseMessage_Body)(nil), // 232: proto.InteractiveResponseMessage.Body + (*InteractiveMessage_ShopMessage)(nil), // 233: proto.InteractiveMessage.ShopMessage + (*InteractiveMessage_NativeFlowMessage)(nil), // 234: proto.InteractiveMessage.NativeFlowMessage + (*InteractiveMessage_Header)(nil), // 235: proto.InteractiveMessage.Header + (*InteractiveMessage_Footer)(nil), // 236: proto.InteractiveMessage.Footer + (*InteractiveMessage_CollectionMessage)(nil), // 237: proto.InteractiveMessage.CollectionMessage + (*InteractiveMessage_Body)(nil), // 238: proto.InteractiveMessage.Body + (*InteractiveMessage_NativeFlowMessage_NativeFlowButton)(nil), // 239: proto.InteractiveMessage.NativeFlowMessage.NativeFlowButton + (*HighlyStructuredMessage_HSMLocalizableParameter)(nil), // 240: proto.HighlyStructuredMessage.HSMLocalizableParameter + (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime)(nil), // 241: proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime + (*HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency)(nil), // 242: proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency + (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUnixEpoch)(nil), // 243: proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch + (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent)(nil), // 244: proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent + (*ButtonsMessage_Button)(nil), // 245: proto.ButtonsMessage.Button + (*ButtonsMessage_Button_NativeFlowInfo)(nil), // 246: proto.ButtonsMessage.Button.NativeFlowInfo + (*ButtonsMessage_Button_ButtonText)(nil), // 247: proto.ButtonsMessage.Button.ButtonText + (*HydratedTemplateButton_HydratedURLButton)(nil), // 248: proto.HydratedTemplateButton.HydratedURLButton + (*HydratedTemplateButton_HydratedQuickReplyButton)(nil), // 249: proto.HydratedTemplateButton.HydratedQuickReplyButton + (*HydratedTemplateButton_HydratedCallButton)(nil), // 250: proto.HydratedTemplateButton.HydratedCallButton + (*ContextInfo_ExternalAdReplyInfo)(nil), // 251: proto.ContextInfo.ExternalAdReplyInfo + (*ContextInfo_AdReplyInfo)(nil), // 252: proto.ContextInfo.AdReplyInfo + (*TemplateButton_URLButton)(nil), // 253: proto.TemplateButton.URLButton + (*TemplateButton_QuickReplyButton)(nil), // 254: proto.TemplateButton.QuickReplyButton + (*TemplateButton_CallButton)(nil), // 255: proto.TemplateButton.CallButton + (*PaymentBackground_MediaData)(nil), // 256: proto.PaymentBackground.MediaData + (*TemplateMessage_HydratedFourRowTemplate)(nil), // 257: proto.TemplateMessage.HydratedFourRowTemplate + (*TemplateMessage_FourRowTemplate)(nil), // 258: proto.TemplateMessage.FourRowTemplate + (*ProductMessage_ProductSnapshot)(nil), // 259: proto.ProductMessage.ProductSnapshot + (*ProductMessage_CatalogSnapshot)(nil), // 260: proto.ProductMessage.CatalogSnapshot + (*PollCreationMessage_Option)(nil), // 261: proto.PollCreationMessage.Option + (*MsgOpaqueData_PollOption)(nil), // 262: proto.MsgOpaqueData.PollOption + (*VerifiedNameCertificate_Details)(nil), // 263: proto.VerifiedNameCertificate.Details + (*ClientPayload_WebInfo)(nil), // 264: proto.ClientPayload.WebInfo + (*ClientPayload_UserAgent)(nil), // 265: proto.ClientPayload.UserAgent + (*ClientPayload_DevicePairingRegistrationData)(nil), // 266: proto.ClientPayload.DevicePairingRegistrationData + (*ClientPayload_DNSSource)(nil), // 267: proto.ClientPayload.DNSSource + (*ClientPayload_WebInfo_WebdPayload)(nil), // 268: proto.ClientPayload.WebInfo.WebdPayload + (*ClientPayload_UserAgent_AppVersion)(nil), // 269: proto.ClientPayload.UserAgent.AppVersion + (*NoiseCertificate_Details)(nil), // 270: proto.NoiseCertificate.Details + (*CertChain_NoiseCertificate)(nil), // 271: proto.CertChain.NoiseCertificate + (*CertChain_NoiseCertificate_Details)(nil), // 272: proto.CertChain.NoiseCertificate.Details +} +var file_binary_proto_def_proto_depIdxs = []int32{ + 219, // 0: proto.DeviceProps.version:type_name -> proto.DeviceProps.AppVersion + 3, // 1: proto.DeviceProps.platformType:type_name -> proto.DeviceProps.PlatformType + 218, // 2: proto.DeviceProps.historySyncConfig:type_name -> proto.DeviceProps.HistorySyncConfig + 0, // 3: proto.PeerDataOperationRequestResponseMessage.peerDataOperationRequestType:type_name -> proto.PeerDataOperationRequestType + 220, // 4: proto.PeerDataOperationRequestResponseMessage.peerDataOperationResult:type_name -> proto.PeerDataOperationRequestResponseMessage.PeerDataOperationResult + 0, // 5: proto.PeerDataOperationRequestMessage.peerDataOperationRequestType:type_name -> proto.PeerDataOperationRequestType + 223, // 6: proto.PeerDataOperationRequestMessage.requestStickerReupload:type_name -> proto.PeerDataOperationRequestMessage.RequestStickerReupload + 222, // 7: proto.PeerDataOperationRequestMessage.requestUrlPreview:type_name -> proto.PeerDataOperationRequestMessage.RequestUrlPreview + 4, // 8: proto.PaymentInviteMessage.serviceType:type_name -> proto.PaymentInviteMessage.ServiceType + 6, // 9: proto.OrderMessage.status:type_name -> proto.OrderMessage.OrderStatus + 5, // 10: proto.OrderMessage.surface:type_name -> proto.OrderMessage.OrderSurface + 103, // 11: proto.OrderMessage.contextInfo:type_name -> proto.ContextInfo + 103, // 12: proto.LocationMessage.contextInfo:type_name -> proto.ContextInfo + 103, // 13: proto.LiveLocationMessage.contextInfo:type_name -> proto.ContextInfo + 7, // 14: proto.ListResponseMessage.listType:type_name -> proto.ListResponseMessage.ListType + 224, // 15: proto.ListResponseMessage.singleSelectReply:type_name -> proto.ListResponseMessage.SingleSelectReply + 103, // 16: proto.ListResponseMessage.contextInfo:type_name -> proto.ContextInfo + 8, // 17: proto.ListMessage.listType:type_name -> proto.ListMessage.ListType + 225, // 18: proto.ListMessage.sections:type_name -> proto.ListMessage.Section + 229, // 19: proto.ListMessage.productListInfo:type_name -> proto.ListMessage.ProductListInfo + 103, // 20: proto.ListMessage.contextInfo:type_name -> proto.ContextInfo + 145, // 21: proto.KeepInChatMessage.key:type_name -> proto.MessageKey + 1, // 22: proto.KeepInChatMessage.keepType:type_name -> proto.KeepType + 9, // 23: proto.InvoiceMessage.attachmentType:type_name -> proto.InvoiceMessage.AttachmentType + 232, // 24: proto.InteractiveResponseMessage.body:type_name -> proto.InteractiveResponseMessage.Body + 103, // 25: proto.InteractiveResponseMessage.contextInfo:type_name -> proto.ContextInfo + 231, // 26: proto.InteractiveResponseMessage.nativeFlowResponseMessage:type_name -> proto.InteractiveResponseMessage.NativeFlowResponseMessage + 235, // 27: proto.InteractiveMessage.header:type_name -> proto.InteractiveMessage.Header + 238, // 28: proto.InteractiveMessage.body:type_name -> proto.InteractiveMessage.Body + 236, // 29: proto.InteractiveMessage.footer:type_name -> proto.InteractiveMessage.Footer + 103, // 30: proto.InteractiveMessage.contextInfo:type_name -> proto.ContextInfo + 233, // 31: proto.InteractiveMessage.shopStorefrontMessage:type_name -> proto.InteractiveMessage.ShopMessage + 237, // 32: proto.InteractiveMessage.collectionMessage:type_name -> proto.InteractiveMessage.CollectionMessage + 234, // 33: proto.InteractiveMessage.nativeFlowMessage:type_name -> proto.InteractiveMessage.NativeFlowMessage + 99, // 34: proto.ImageMessage.interactiveAnnotations:type_name -> proto.InteractiveAnnotation + 103, // 35: proto.ImageMessage.contextInfo:type_name -> proto.ContextInfo + 11, // 36: proto.HistorySyncNotification.syncType:type_name -> proto.HistorySyncNotification.HistorySyncType + 240, // 37: proto.HighlyStructuredMessage.localizableParams:type_name -> proto.HighlyStructuredMessage.HSMLocalizableParameter + 112, // 38: proto.HighlyStructuredMessage.hydratedHsm:type_name -> proto.TemplateMessage + 103, // 39: proto.GroupInviteMessage.contextInfo:type_name -> proto.ContextInfo + 14, // 40: proto.GroupInviteMessage.groupType:type_name -> proto.GroupInviteMessage.GroupType + 109, // 41: proto.FutureProofMessage.message:type_name -> proto.Message + 17, // 42: proto.ExtendedTextMessage.font:type_name -> proto.ExtendedTextMessage.FontType + 15, // 43: proto.ExtendedTextMessage.previewType:type_name -> proto.ExtendedTextMessage.PreviewType + 103, // 44: proto.ExtendedTextMessage.contextInfo:type_name -> proto.ContextInfo + 16, // 45: proto.ExtendedTextMessage.inviteLinkGroupType:type_name -> proto.ExtendedTextMessage.InviteLinkGroupType + 16, // 46: proto.ExtendedTextMessage.inviteLinkGroupTypeV2:type_name -> proto.ExtendedTextMessage.InviteLinkGroupType + 145, // 47: proto.EncReactionMessage.targetMessageKey:type_name -> proto.MessageKey + 103, // 48: proto.DocumentMessage.contextInfo:type_name -> proto.ContextInfo + 109, // 49: proto.DeviceSentMessage.message:type_name -> proto.Message + 145, // 50: proto.DeclinePaymentRequestMessage.key:type_name -> proto.MessageKey + 84, // 51: proto.ContactsArrayMessage.contacts:type_name -> proto.ContactMessage + 103, // 52: proto.ContactsArrayMessage.contextInfo:type_name -> proto.ContextInfo + 103, // 53: proto.ContactMessage.contextInfo:type_name -> proto.ContextInfo + 145, // 54: proto.CancelPaymentRequestMessage.key:type_name -> proto.MessageKey + 103, // 55: proto.ButtonsResponseMessage.contextInfo:type_name -> proto.ContextInfo + 18, // 56: proto.ButtonsResponseMessage.type:type_name -> proto.ButtonsResponseMessage.Type + 103, // 57: proto.ButtonsMessage.contextInfo:type_name -> proto.ContextInfo + 245, // 58: proto.ButtonsMessage.buttons:type_name -> proto.ButtonsMessage.Button + 19, // 59: proto.ButtonsMessage.headerType:type_name -> proto.ButtonsMessage.HeaderType + 80, // 60: proto.ButtonsMessage.documentMessage:type_name -> proto.DocumentMessage + 73, // 61: proto.ButtonsMessage.imageMessage:type_name -> proto.ImageMessage + 111, // 62: proto.ButtonsMessage.videoMessage:type_name -> proto.VideoMessage + 64, // 63: proto.ButtonsMessage.locationMessage:type_name -> proto.LocationMessage + 103, // 64: proto.AudioMessage.contextInfo:type_name -> proto.ContextInfo + 94, // 65: proto.AppStateSyncKey.keyId:type_name -> proto.AppStateSyncKeyId + 96, // 66: proto.AppStateSyncKey.keyData:type_name -> proto.AppStateSyncKeyData + 91, // 67: proto.AppStateSyncKeyShare.keys:type_name -> proto.AppStateSyncKey + 94, // 68: proto.AppStateSyncKeyRequest.keyIds:type_name -> proto.AppStateSyncKeyId + 95, // 69: proto.AppStateSyncKeyData.fingerprint:type_name -> proto.AppStateSyncKeyFingerprint + 106, // 70: proto.InteractiveAnnotation.polygonVertices:type_name -> proto.Point + 98, // 71: proto.InteractiveAnnotation.location:type_name -> proto.Location + 249, // 72: proto.HydratedTemplateButton.quickReplyButton:type_name -> proto.HydratedTemplateButton.HydratedQuickReplyButton + 248, // 73: proto.HydratedTemplateButton.urlButton:type_name -> proto.HydratedTemplateButton.HydratedURLButton + 250, // 74: proto.HydratedTemplateButton.callButton:type_name -> proto.HydratedTemplateButton.HydratedCallButton + 21, // 75: proto.DisappearingMode.initiator:type_name -> proto.DisappearingMode.Initiator + 109, // 76: proto.ContextInfo.quotedMessage:type_name -> proto.Message + 252, // 77: proto.ContextInfo.quotedAd:type_name -> proto.ContextInfo.AdReplyInfo + 145, // 78: proto.ContextInfo.placeholderKey:type_name -> proto.MessageKey + 251, // 79: proto.ContextInfo.externalAdReply:type_name -> proto.ContextInfo.ExternalAdReplyInfo + 101, // 80: proto.ContextInfo.disappearingMode:type_name -> proto.DisappearingMode + 104, // 81: proto.ContextInfo.actionLink:type_name -> proto.ActionLink + 254, // 82: proto.TemplateButton.quickReplyButton:type_name -> proto.TemplateButton.QuickReplyButton + 253, // 83: proto.TemplateButton.urlButton:type_name -> proto.TemplateButton.URLButton + 255, // 84: proto.TemplateButton.callButton:type_name -> proto.TemplateButton.CallButton + 256, // 85: proto.PaymentBackground.mediaData:type_name -> proto.PaymentBackground.MediaData + 24, // 86: proto.PaymentBackground.type:type_name -> proto.PaymentBackground.Type + 116, // 87: proto.Message.senderKeyDistributionMessage:type_name -> proto.SenderKeyDistributionMessage + 73, // 88: proto.Message.imageMessage:type_name -> proto.ImageMessage + 84, // 89: proto.Message.contactMessage:type_name -> proto.ContactMessage + 64, // 90: proto.Message.locationMessage:type_name -> proto.LocationMessage + 78, // 91: proto.Message.extendedTextMessage:type_name -> proto.ExtendedTextMessage + 80, // 92: proto.Message.documentMessage:type_name -> proto.DocumentMessage + 90, // 93: proto.Message.audioMessage:type_name -> proto.AudioMessage + 111, // 94: proto.Message.videoMessage:type_name -> proto.VideoMessage + 87, // 95: proto.Message.call:type_name -> proto.Call + 85, // 96: proto.Message.chat:type_name -> proto.Chat + 121, // 97: proto.Message.protocolMessage:type_name -> proto.ProtocolMessage + 83, // 98: proto.Message.contactsArrayMessage:type_name -> proto.ContactsArrayMessage + 75, // 99: proto.Message.highlyStructuredMessage:type_name -> proto.HighlyStructuredMessage + 116, // 100: proto.Message.fastRatchetKeySenderKeyDistributionMessage:type_name -> proto.SenderKeyDistributionMessage + 117, // 101: proto.Message.sendPaymentMessage:type_name -> proto.SendPaymentMessage + 65, // 102: proto.Message.liveLocationMessage:type_name -> proto.LiveLocationMessage + 119, // 103: proto.Message.requestPaymentMessage:type_name -> proto.RequestPaymentMessage + 82, // 104: proto.Message.declinePaymentRequestMessage:type_name -> proto.DeclinePaymentRequestMessage + 86, // 105: proto.Message.cancelPaymentRequestMessage:type_name -> proto.CancelPaymentRequestMessage + 112, // 106: proto.Message.templateMessage:type_name -> proto.TemplateMessage + 115, // 107: proto.Message.stickerMessage:type_name -> proto.StickerMessage + 76, // 108: proto.Message.groupInviteMessage:type_name -> proto.GroupInviteMessage + 113, // 109: proto.Message.templateButtonReplyMessage:type_name -> proto.TemplateButtonReplyMessage + 122, // 110: proto.Message.productMessage:type_name -> proto.ProductMessage + 81, // 111: proto.Message.deviceSentMessage:type_name -> proto.DeviceSentMessage + 110, // 112: proto.Message.messageContextInfo:type_name -> proto.MessageContextInfo + 67, // 113: proto.Message.listMessage:type_name -> proto.ListMessage + 77, // 114: proto.Message.viewOnceMessage:type_name -> proto.FutureProofMessage + 63, // 115: proto.Message.orderMessage:type_name -> proto.OrderMessage + 66, // 116: proto.Message.listResponseMessage:type_name -> proto.ListResponseMessage + 77, // 117: proto.Message.ephemeralMessage:type_name -> proto.FutureProofMessage + 69, // 118: proto.Message.invoiceMessage:type_name -> proto.InvoiceMessage + 89, // 119: proto.Message.buttonsMessage:type_name -> proto.ButtonsMessage + 88, // 120: proto.Message.buttonsResponseMessage:type_name -> proto.ButtonsResponseMessage + 62, // 121: proto.Message.paymentInviteMessage:type_name -> proto.PaymentInviteMessage + 71, // 122: proto.Message.interactiveMessage:type_name -> proto.InteractiveMessage + 120, // 123: proto.Message.reactionMessage:type_name -> proto.ReactionMessage + 114, // 124: proto.Message.stickerSyncRmrMessage:type_name -> proto.StickerSyncRMRMessage + 70, // 125: proto.Message.interactiveResponseMessage:type_name -> proto.InteractiveResponseMessage + 127, // 126: proto.Message.pollCreationMessage:type_name -> proto.PollCreationMessage + 124, // 127: proto.Message.pollUpdateMessage:type_name -> proto.PollUpdateMessage + 68, // 128: proto.Message.keepInChatMessage:type_name -> proto.KeepInChatMessage + 77, // 129: proto.Message.documentWithCaptionMessage:type_name -> proto.FutureProofMessage + 118, // 130: proto.Message.requestPhoneNumberMessage:type_name -> proto.RequestPhoneNumberMessage + 77, // 131: proto.Message.viewOnceMessageV2:type_name -> proto.FutureProofMessage + 79, // 132: proto.Message.encReactionMessage:type_name -> proto.EncReactionMessage + 77, // 133: proto.Message.editedMessage:type_name -> proto.FutureProofMessage + 77, // 134: proto.Message.viewOnceMessageV2Extension:type_name -> proto.FutureProofMessage + 127, // 135: proto.Message.pollCreationMessageV2:type_name -> proto.PollCreationMessage + 102, // 136: proto.MessageContextInfo.deviceListMetadata:type_name -> proto.DeviceListMetadata + 99, // 137: proto.VideoMessage.interactiveAnnotations:type_name -> proto.InteractiveAnnotation + 103, // 138: proto.VideoMessage.contextInfo:type_name -> proto.ContextInfo + 25, // 139: proto.VideoMessage.gifAttribution:type_name -> proto.VideoMessage.Attribution + 103, // 140: proto.TemplateMessage.contextInfo:type_name -> proto.ContextInfo + 257, // 141: proto.TemplateMessage.hydratedTemplate:type_name -> proto.TemplateMessage.HydratedFourRowTemplate + 258, // 142: proto.TemplateMessage.fourRowTemplate:type_name -> proto.TemplateMessage.FourRowTemplate + 257, // 143: proto.TemplateMessage.hydratedFourRowTemplate:type_name -> proto.TemplateMessage.HydratedFourRowTemplate + 71, // 144: proto.TemplateMessage.interactiveMessageTemplate:type_name -> proto.InteractiveMessage + 103, // 145: proto.TemplateButtonReplyMessage.contextInfo:type_name -> proto.ContextInfo + 103, // 146: proto.StickerMessage.contextInfo:type_name -> proto.ContextInfo + 109, // 147: proto.SendPaymentMessage.noteMessage:type_name -> proto.Message + 145, // 148: proto.SendPaymentMessage.requestMessageKey:type_name -> proto.MessageKey + 107, // 149: proto.SendPaymentMessage.background:type_name -> proto.PaymentBackground + 103, // 150: proto.RequestPhoneNumberMessage.contextInfo:type_name -> proto.ContextInfo + 109, // 151: proto.RequestPaymentMessage.noteMessage:type_name -> proto.Message + 108, // 152: proto.RequestPaymentMessage.amount:type_name -> proto.Money + 107, // 153: proto.RequestPaymentMessage.background:type_name -> proto.PaymentBackground + 145, // 154: proto.ReactionMessage.key:type_name -> proto.MessageKey + 145, // 155: proto.ProtocolMessage.key:type_name -> proto.MessageKey + 26, // 156: proto.ProtocolMessage.type:type_name -> proto.ProtocolMessage.Type + 74, // 157: proto.ProtocolMessage.historySyncNotification:type_name -> proto.HistorySyncNotification + 92, // 158: proto.ProtocolMessage.appStateSyncKeyShare:type_name -> proto.AppStateSyncKeyShare + 93, // 159: proto.ProtocolMessage.appStateSyncKeyRequest:type_name -> proto.AppStateSyncKeyRequest + 72, // 160: proto.ProtocolMessage.initialSecurityNotificationSettingSync:type_name -> proto.InitialSecurityNotificationSettingSync + 97, // 161: proto.ProtocolMessage.appStateFatalExceptionNotification:type_name -> proto.AppStateFatalExceptionNotification + 101, // 162: proto.ProtocolMessage.disappearingMode:type_name -> proto.DisappearingMode + 109, // 163: proto.ProtocolMessage.editedMessage:type_name -> proto.Message + 61, // 164: proto.ProtocolMessage.peerDataOperationRequestMessage:type_name -> proto.PeerDataOperationRequestMessage + 60, // 165: proto.ProtocolMessage.peerDataOperationRequestResponseMessage:type_name -> proto.PeerDataOperationRequestResponseMessage + 259, // 166: proto.ProductMessage.product:type_name -> proto.ProductMessage.ProductSnapshot + 260, // 167: proto.ProductMessage.catalog:type_name -> proto.ProductMessage.CatalogSnapshot + 103, // 168: proto.ProductMessage.contextInfo:type_name -> proto.ContextInfo + 145, // 169: proto.PollUpdateMessage.pollCreationMessageKey:type_name -> proto.MessageKey + 126, // 170: proto.PollUpdateMessage.vote:type_name -> proto.PollEncValue + 125, // 171: proto.PollUpdateMessage.metadata:type_name -> proto.PollUpdateMessageMetadata + 261, // 172: proto.PollCreationMessage.options:type_name -> proto.PollCreationMessage.Option + 103, // 173: proto.PollCreationMessage.contextInfo:type_name -> proto.ContextInfo + 133, // 174: proto.PastParticipants.pastParticipants:type_name -> proto.PastParticipant + 27, // 175: proto.PastParticipant.leaveReason:type_name -> proto.PastParticipant.LeaveReason + 28, // 176: proto.HistorySync.syncType:type_name -> proto.HistorySync.HistorySyncType + 138, // 177: proto.HistorySync.conversations:type_name -> proto.Conversation + 204, // 178: proto.HistorySync.statusV3Messages:type_name -> proto.WebMessageInfo + 131, // 179: proto.HistorySync.pushnames:type_name -> proto.Pushname + 137, // 180: proto.HistorySync.globalSettings:type_name -> proto.GlobalSettings + 130, // 181: proto.HistorySync.recentStickers:type_name -> proto.StickerMetadata + 132, // 182: proto.HistorySync.pastParticipants:type_name -> proto.PastParticipants + 204, // 183: proto.HistorySyncMsg.message:type_name -> proto.WebMessageInfo + 29, // 184: proto.GroupParticipant.rank:type_name -> proto.GroupParticipant.Rank + 129, // 185: proto.GlobalSettings.lightThemeWallpaper:type_name -> proto.WallpaperSettings + 2, // 186: proto.GlobalSettings.mediaVisibility:type_name -> proto.MediaVisibility + 129, // 187: proto.GlobalSettings.darkThemeWallpaper:type_name -> proto.WallpaperSettings + 140, // 188: proto.GlobalSettings.autoDownloadWiFi:type_name -> proto.AutoDownloadSettings + 140, // 189: proto.GlobalSettings.autoDownloadCellular:type_name -> proto.AutoDownloadSettings + 140, // 190: proto.GlobalSettings.autoDownloadRoaming:type_name -> proto.AutoDownloadSettings + 139, // 191: proto.GlobalSettings.avatarUserSettings:type_name -> proto.AvatarUserSettings + 135, // 192: proto.Conversation.messages:type_name -> proto.HistorySyncMsg + 30, // 193: proto.Conversation.endOfHistoryTransferType:type_name -> proto.Conversation.EndOfHistoryTransferType + 101, // 194: proto.Conversation.disappearingMode:type_name -> proto.DisappearingMode + 136, // 195: proto.Conversation.participant:type_name -> proto.GroupParticipant + 129, // 196: proto.Conversation.wallpaper:type_name -> proto.WallpaperSettings + 2, // 197: proto.Conversation.mediaVisibility:type_name -> proto.MediaVisibility + 142, // 198: proto.MsgRowOpaqueData.currentMsg:type_name -> proto.MsgOpaqueData + 142, // 199: proto.MsgRowOpaqueData.quotedMsg:type_name -> proto.MsgOpaqueData + 262, // 200: proto.MsgOpaqueData.pollOptions:type_name -> proto.MsgOpaqueData.PollOption + 126, // 201: proto.MsgOpaqueData.encPollVote:type_name -> proto.PollEncValue + 31, // 202: proto.MediaRetryNotification.result:type_name -> proto.MediaRetryNotification.ResultType + 146, // 203: proto.SyncdSnapshot.version:type_name -> proto.SyncdVersion + 149, // 204: proto.SyncdSnapshot.records:type_name -> proto.SyncdRecord + 154, // 205: proto.SyncdSnapshot.keyId:type_name -> proto.KeyId + 153, // 206: proto.SyncdRecord.index:type_name -> proto.SyncdIndex + 147, // 207: proto.SyncdRecord.value:type_name -> proto.SyncdValue + 154, // 208: proto.SyncdRecord.keyId:type_name -> proto.KeyId + 146, // 209: proto.SyncdPatch.version:type_name -> proto.SyncdVersion + 152, // 210: proto.SyncdPatch.mutations:type_name -> proto.SyncdMutation + 155, // 211: proto.SyncdPatch.externalMutations:type_name -> proto.ExternalBlobReference + 154, // 212: proto.SyncdPatch.keyId:type_name -> proto.KeyId + 156, // 213: proto.SyncdPatch.exitCode:type_name -> proto.ExitCode + 152, // 214: proto.SyncdMutations.mutations:type_name -> proto.SyncdMutation + 32, // 215: proto.SyncdMutation.operation:type_name -> proto.SyncdMutation.SyncdOperation + 149, // 216: proto.SyncdMutation.record:type_name -> proto.SyncdRecord + 165, // 217: proto.SyncActionValue.starAction:type_name -> proto.StarAction + 184, // 218: proto.SyncActionValue.contactAction:type_name -> proto.ContactAction + 176, // 219: proto.SyncActionValue.muteAction:type_name -> proto.MuteAction + 174, // 220: proto.SyncActionValue.pinAction:type_name -> proto.PinAction + 166, // 221: proto.SyncActionValue.securityNotificationSetting:type_name -> proto.SecurityNotificationSetting + 170, // 222: proto.SyncActionValue.pushNameSetting:type_name -> proto.PushNameSetting + 169, // 223: proto.SyncActionValue.quickReplyAction:type_name -> proto.QuickReplyAction + 168, // 224: proto.SyncActionValue.recentEmojiWeightsAction:type_name -> proto.RecentEmojiWeightsAction + 179, // 225: proto.SyncActionValue.labelEditAction:type_name -> proto.LabelEditAction + 180, // 226: proto.SyncActionValue.labelAssociationAction:type_name -> proto.LabelAssociationAction + 178, // 227: proto.SyncActionValue.localeSetting:type_name -> proto.LocaleSetting + 188, // 228: proto.SyncActionValue.archiveChatAction:type_name -> proto.ArchiveChatAction + 182, // 229: proto.SyncActionValue.deleteMessageForMeAction:type_name -> proto.DeleteMessageForMeAction + 181, // 230: proto.SyncActionValue.keyExpiration:type_name -> proto.KeyExpiration + 177, // 231: proto.SyncActionValue.markChatAsReadAction:type_name -> proto.MarkChatAsReadAction + 185, // 232: proto.SyncActionValue.clearChatAction:type_name -> proto.ClearChatAction + 183, // 233: proto.SyncActionValue.deleteChatAction:type_name -> proto.DeleteChatAction + 159, // 234: proto.SyncActionValue.unarchiveChatsSetting:type_name -> proto.UnarchiveChatsSetting + 172, // 235: proto.SyncActionValue.primaryFeature:type_name -> proto.PrimaryFeature + 189, // 236: proto.SyncActionValue.androidUnsupportedActions:type_name -> proto.AndroidUnsupportedActions + 190, // 237: proto.SyncActionValue.agentAction:type_name -> proto.AgentAction + 163, // 238: proto.SyncActionValue.subscriptionAction:type_name -> proto.SubscriptionAction + 158, // 239: proto.SyncActionValue.userStatusMuteAction:type_name -> proto.UserStatusMuteAction + 160, // 240: proto.SyncActionValue.timeFormatAction:type_name -> proto.TimeFormatAction + 175, // 241: proto.SyncActionValue.nuxAction:type_name -> proto.NuxAction + 171, // 242: proto.SyncActionValue.primaryVersionAction:type_name -> proto.PrimaryVersionAction + 164, // 243: proto.SyncActionValue.stickerAction:type_name -> proto.StickerAction + 167, // 244: proto.SyncActionValue.removeRecentStickerAction:type_name -> proto.RemoveRecentStickerAction + 187, // 245: proto.SyncActionValue.chatAssignment:type_name -> proto.ChatAssignmentAction + 186, // 246: proto.SyncActionValue.chatAssignmentOpenedStatus:type_name -> proto.ChatAssignmentOpenedStatusAction + 173, // 247: proto.SyncActionValue.pnForLidChatAction:type_name -> proto.PnForLidChatAction + 145, // 248: proto.SyncActionMessage.key:type_name -> proto.MessageKey + 161, // 249: proto.SyncActionMessageRange.messages:type_name -> proto.SyncActionMessage + 192, // 250: proto.RecentEmojiWeightsAction.weights:type_name -> proto.RecentEmojiWeight + 162, // 251: proto.MarkChatAsReadAction.messageRange:type_name -> proto.SyncActionMessageRange + 162, // 252: proto.DeleteChatAction.messageRange:type_name -> proto.SyncActionMessageRange + 162, // 253: proto.ClearChatAction.messageRange:type_name -> proto.SyncActionMessageRange + 162, // 254: proto.ArchiveChatAction.messageRange:type_name -> proto.SyncActionMessageRange + 157, // 255: proto.SyncActionData.value:type_name -> proto.SyncActionValue + 33, // 256: proto.BizIdentityInfo.vlevel:type_name -> proto.BizIdentityInfo.VerifiedLevelValue + 193, // 257: proto.BizIdentityInfo.vnameCert:type_name -> proto.VerifiedNameCertificate + 34, // 258: proto.BizIdentityInfo.hostStorage:type_name -> proto.BizIdentityInfo.HostStorageType + 35, // 259: proto.BizIdentityInfo.actualActors:type_name -> proto.BizIdentityInfo.ActualActorsType + 193, // 260: proto.BizAccountPayload.vnameCert:type_name -> proto.VerifiedNameCertificate + 36, // 261: proto.BizAccountLinkInfo.hostStorage:type_name -> proto.BizAccountLinkInfo.HostStorageType + 37, // 262: proto.BizAccountLinkInfo.accountType:type_name -> proto.BizAccountLinkInfo.AccountType + 200, // 263: proto.HandshakeMessage.clientHello:type_name -> proto.HandshakeClientHello + 199, // 264: proto.HandshakeMessage.serverHello:type_name -> proto.HandshakeServerHello + 201, // 265: proto.HandshakeMessage.clientFinish:type_name -> proto.HandshakeClientFinish + 265, // 266: proto.ClientPayload.userAgent:type_name -> proto.ClientPayload.UserAgent + 264, // 267: proto.ClientPayload.webInfo:type_name -> proto.ClientPayload.WebInfo + 40, // 268: proto.ClientPayload.connectType:type_name -> proto.ClientPayload.ConnectType + 41, // 269: proto.ClientPayload.connectReason:type_name -> proto.ClientPayload.ConnectReason + 267, // 270: proto.ClientPayload.dnsSource:type_name -> proto.ClientPayload.DNSSource + 266, // 271: proto.ClientPayload.devicePairingData:type_name -> proto.ClientPayload.DevicePairingRegistrationData + 38, // 272: proto.ClientPayload.product:type_name -> proto.ClientPayload.Product + 39, // 273: proto.ClientPayload.iosAppExtension:type_name -> proto.ClientPayload.IOSAppExtension + 42, // 274: proto.ClientPayload.bizMarketSegment:type_name -> proto.ClientPayload.BizMarketSegment + 204, // 275: proto.WebNotificationsInfo.notifyMessages:type_name -> proto.WebMessageInfo + 145, // 276: proto.WebMessageInfo.key:type_name -> proto.MessageKey + 109, // 277: proto.WebMessageInfo.message:type_name -> proto.Message + 48, // 278: proto.WebMessageInfo.status:type_name -> proto.WebMessageInfo.Status + 47, // 279: proto.WebMessageInfo.messageStubType:type_name -> proto.WebMessageInfo.StubType + 212, // 280: proto.WebMessageInfo.paymentInfo:type_name -> proto.PaymentInfo + 65, // 281: proto.WebMessageInfo.finalLiveLocation:type_name -> proto.LiveLocationMessage + 212, // 282: proto.WebMessageInfo.quotedPaymentInfo:type_name -> proto.PaymentInfo + 49, // 283: proto.WebMessageInfo.bizPrivacyStatus:type_name -> proto.WebMessageInfo.BizPrivacyStatus + 214, // 284: proto.WebMessageInfo.mediaData:type_name -> proto.MediaData + 211, // 285: proto.WebMessageInfo.photoChange:type_name -> proto.PhotoChange + 206, // 286: proto.WebMessageInfo.userReceipt:type_name -> proto.UserReceipt + 208, // 287: proto.WebMessageInfo.reactions:type_name -> proto.Reaction + 214, // 288: proto.WebMessageInfo.quotedStickerData:type_name -> proto.MediaData + 207, // 289: proto.WebMessageInfo.statusPsa:type_name -> proto.StatusPSA + 209, // 290: proto.WebMessageInfo.pollUpdates:type_name -> proto.PollUpdate + 210, // 291: proto.WebMessageInfo.pollAdditionalMetadata:type_name -> proto.PollAdditionalMetadata + 215, // 292: proto.WebMessageInfo.keepInChat:type_name -> proto.KeepInChat + 50, // 293: proto.WebFeatures.labelsDisplay:type_name -> proto.WebFeatures.Flag + 50, // 294: proto.WebFeatures.voipIndividualOutgoing:type_name -> proto.WebFeatures.Flag + 50, // 295: proto.WebFeatures.groupsV3:type_name -> proto.WebFeatures.Flag + 50, // 296: proto.WebFeatures.groupsV3Create:type_name -> proto.WebFeatures.Flag + 50, // 297: proto.WebFeatures.changeNumberV2:type_name -> proto.WebFeatures.Flag + 50, // 298: proto.WebFeatures.queryStatusV3Thumbnail:type_name -> proto.WebFeatures.Flag + 50, // 299: proto.WebFeatures.liveLocations:type_name -> proto.WebFeatures.Flag + 50, // 300: proto.WebFeatures.queryVname:type_name -> proto.WebFeatures.Flag + 50, // 301: proto.WebFeatures.voipIndividualIncoming:type_name -> proto.WebFeatures.Flag + 50, // 302: proto.WebFeatures.quickRepliesQuery:type_name -> proto.WebFeatures.Flag + 50, // 303: proto.WebFeatures.payments:type_name -> proto.WebFeatures.Flag + 50, // 304: proto.WebFeatures.stickerPackQuery:type_name -> proto.WebFeatures.Flag + 50, // 305: proto.WebFeatures.liveLocationsFinal:type_name -> proto.WebFeatures.Flag + 50, // 306: proto.WebFeatures.labelsEdit:type_name -> proto.WebFeatures.Flag + 50, // 307: proto.WebFeatures.mediaUpload:type_name -> proto.WebFeatures.Flag + 50, // 308: proto.WebFeatures.mediaUploadRichQuickReplies:type_name -> proto.WebFeatures.Flag + 50, // 309: proto.WebFeatures.vnameV2:type_name -> proto.WebFeatures.Flag + 50, // 310: proto.WebFeatures.videoPlaybackUrl:type_name -> proto.WebFeatures.Flag + 50, // 311: proto.WebFeatures.statusRanking:type_name -> proto.WebFeatures.Flag + 50, // 312: proto.WebFeatures.voipIndividualVideo:type_name -> proto.WebFeatures.Flag + 50, // 313: proto.WebFeatures.thirdPartyStickers:type_name -> proto.WebFeatures.Flag + 50, // 314: proto.WebFeatures.frequentlyForwardedSetting:type_name -> proto.WebFeatures.Flag + 50, // 315: proto.WebFeatures.groupsV4JoinPermission:type_name -> proto.WebFeatures.Flag + 50, // 316: proto.WebFeatures.recentStickers:type_name -> proto.WebFeatures.Flag + 50, // 317: proto.WebFeatures.catalog:type_name -> proto.WebFeatures.Flag + 50, // 318: proto.WebFeatures.starredStickers:type_name -> proto.WebFeatures.Flag + 50, // 319: proto.WebFeatures.voipGroupCall:type_name -> proto.WebFeatures.Flag + 50, // 320: proto.WebFeatures.templateMessage:type_name -> proto.WebFeatures.Flag + 50, // 321: proto.WebFeatures.templateMessageInteractivity:type_name -> proto.WebFeatures.Flag + 50, // 322: proto.WebFeatures.ephemeralMessages:type_name -> proto.WebFeatures.Flag + 50, // 323: proto.WebFeatures.e2ENotificationSync:type_name -> proto.WebFeatures.Flag + 50, // 324: proto.WebFeatures.recentStickersV2:type_name -> proto.WebFeatures.Flag + 50, // 325: proto.WebFeatures.recentStickersV3:type_name -> proto.WebFeatures.Flag + 50, // 326: proto.WebFeatures.userNotice:type_name -> proto.WebFeatures.Flag + 50, // 327: proto.WebFeatures.support:type_name -> proto.WebFeatures.Flag + 50, // 328: proto.WebFeatures.groupUiiCleanup:type_name -> proto.WebFeatures.Flag + 50, // 329: proto.WebFeatures.groupDogfoodingInternalOnly:type_name -> proto.WebFeatures.Flag + 50, // 330: proto.WebFeatures.settingsSync:type_name -> proto.WebFeatures.Flag + 50, // 331: proto.WebFeatures.archiveV2:type_name -> proto.WebFeatures.Flag + 50, // 332: proto.WebFeatures.ephemeralAllowGroupMembers:type_name -> proto.WebFeatures.Flag + 50, // 333: proto.WebFeatures.ephemeral24HDuration:type_name -> proto.WebFeatures.Flag + 50, // 334: proto.WebFeatures.mdForceUpgrade:type_name -> proto.WebFeatures.Flag + 50, // 335: proto.WebFeatures.disappearingMode:type_name -> proto.WebFeatures.Flag + 50, // 336: proto.WebFeatures.externalMdOptInAvailable:type_name -> proto.WebFeatures.Flag + 50, // 337: proto.WebFeatures.noDeleteMessageTimeLimit:type_name -> proto.WebFeatures.Flag + 145, // 338: proto.Reaction.key:type_name -> proto.MessageKey + 145, // 339: proto.PollUpdate.pollUpdateMessageKey:type_name -> proto.MessageKey + 123, // 340: proto.PollUpdate.vote:type_name -> proto.PollVoteMessage + 53, // 341: proto.PaymentInfo.currencyDeprecated:type_name -> proto.PaymentInfo.Currency + 52, // 342: proto.PaymentInfo.status:type_name -> proto.PaymentInfo.Status + 145, // 343: proto.PaymentInfo.requestMessageKey:type_name -> proto.MessageKey + 51, // 344: proto.PaymentInfo.txnStatus:type_name -> proto.PaymentInfo.TxnStatus + 108, // 345: proto.PaymentInfo.primaryAmount:type_name -> proto.Money + 108, // 346: proto.PaymentInfo.exchangeAmount:type_name -> proto.Money + 145, // 347: proto.NotificationMessageInfo.key:type_name -> proto.MessageKey + 109, // 348: proto.NotificationMessageInfo.message:type_name -> proto.Message + 1, // 349: proto.KeepInChat.keepType:type_name -> proto.KeepType + 145, // 350: proto.KeepInChat.key:type_name -> proto.MessageKey + 271, // 351: proto.CertChain.leaf:type_name -> proto.CertChain.NoiseCertificate + 271, // 352: proto.CertChain.intermediate:type_name -> proto.CertChain.NoiseCertificate + 31, // 353: proto.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.mediaUploadResult:type_name -> proto.MediaRetryNotification.ResultType + 115, // 354: proto.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.stickerMessage:type_name -> proto.StickerMessage + 221, // 355: proto.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.linkPreviewResponse:type_name -> proto.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.LinkPreviewResponse + 226, // 356: proto.ListMessage.Section.rows:type_name -> proto.ListMessage.Row + 227, // 357: proto.ListMessage.ProductSection.products:type_name -> proto.ListMessage.Product + 228, // 358: proto.ListMessage.ProductListInfo.productSections:type_name -> proto.ListMessage.ProductSection + 230, // 359: proto.ListMessage.ProductListInfo.headerImage:type_name -> proto.ListMessage.ProductListHeaderImage + 10, // 360: proto.InteractiveMessage.ShopMessage.surface:type_name -> proto.InteractiveMessage.ShopMessage.Surface + 239, // 361: proto.InteractiveMessage.NativeFlowMessage.buttons:type_name -> proto.InteractiveMessage.NativeFlowMessage.NativeFlowButton + 80, // 362: proto.InteractiveMessage.Header.documentMessage:type_name -> proto.DocumentMessage + 73, // 363: proto.InteractiveMessage.Header.imageMessage:type_name -> proto.ImageMessage + 111, // 364: proto.InteractiveMessage.Header.videoMessage:type_name -> proto.VideoMessage + 242, // 365: proto.HighlyStructuredMessage.HSMLocalizableParameter.currency:type_name -> proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMCurrency + 241, // 366: proto.HighlyStructuredMessage.HSMLocalizableParameter.dateTime:type_name -> proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime + 244, // 367: proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.component:type_name -> proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent + 243, // 368: proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.unixEpoch:type_name -> proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeUnixEpoch + 12, // 369: proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.dayOfWeek:type_name -> proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.DayOfWeekType + 13, // 370: proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.calendar:type_name -> proto.HighlyStructuredMessage.HSMLocalizableParameter.HSMDateTime.HSMDateTimeComponent.CalendarType + 247, // 371: proto.ButtonsMessage.Button.buttonText:type_name -> proto.ButtonsMessage.Button.ButtonText + 20, // 372: proto.ButtonsMessage.Button.type:type_name -> proto.ButtonsMessage.Button.Type + 246, // 373: proto.ButtonsMessage.Button.nativeFlowInfo:type_name -> proto.ButtonsMessage.Button.NativeFlowInfo + 22, // 374: proto.ContextInfo.ExternalAdReplyInfo.mediaType:type_name -> proto.ContextInfo.ExternalAdReplyInfo.MediaType + 23, // 375: proto.ContextInfo.AdReplyInfo.mediaType:type_name -> proto.ContextInfo.AdReplyInfo.MediaType + 75, // 376: proto.TemplateButton.URLButton.displayText:type_name -> proto.HighlyStructuredMessage + 75, // 377: proto.TemplateButton.URLButton.url:type_name -> proto.HighlyStructuredMessage + 75, // 378: proto.TemplateButton.QuickReplyButton.displayText:type_name -> proto.HighlyStructuredMessage + 75, // 379: proto.TemplateButton.CallButton.displayText:type_name -> proto.HighlyStructuredMessage + 75, // 380: proto.TemplateButton.CallButton.phoneNumber:type_name -> proto.HighlyStructuredMessage + 100, // 381: proto.TemplateMessage.HydratedFourRowTemplate.hydratedButtons:type_name -> proto.HydratedTemplateButton + 80, // 382: proto.TemplateMessage.HydratedFourRowTemplate.documentMessage:type_name -> proto.DocumentMessage + 73, // 383: proto.TemplateMessage.HydratedFourRowTemplate.imageMessage:type_name -> proto.ImageMessage + 111, // 384: proto.TemplateMessage.HydratedFourRowTemplate.videoMessage:type_name -> proto.VideoMessage + 64, // 385: proto.TemplateMessage.HydratedFourRowTemplate.locationMessage:type_name -> proto.LocationMessage + 75, // 386: proto.TemplateMessage.FourRowTemplate.content:type_name -> proto.HighlyStructuredMessage + 75, // 387: proto.TemplateMessage.FourRowTemplate.footer:type_name -> proto.HighlyStructuredMessage + 105, // 388: proto.TemplateMessage.FourRowTemplate.buttons:type_name -> proto.TemplateButton + 80, // 389: proto.TemplateMessage.FourRowTemplate.documentMessage:type_name -> proto.DocumentMessage + 75, // 390: proto.TemplateMessage.FourRowTemplate.highlyStructuredMessage:type_name -> proto.HighlyStructuredMessage + 73, // 391: proto.TemplateMessage.FourRowTemplate.imageMessage:type_name -> proto.ImageMessage + 111, // 392: proto.TemplateMessage.FourRowTemplate.videoMessage:type_name -> proto.VideoMessage + 64, // 393: proto.TemplateMessage.FourRowTemplate.locationMessage:type_name -> proto.LocationMessage + 73, // 394: proto.ProductMessage.ProductSnapshot.productImage:type_name -> proto.ImageMessage + 73, // 395: proto.ProductMessage.CatalogSnapshot.catalogImage:type_name -> proto.ImageMessage + 194, // 396: proto.VerifiedNameCertificate.Details.localizedNames:type_name -> proto.LocalizedName + 268, // 397: proto.ClientPayload.WebInfo.webdPayload:type_name -> proto.ClientPayload.WebInfo.WebdPayload + 43, // 398: proto.ClientPayload.WebInfo.webSubPlatform:type_name -> proto.ClientPayload.WebInfo.WebSubPlatform + 45, // 399: proto.ClientPayload.UserAgent.platform:type_name -> proto.ClientPayload.UserAgent.Platform + 269, // 400: proto.ClientPayload.UserAgent.appVersion:type_name -> proto.ClientPayload.UserAgent.AppVersion + 44, // 401: proto.ClientPayload.UserAgent.releaseChannel:type_name -> proto.ClientPayload.UserAgent.ReleaseChannel + 46, // 402: proto.ClientPayload.DNSSource.dnsMethod:type_name -> proto.ClientPayload.DNSSource.DNSResolutionMethod + 403, // [403:403] is the sub-list for method output_type + 403, // [403:403] is the sub-list for method input_type + 403, // [403:403] is the sub-list for extension type_name + 403, // [403:403] is the sub-list for extension extendee + 0, // [0:403] is the sub-list for field type_name +} + +func init() { file_binary_proto_def_proto_init() } +func file_binary_proto_def_proto_init() { + if File_binary_proto_def_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_binary_proto_def_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ADVSignedKeyIndexList); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ADVSignedDeviceIdentity); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ADVSignedDeviceIdentityHMAC); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ADVKeyIndexList); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ADVDeviceIdentity); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeviceProps); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PeerDataOperationRequestResponseMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PeerDataOperationRequestMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PaymentInviteMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OrderMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LocationMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LiveLocationMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListResponseMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KeepInChatMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InvoiceMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InteractiveResponseMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InteractiveMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InitialSecurityNotificationSettingSync); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ImageMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HistorySyncNotification); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HighlyStructuredMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GroupInviteMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FutureProofMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ExtendedTextMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EncReactionMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DocumentMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeviceSentMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeclinePaymentRequestMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ContactsArrayMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ContactMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Chat); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CancelPaymentRequestMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[33].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Call); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ButtonsResponseMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ButtonsMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AudioMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[37].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AppStateSyncKey); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AppStateSyncKeyShare); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AppStateSyncKeyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[40].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AppStateSyncKeyId); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[41].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AppStateSyncKeyFingerprint); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[42].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AppStateSyncKeyData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AppStateFatalExceptionNotification); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[44].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Location); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[45].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InteractiveAnnotation); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[46].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HydratedTemplateButton); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[47].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DisappearingMode); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[48].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeviceListMetadata); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[49].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ContextInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[50].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ActionLink); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[51].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TemplateButton); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[52].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Point); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[53].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PaymentBackground); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[54].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Money); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[55].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Message); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[56].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MessageContextInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[57].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VideoMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[58].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TemplateMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[59].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TemplateButtonReplyMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[60].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StickerSyncRMRMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[61].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StickerMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[62].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SenderKeyDistributionMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[63].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SendPaymentMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[64].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RequestPhoneNumberMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[65].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RequestPaymentMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[66].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ReactionMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[67].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProtocolMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[68].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProductMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[69].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PollVoteMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[70].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PollUpdateMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[71].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PollUpdateMessageMetadata); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[72].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PollEncValue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[73].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PollCreationMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[74].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EphemeralSetting); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[75].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WallpaperSettings); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[76].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StickerMetadata); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[77].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Pushname); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[78].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PastParticipants); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[79].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PastParticipant); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[80].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HistorySync); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[81].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HistorySyncMsg); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[82].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GroupParticipant); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[83].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GlobalSettings); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[84].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Conversation); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[85].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AvatarUserSettings); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[86].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AutoDownloadSettings); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[87].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgRowOpaqueData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[88].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgOpaqueData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[89].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ServerErrorReceipt); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[90].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MediaRetryNotification); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[91].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MessageKey); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[92].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SyncdVersion); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[93].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SyncdValue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[94].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SyncdSnapshot); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[95].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SyncdRecord); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[96].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SyncdPatch); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[97].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SyncdMutations); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[98].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SyncdMutation); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[99].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SyncdIndex); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[100].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KeyId); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[101].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ExternalBlobReference); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[102].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ExitCode); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[103].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SyncActionValue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[104].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserStatusMuteAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[105].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UnarchiveChatsSetting); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[106].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TimeFormatAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[107].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SyncActionMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[108].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SyncActionMessageRange); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[109].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SubscriptionAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[110].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StickerAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[111].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StarAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[112].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SecurityNotificationSetting); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[113].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RemoveRecentStickerAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[114].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RecentEmojiWeightsAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[115].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QuickReplyAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[116].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PushNameSetting); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[117].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PrimaryVersionAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[118].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PrimaryFeature); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[119].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PnForLidChatAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[120].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PinAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[121].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NuxAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[122].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MuteAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[123].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MarkChatAsReadAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[124].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LocaleSetting); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[125].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LabelEditAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[126].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LabelAssociationAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[127].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KeyExpiration); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[128].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteMessageForMeAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[129].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteChatAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[130].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ContactAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[131].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClearChatAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[132].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ChatAssignmentOpenedStatusAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[133].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ChatAssignmentAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[134].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ArchiveChatAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[135].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AndroidUnsupportedActions); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[136].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AgentAction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[137].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SyncActionData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[138].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RecentEmojiWeight); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[139].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VerifiedNameCertificate); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[140].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LocalizedName); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[141].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BizIdentityInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[142].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BizAccountPayload); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[143].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BizAccountLinkInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[144].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HandshakeMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[145].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HandshakeServerHello); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[146].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HandshakeClientHello); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[147].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HandshakeClientFinish); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[148].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClientPayload); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[149].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WebNotificationsInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[150].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WebMessageInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[151].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WebFeatures); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[152].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserReceipt); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[153].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StatusPSA); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[154].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Reaction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[155].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PollUpdate); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[156].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PollAdditionalMetadata); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[157].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PhotoChange); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[158].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PaymentInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[159].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NotificationMessageInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[160].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MediaData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[161].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KeepInChat); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[162].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NoiseCertificate); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[163].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CertChain); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[164].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeviceProps_HistorySyncConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[165].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeviceProps_AppVersion); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[166].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PeerDataOperationRequestResponseMessage_PeerDataOperationResult); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[167].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PeerDataOperationRequestResponseMessage_PeerDataOperationResult_LinkPreviewResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[168].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PeerDataOperationRequestMessage_RequestUrlPreview); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[169].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PeerDataOperationRequestMessage_RequestStickerReupload); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[170].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListResponseMessage_SingleSelectReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[171].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListMessage_Section); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[172].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListMessage_Row); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[173].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListMessage_Product); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[174].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListMessage_ProductSection); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[175].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListMessage_ProductListInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[176].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListMessage_ProductListHeaderImage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[177].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InteractiveResponseMessage_NativeFlowResponseMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[178].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InteractiveResponseMessage_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[179].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InteractiveMessage_ShopMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[180].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InteractiveMessage_NativeFlowMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[181].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InteractiveMessage_Header); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[182].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InteractiveMessage_Footer); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[183].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InteractiveMessage_CollectionMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[184].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InteractiveMessage_Body); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[185].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*InteractiveMessage_NativeFlowMessage_NativeFlowButton); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[186].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HighlyStructuredMessage_HSMLocalizableParameter); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[187].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[188].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HighlyStructuredMessage_HSMLocalizableParameter_HSMCurrency); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[189].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeUnixEpoch); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[190].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_HSMDateTimeComponent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[191].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ButtonsMessage_Button); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[192].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ButtonsMessage_Button_NativeFlowInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[193].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ButtonsMessage_Button_ButtonText); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[194].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HydratedTemplateButton_HydratedURLButton); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[195].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HydratedTemplateButton_HydratedQuickReplyButton); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[196].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HydratedTemplateButton_HydratedCallButton); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[197].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ContextInfo_ExternalAdReplyInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[198].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ContextInfo_AdReplyInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[199].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TemplateButton_URLButton); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[200].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TemplateButton_QuickReplyButton); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[201].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TemplateButton_CallButton); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[202].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PaymentBackground_MediaData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[203].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TemplateMessage_HydratedFourRowTemplate); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[204].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TemplateMessage_FourRowTemplate); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[205].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProductMessage_ProductSnapshot); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[206].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProductMessage_CatalogSnapshot); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[207].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PollCreationMessage_Option); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[208].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgOpaqueData_PollOption); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[209].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VerifiedNameCertificate_Details); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[210].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClientPayload_WebInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[211].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClientPayload_UserAgent); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[212].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClientPayload_DevicePairingRegistrationData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[213].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClientPayload_DNSSource); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[214].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClientPayload_WebInfo_WebdPayload); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[215].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClientPayload_UserAgent_AppVersion); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[216].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NoiseCertificate_Details); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[217].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CertChain_NoiseCertificate); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_binary_proto_def_proto_msgTypes[218].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CertChain_NoiseCertificate_Details); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_binary_proto_def_proto_msgTypes[16].OneofWrappers = []interface{}{ + (*InteractiveResponseMessage_NativeFlowResponseMessage_)(nil), + } + file_binary_proto_def_proto_msgTypes[17].OneofWrappers = []interface{}{ + (*InteractiveMessage_ShopStorefrontMessage)(nil), + (*InteractiveMessage_CollectionMessage_)(nil), + (*InteractiveMessage_NativeFlowMessage_)(nil), + } + file_binary_proto_def_proto_msgTypes[34].OneofWrappers = []interface{}{ + (*ButtonsResponseMessage_SelectedDisplayText)(nil), + } + file_binary_proto_def_proto_msgTypes[35].OneofWrappers = []interface{}{ + (*ButtonsMessage_Text)(nil), + (*ButtonsMessage_DocumentMessage)(nil), + (*ButtonsMessage_ImageMessage)(nil), + (*ButtonsMessage_VideoMessage)(nil), + (*ButtonsMessage_LocationMessage)(nil), + } + file_binary_proto_def_proto_msgTypes[45].OneofWrappers = []interface{}{ + (*InteractiveAnnotation_Location)(nil), + } + file_binary_proto_def_proto_msgTypes[46].OneofWrappers = []interface{}{ + (*HydratedTemplateButton_QuickReplyButton)(nil), + (*HydratedTemplateButton_UrlButton)(nil), + (*HydratedTemplateButton_CallButton)(nil), + } + file_binary_proto_def_proto_msgTypes[51].OneofWrappers = []interface{}{ + (*TemplateButton_QuickReplyButton_)(nil), + (*TemplateButton_UrlButton)(nil), + (*TemplateButton_CallButton_)(nil), + } + file_binary_proto_def_proto_msgTypes[58].OneofWrappers = []interface{}{ + (*TemplateMessage_FourRowTemplate_)(nil), + (*TemplateMessage_HydratedFourRowTemplate_)(nil), + (*TemplateMessage_InteractiveMessageTemplate)(nil), + } + file_binary_proto_def_proto_msgTypes[181].OneofWrappers = []interface{}{ + (*InteractiveMessage_Header_DocumentMessage)(nil), + (*InteractiveMessage_Header_ImageMessage)(nil), + (*InteractiveMessage_Header_JpegThumbnail)(nil), + (*InteractiveMessage_Header_VideoMessage)(nil), + } + file_binary_proto_def_proto_msgTypes[186].OneofWrappers = []interface{}{ + (*HighlyStructuredMessage_HSMLocalizableParameter_Currency)(nil), + (*HighlyStructuredMessage_HSMLocalizableParameter_DateTime)(nil), + } + file_binary_proto_def_proto_msgTypes[187].OneofWrappers = []interface{}{ + (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_Component)(nil), + (*HighlyStructuredMessage_HSMLocalizableParameter_HSMDateTime_UnixEpoch)(nil), + } + file_binary_proto_def_proto_msgTypes[203].OneofWrappers = []interface{}{ + (*TemplateMessage_HydratedFourRowTemplate_DocumentMessage)(nil), + (*TemplateMessage_HydratedFourRowTemplate_HydratedTitleText)(nil), + (*TemplateMessage_HydratedFourRowTemplate_ImageMessage)(nil), + (*TemplateMessage_HydratedFourRowTemplate_VideoMessage)(nil), + (*TemplateMessage_HydratedFourRowTemplate_LocationMessage)(nil), + } + file_binary_proto_def_proto_msgTypes[204].OneofWrappers = []interface{}{ + (*TemplateMessage_FourRowTemplate_DocumentMessage)(nil), + (*TemplateMessage_FourRowTemplate_HighlyStructuredMessage)(nil), + (*TemplateMessage_FourRowTemplate_ImageMessage)(nil), + (*TemplateMessage_FourRowTemplate_VideoMessage)(nil), + (*TemplateMessage_FourRowTemplate_LocationMessage)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_binary_proto_def_proto_rawDesc, + NumEnums: 54, + NumMessages: 219, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_binary_proto_def_proto_goTypes, + DependencyIndexes: file_binary_proto_def_proto_depIdxs, + EnumInfos: file_binary_proto_def_proto_enumTypes, + MessageInfos: file_binary_proto_def_proto_msgTypes, + }.Build() + File_binary_proto_def_proto = out.File + file_binary_proto_def_proto_rawDesc = nil + file_binary_proto_def_proto_goTypes = nil + file_binary_proto_def_proto_depIdxs = nil +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/proto/def.pb.raw b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/proto/def.pb.raw Binary files differnew file mode 100644 index 0000000..52c9695 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/proto/def.pb.raw diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/proto/def.proto b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/proto/def.proto new file mode 100644 index 0000000..b72ab79 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/proto/def.proto @@ -0,0 +1,2391 @@ +syntax = "proto2"; +package proto; + +message ADVSignedKeyIndexList { + optional bytes details = 1; + optional bytes accountSignature = 2; +} + +message ADVSignedDeviceIdentity { + optional bytes details = 1; + optional bytes accountSignatureKey = 2; + optional bytes accountSignature = 3; + optional bytes deviceSignature = 4; +} + +message ADVSignedDeviceIdentityHMAC { + optional bytes details = 1; + optional bytes hmac = 2; +} + +message ADVKeyIndexList { + optional uint32 rawId = 1; + optional uint64 timestamp = 2; + optional uint32 currentIndex = 3; + repeated uint32 validIndexes = 4 [packed=true]; +} + +message ADVDeviceIdentity { + optional uint32 rawId = 1; + optional uint64 timestamp = 2; + optional uint32 keyIndex = 3; +} + +message DeviceProps { + enum PlatformType { + UNKNOWN = 0; + CHROME = 1; + FIREFOX = 2; + IE = 3; + OPERA = 4; + SAFARI = 5; + EDGE = 6; + DESKTOP = 7; + IPAD = 8; + ANDROID_TABLET = 9; + OHANA = 10; + ALOHA = 11; + CATALINA = 12; + TCL_TV = 13; + } + message HistorySyncConfig { + optional uint32 fullSyncDaysLimit = 1; + optional uint32 fullSyncSizeMbLimit = 2; + optional uint32 storageQuotaMb = 3; + } + + message AppVersion { + optional uint32 primary = 1; + optional uint32 secondary = 2; + optional uint32 tertiary = 3; + optional uint32 quaternary = 4; + optional uint32 quinary = 5; + } + + optional string os = 1; + optional AppVersion version = 2; + optional PlatformType platformType = 3; + optional bool requireFullSync = 4; + optional HistorySyncConfig historySyncConfig = 5; +} + +enum PeerDataOperationRequestType { + UPLOAD_STICKER = 0; + SEND_RECENT_STICKER_BOOTSTRAP = 1; + GENERATE_LINK_PREVIEW = 2; +} +message PeerDataOperationRequestResponseMessage { + message PeerDataOperationResult { + message LinkPreviewResponse { + optional string url = 1; + optional string title = 2; + optional string description = 3; + optional bytes thumbData = 4; + optional string canonicalUrl = 5; + optional string matchText = 6; + optional string previewType = 7; + } + + optional MediaRetryNotification.ResultType mediaUploadResult = 1; + optional StickerMessage stickerMessage = 2; + optional LinkPreviewResponse linkPreviewResponse = 3; + } + + optional PeerDataOperationRequestType peerDataOperationRequestType = 1; + optional string stanzaId = 2; + repeated PeerDataOperationResult peerDataOperationResult = 3; +} + +message PeerDataOperationRequestMessage { + message RequestUrlPreview { + optional string url = 1; + } + + message RequestStickerReupload { + optional string fileSha256 = 1; + } + + optional PeerDataOperationRequestType peerDataOperationRequestType = 1; + repeated RequestStickerReupload requestStickerReupload = 2; + repeated RequestUrlPreview requestUrlPreview = 3; +} + +message PaymentInviteMessage { + enum ServiceType { + UNKNOWN = 0; + FBPAY = 1; + NOVI = 2; + UPI = 3; + } + optional ServiceType serviceType = 1; + optional int64 expiryTimestamp = 2; +} + +message OrderMessage { + enum OrderSurface { + CATALOG = 1; + } + enum OrderStatus { + INQUIRY = 1; + } + optional string orderId = 1; + optional bytes thumbnail = 2; + optional int32 itemCount = 3; + optional OrderStatus status = 4; + optional OrderSurface surface = 5; + optional string message = 6; + optional string orderTitle = 7; + optional string sellerJid = 8; + optional string token = 9; + optional int64 totalAmount1000 = 10; + optional string totalCurrencyCode = 11; + 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 bool isLive = 6; + optional uint32 accuracyInMeters = 7; + optional float speedInMps = 8; + optional uint32 degreesClockwiseFromMagneticNorth = 9; + optional string comment = 11; + optional bytes jpegThumbnail = 16; + optional ContextInfo contextInfo = 17; +} + +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 uint32 timeOffset = 8; + optional bytes jpegThumbnail = 16; + optional ContextInfo contextInfo = 17; +} + +message ListResponseMessage { + message SingleSelectReply { + optional string selectedRowId = 1; + } + + enum ListType { + UNKNOWN = 0; + SINGLE_SELECT = 1; + } + optional string title = 1; + optional ListType listType = 2; + optional SingleSelectReply singleSelectReply = 3; + optional ContextInfo contextInfo = 4; + optional string description = 5; +} + +message ListMessage { + message Section { + optional string title = 1; + repeated Row rows = 2; + } + + message Row { + optional string title = 1; + optional string description = 2; + optional string rowId = 3; + } + + message Product { + optional string productId = 1; + } + + message ProductSection { + optional string title = 1; + repeated Product products = 2; + } + + message ProductListInfo { + repeated ProductSection productSections = 1; + optional ProductListHeaderImage headerImage = 2; + optional string businessOwnerJid = 3; + } + + message ProductListHeaderImage { + optional string productId = 1; + optional bytes jpegThumbnail = 2; + } + + enum ListType { + UNKNOWN = 0; + SINGLE_SELECT = 1; + PRODUCT_LIST = 2; + } + optional string title = 1; + optional string description = 2; + optional string buttonText = 3; + optional ListType listType = 4; + repeated Section sections = 5; + optional ProductListInfo productListInfo = 6; + optional string footerText = 7; + optional ContextInfo contextInfo = 8; +} + +message KeepInChatMessage { + optional MessageKey key = 1; + optional KeepType keepType = 2; + optional int64 timestampMs = 3; +} + +message InvoiceMessage { + enum AttachmentType { + IMAGE = 0; + PDF = 1; + } + optional string note = 1; + optional string token = 2; + optional AttachmentType attachmentType = 3; + optional string attachmentMimetype = 4; + optional bytes attachmentMediaKey = 5; + optional int64 attachmentMediaKeyTimestamp = 6; + optional bytes attachmentFileSha256 = 7; + optional bytes attachmentFileEncSha256 = 8; + optional string attachmentDirectPath = 9; + optional bytes attachmentJpegThumbnail = 10; +} + +message InteractiveResponseMessage { + message NativeFlowResponseMessage { + optional string name = 1; + optional string paramsJson = 2; + optional int32 version = 3; + } + + message Body { + optional string text = 1; + } + + optional Body body = 1; + optional ContextInfo contextInfo = 15; + oneof interactiveResponseMessage { + NativeFlowResponseMessage nativeFlowResponseMessage = 2; + } +} + +message InteractiveMessage { + message ShopMessage { + enum Surface { + UNKNOWN_SURFACE = 0; + FB = 1; + IG = 2; + WA = 3; + } + optional string id = 1; + optional Surface surface = 2; + optional int32 messageVersion = 3; + } + + message NativeFlowMessage { + message NativeFlowButton { + optional string name = 1; + optional string buttonParamsJson = 2; + } + + repeated NativeFlowButton buttons = 1; + optional string messageParamsJson = 2; + optional int32 messageVersion = 3; + } + + message Header { + optional string title = 1; + optional string subtitle = 2; + optional bool hasMediaAttachment = 5; + oneof media { + DocumentMessage documentMessage = 3; + ImageMessage imageMessage = 4; + bytes jpegThumbnail = 6; + VideoMessage videoMessage = 7; + } + } + + message Footer { + optional string text = 1; + } + + message CollectionMessage { + optional string bizJid = 1; + optional string id = 2; + optional int32 messageVersion = 3; + } + + message Body { + optional string text = 1; + } + + optional Header header = 1; + optional Body body = 2; + optional Footer footer = 3; + optional ContextInfo contextInfo = 15; + oneof interactiveMessage { + ShopMessage shopStorefrontMessage = 4; + CollectionMessage collectionMessage = 5; + NativeFlowMessage nativeFlowMessage = 6; + } +} + +message InitialSecurityNotificationSettingSync { + optional bool securityNotificationEnabled = 1; +} + +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 int64 mediaKeyTimestamp = 12; + optional bytes jpegThumbnail = 16; + optional ContextInfo contextInfo = 17; + optional bytes firstScanSidecar = 18; + optional uint32 firstScanLength = 19; + optional uint32 experimentGroupId = 20; + optional bytes scansSidecar = 21; + repeated uint32 scanLengths = 22; + optional bytes midQualityFileSha256 = 23; + optional bytes midQualityFileEncSha256 = 24; + optional bool viewOnce = 25; + optional string thumbnailDirectPath = 26; + optional bytes thumbnailSha256 = 27; + optional bytes thumbnailEncSha256 = 28; + optional string staticUrl = 29; +} + +message HistorySyncNotification { + enum HistorySyncType { + INITIAL_BOOTSTRAP = 0; + INITIAL_STATUS_V3 = 1; + FULL = 2; + RECENT = 3; + PUSH_NAME = 4; + NON_BLOCKING_DATA = 5; + } + optional bytes fileSha256 = 1; + optional uint64 fileLength = 2; + optional bytes mediaKey = 3; + optional bytes fileEncSha256 = 4; + optional string directPath = 5; + optional HistorySyncType syncType = 6; + optional uint32 chunkOrder = 7; + optional string originalMessageId = 8; + optional uint32 progress = 9; + optional int64 oldestMsgInChunkTimestampSec = 10; +} + +message HighlyStructuredMessage { + message HSMLocalizableParameter { + message HSMDateTime { + message HSMDateTimeUnixEpoch { + optional int64 timestamp = 1; + } + + message HSMDateTimeComponent { + enum DayOfWeekType { + MONDAY = 1; + TUESDAY = 2; + WEDNESDAY = 3; + THURSDAY = 4; + FRIDAY = 5; + SATURDAY = 6; + SUNDAY = 7; + } + enum CalendarType { + GREGORIAN = 1; + SOLAR_HIJRI = 2; + } + optional DayOfWeekType dayOfWeek = 1; + optional uint32 year = 2; + optional uint32 month = 3; + optional uint32 dayOfMonth = 4; + optional uint32 hour = 5; + optional uint32 minute = 6; + optional CalendarType calendar = 7; + } + + oneof datetimeOneof { + HSMDateTimeComponent component = 1; + HSMDateTimeUnixEpoch unixEpoch = 2; + } + } + + message HSMCurrency { + optional string currencyCode = 1; + optional int64 amount1000 = 2; + } + + optional string default = 1; + oneof paramOneof { + HSMCurrency currency = 2; + HSMDateTime dateTime = 3; + } + } + + optional string namespace = 1; + optional string elementName = 2; + repeated string params = 3; + optional string fallbackLg = 4; + optional string fallbackLc = 5; + repeated HSMLocalizableParameter localizableParams = 6; + optional string deterministicLg = 7; + optional string deterministicLc = 8; + optional TemplateMessage hydratedHsm = 9; +} + +message GroupInviteMessage { + enum GroupType { + DEFAULT = 0; + PARENT = 1; + } + optional string groupJid = 1; + optional string inviteCode = 2; + optional int64 inviteExpiration = 3; + optional string groupName = 4; + optional bytes jpegThumbnail = 5; + optional string caption = 6; + optional ContextInfo contextInfo = 7; + optional GroupType groupType = 8; +} + +message FutureProofMessage { + optional Message message = 1; +} + +message ExtendedTextMessage { + enum PreviewType { + NONE = 0; + VIDEO = 1; + } + enum InviteLinkGroupType { + DEFAULT = 0; + PARENT = 1; + SUB = 2; + DEFAULT_SUB = 3; + } + enum FontType { + SANS_SERIF = 0; + SERIF = 1; + NORICAN_REGULAR = 2; + BRYNDAN_WRITE = 3; + BEBASNEUE_REGULAR = 4; + OSWALD_HEAVY = 5; + } + 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; + optional FontType font = 9; + optional PreviewType previewType = 10; + optional bytes jpegThumbnail = 16; + optional ContextInfo contextInfo = 17; + optional bool doNotPlayInline = 18; + optional string thumbnailDirectPath = 19; + optional bytes thumbnailSha256 = 20; + optional bytes thumbnailEncSha256 = 21; + optional bytes mediaKey = 22; + optional int64 mediaKeyTimestamp = 23; + optional uint32 thumbnailHeight = 24; + optional uint32 thumbnailWidth = 25; + optional InviteLinkGroupType inviteLinkGroupType = 26; + optional string inviteLinkParentGroupSubjectV2 = 27; + optional bytes inviteLinkParentGroupThumbnailV2 = 28; + optional InviteLinkGroupType inviteLinkGroupTypeV2 = 29; + optional bool viewOnce = 30; +} + +message EncReactionMessage { + optional MessageKey targetMessageKey = 1; + optional bytes encPayload = 2; + optional bytes encIv = 3; +} + +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 int64 mediaKeyTimestamp = 11; + optional bool contactVcard = 12; + optional string thumbnailDirectPath = 13; + optional bytes thumbnailSha256 = 14; + optional bytes thumbnailEncSha256 = 15; + optional bytes jpegThumbnail = 16; + optional ContextInfo contextInfo = 17; + optional uint32 thumbnailHeight = 18; + optional uint32 thumbnailWidth = 19; + optional string caption = 20; +} + +message DeviceSentMessage { + optional string destinationJid = 1; + optional Message message = 2; + optional string phash = 3; +} + +message DeclinePaymentRequestMessage { + optional MessageKey key = 1; +} + +message ContactsArrayMessage { + optional string displayName = 1; + repeated ContactMessage contacts = 2; + optional ContextInfo contextInfo = 17; +} + +message ContactMessage { + optional string displayName = 1; + optional string vcard = 16; + optional ContextInfo contextInfo = 17; +} + +message Chat { + optional string displayName = 1; + optional string id = 2; +} + +message CancelPaymentRequestMessage { + optional MessageKey key = 1; +} + +message Call { + optional bytes callKey = 1; + optional string conversionSource = 2; + optional bytes conversionData = 3; + optional uint32 conversionDelaySeconds = 4; +} + +message ButtonsResponseMessage { + enum Type { + UNKNOWN = 0; + DISPLAY_TEXT = 1; + } + optional string selectedButtonId = 1; + optional ContextInfo contextInfo = 3; + optional Type type = 4; + oneof response { + string selectedDisplayText = 2; + } +} + +message ButtonsMessage { + enum HeaderType { + UNKNOWN = 0; + EMPTY = 1; + TEXT = 2; + DOCUMENT = 3; + IMAGE = 4; + VIDEO = 5; + LOCATION = 6; + } + message Button { + enum Type { + UNKNOWN = 0; + RESPONSE = 1; + NATIVE_FLOW = 2; + } + message NativeFlowInfo { + optional string name = 1; + optional string paramsJson = 2; + } + + message ButtonText { + optional string displayText = 1; + } + + optional string buttonId = 1; + optional ButtonText buttonText = 2; + optional Type type = 3; + optional NativeFlowInfo nativeFlowInfo = 4; + } + + optional string contentText = 6; + optional string footerText = 7; + optional ContextInfo contextInfo = 8; + repeated Button buttons = 9; + optional HeaderType headerType = 10; + oneof header { + string text = 1; + DocumentMessage documentMessage = 2; + ImageMessage imageMessage = 3; + VideoMessage videoMessage = 4; + LocationMessage locationMessage = 5; + } +} + +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 int64 mediaKeyTimestamp = 10; + optional ContextInfo contextInfo = 17; + optional bytes streamingSidecar = 18; + optional bytes waveform = 19; + optional fixed32 backgroundArgb = 20; +} + +message AppStateSyncKey { + optional AppStateSyncKeyId keyId = 1; + optional AppStateSyncKeyData keyData = 2; +} + +message AppStateSyncKeyShare { + repeated AppStateSyncKey keys = 1; +} + +message AppStateSyncKeyRequest { + repeated AppStateSyncKeyId keyIds = 1; +} + +message AppStateSyncKeyId { + optional bytes keyId = 1; +} + +message AppStateSyncKeyFingerprint { + optional uint32 rawId = 1; + optional uint32 currentIndex = 2; + repeated uint32 deviceIndexes = 3 [packed=true]; +} + +message AppStateSyncKeyData { + optional bytes keyData = 1; + optional AppStateSyncKeyFingerprint fingerprint = 2; + optional int64 timestamp = 3; +} + +message AppStateFatalExceptionNotification { + repeated string collectionNames = 1; + optional int64 timestamp = 2; +} + +message Location { + optional double degreesLatitude = 1; + optional double degreesLongitude = 2; + optional string name = 3; +} + +enum KeepType { + UNKNOWN = 0; + KEEP_FOR_ALL = 1; + UNDO_KEEP_FOR_ALL = 2; +} +message InteractiveAnnotation { + repeated Point polygonVertices = 1; + oneof action { + Location location = 2; + } +} + +message HydratedTemplateButton { + message HydratedURLButton { + optional string displayText = 1; + optional string url = 2; + } + + message HydratedQuickReplyButton { + optional string displayText = 1; + optional string id = 2; + } + + message HydratedCallButton { + optional string displayText = 1; + optional string phoneNumber = 2; + } + + optional uint32 index = 4; + oneof hydratedButton { + HydratedQuickReplyButton quickReplyButton = 1; + HydratedURLButton urlButton = 2; + HydratedCallButton callButton = 3; + } +} + +message DisappearingMode { + enum Initiator { + CHANGED_IN_CHAT = 0; + INITIATED_BY_ME = 1; + INITIATED_BY_OTHER = 2; + } + optional Initiator initiator = 1; +} + +message DeviceListMetadata { + optional bytes senderKeyHash = 1; + optional uint64 senderTimestamp = 2; + repeated uint32 senderKeyIndexes = 3 [packed=true]; + optional bytes recipientKeyHash = 8; + optional uint64 recipientTimestamp = 9; + repeated uint32 recipientKeyIndexes = 10 [packed=true]; +} + +message ContextInfo { + message ExternalAdReplyInfo { + enum MediaType { + NONE = 0; + IMAGE = 1; + VIDEO = 2; + } + optional string title = 1; + optional string body = 2; + optional MediaType mediaType = 3; + optional string thumbnailUrl = 4; + optional string mediaUrl = 5; + optional bytes thumbnail = 6; + optional string sourceType = 7; + optional string sourceId = 8; + optional string sourceUrl = 9; + optional bool containsAutoReply = 10; + optional bool renderLargerThumbnail = 11; + optional bool showAdAttribution = 12; + optional string ctwaClid = 13; + } + + message AdReplyInfo { + enum MediaType { + NONE = 0; + IMAGE = 1; + VIDEO = 2; + } + optional string advertiserName = 1; + optional MediaType mediaType = 2; + optional bytes jpegThumbnail = 16; + optional string caption = 17; + } + + optional string stanzaId = 1; + optional string participant = 2; + optional Message quotedMessage = 3; + optional string remoteJid = 4; + repeated string mentionedJid = 15; + optional string conversionSource = 18; + optional bytes conversionData = 19; + optional uint32 conversionDelaySeconds = 20; + optional uint32 forwardingScore = 21; + optional bool isForwarded = 22; + optional AdReplyInfo quotedAd = 23; + optional MessageKey placeholderKey = 24; + optional uint32 expiration = 25; + optional int64 ephemeralSettingTimestamp = 26; + optional bytes ephemeralSharedSecret = 27; + optional ExternalAdReplyInfo externalAdReply = 28; + optional string entryPointConversionSource = 29; + optional string entryPointConversionApp = 30; + optional uint32 entryPointConversionDelaySeconds = 31; + optional DisappearingMode disappearingMode = 32; + optional ActionLink actionLink = 33; + optional string groupSubject = 34; + optional string parentGroupJid = 35; + optional string trustBannerType = 37; + optional uint32 trustBannerAction = 38; + optional bool isSampled = 39; +} + +message ActionLink { + optional string url = 1; + optional string buttonTitle = 2; +} + +message TemplateButton { + message URLButton { + optional HighlyStructuredMessage displayText = 1; + optional HighlyStructuredMessage url = 2; + } + + message QuickReplyButton { + optional HighlyStructuredMessage displayText = 1; + optional string id = 2; + } + + message CallButton { + optional HighlyStructuredMessage displayText = 1; + optional HighlyStructuredMessage phoneNumber = 2; + } + + optional uint32 index = 4; + oneof button { + QuickReplyButton quickReplyButton = 1; + URLButton urlButton = 2; + CallButton callButton = 3; + } +} + +message Point { + optional int32 xDeprecated = 1; + optional int32 yDeprecated = 2; + optional double x = 3; + optional double y = 4; +} + +message PaymentBackground { + enum Type { + UNKNOWN = 0; + DEFAULT = 1; + } + message MediaData { + optional bytes mediaKey = 1; + optional int64 mediaKeyTimestamp = 2; + optional bytes fileSha256 = 3; + optional bytes fileEncSha256 = 4; + optional string directPath = 5; + } + + optional string id = 1; + optional uint64 fileLength = 2; + optional uint32 width = 3; + optional uint32 height = 4; + optional string mimetype = 5; + optional fixed32 placeholderArgb = 6; + optional fixed32 textArgb = 7; + optional fixed32 subtextArgb = 8; + optional MediaData mediaData = 9; + optional Type type = 10; +} + +message Money { + optional int64 value = 1; + optional uint32 offset = 2; + optional string currencyCode = 3; +} + +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 LiveLocationMessage liveLocationMessage = 18; + optional RequestPaymentMessage requestPaymentMessage = 22; + optional DeclinePaymentRequestMessage declinePaymentRequestMessage = 23; + optional CancelPaymentRequestMessage cancelPaymentRequestMessage = 24; + optional TemplateMessage templateMessage = 25; + optional StickerMessage stickerMessage = 26; + optional GroupInviteMessage groupInviteMessage = 28; + optional TemplateButtonReplyMessage templateButtonReplyMessage = 29; + optional ProductMessage productMessage = 30; + optional DeviceSentMessage deviceSentMessage = 31; + optional MessageContextInfo messageContextInfo = 35; + optional ListMessage listMessage = 36; + optional FutureProofMessage viewOnceMessage = 37; + optional OrderMessage orderMessage = 38; + optional ListResponseMessage listResponseMessage = 39; + optional FutureProofMessage ephemeralMessage = 40; + optional InvoiceMessage invoiceMessage = 41; + optional ButtonsMessage buttonsMessage = 42; + optional ButtonsResponseMessage buttonsResponseMessage = 43; + optional PaymentInviteMessage paymentInviteMessage = 44; + optional InteractiveMessage interactiveMessage = 45; + optional ReactionMessage reactionMessage = 46; + optional StickerSyncRMRMessage stickerSyncRmrMessage = 47; + optional InteractiveResponseMessage interactiveResponseMessage = 48; + optional PollCreationMessage pollCreationMessage = 49; + optional PollUpdateMessage pollUpdateMessage = 50; + optional KeepInChatMessage keepInChatMessage = 51; + optional FutureProofMessage documentWithCaptionMessage = 53; + optional RequestPhoneNumberMessage requestPhoneNumberMessage = 54; + optional FutureProofMessage viewOnceMessageV2 = 55; + optional EncReactionMessage encReactionMessage = 56; + optional FutureProofMessage editedMessage = 58; + optional FutureProofMessage viewOnceMessageV2Extension = 59; + optional PollCreationMessage pollCreationMessageV2 = 60; +} + +message MessageContextInfo { + optional DeviceListMetadata deviceListMetadata = 1; + optional int32 deviceListMetadataVersion = 2; + optional bytes messageSecret = 3; + optional bytes paddingBytes = 4; +} + +message VideoMessage { + enum Attribution { + NONE = 0; + GIPHY = 1; + TENOR = 2; + } + 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 int64 mediaKeyTimestamp = 14; + optional bytes jpegThumbnail = 16; + optional ContextInfo contextInfo = 17; + optional bytes streamingSidecar = 18; + optional Attribution gifAttribution = 19; + optional bool viewOnce = 20; + optional string thumbnailDirectPath = 21; + optional bytes thumbnailSha256 = 22; + optional bytes thumbnailEncSha256 = 23; + optional string staticUrl = 24; +} + +message TemplateMessage { + message HydratedFourRowTemplate { + optional string hydratedContentText = 6; + optional string hydratedFooterText = 7; + repeated HydratedTemplateButton hydratedButtons = 8; + optional string templateId = 9; + oneof title { + DocumentMessage documentMessage = 1; + string hydratedTitleText = 2; + ImageMessage imageMessage = 3; + VideoMessage videoMessage = 4; + LocationMessage locationMessage = 5; + } + } + + message FourRowTemplate { + optional HighlyStructuredMessage content = 6; + optional HighlyStructuredMessage footer = 7; + repeated TemplateButton buttons = 8; + oneof title { + DocumentMessage documentMessage = 1; + HighlyStructuredMessage highlyStructuredMessage = 2; + ImageMessage imageMessage = 3; + VideoMessage videoMessage = 4; + LocationMessage locationMessage = 5; + } + } + + optional ContextInfo contextInfo = 3; + optional HydratedFourRowTemplate hydratedTemplate = 4; + optional string templateId = 9; + oneof format { + FourRowTemplate fourRowTemplate = 1; + HydratedFourRowTemplate hydratedFourRowTemplate = 2; + InteractiveMessage interactiveMessageTemplate = 5; + } +} + +message TemplateButtonReplyMessage { + optional string selectedId = 1; + optional string selectedDisplayText = 2; + optional ContextInfo contextInfo = 3; + optional uint32 selectedIndex = 4; +} + +message StickerSyncRMRMessage { + repeated string filehash = 1; + optional string rmrSource = 2; + optional int64 requestTimestamp = 3; +} + +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 int64 mediaKeyTimestamp = 10; + optional uint32 firstFrameLength = 11; + optional bytes firstFrameSidecar = 12; + optional bool isAnimated = 13; + optional bytes pngThumbnail = 16; + optional ContextInfo contextInfo = 17; + optional int64 stickerSentTs = 18; + optional bool isAvatar = 19; +} + +message SenderKeyDistributionMessage { + optional string groupId = 1; + optional bytes axolotlSenderKeyDistributionMessage = 2; +} + +message SendPaymentMessage { + optional Message noteMessage = 2; + optional MessageKey requestMessageKey = 3; + optional PaymentBackground background = 4; +} + +message RequestPhoneNumberMessage { + optional ContextInfo contextInfo = 1; +} + +message RequestPaymentMessage { + optional Message noteMessage = 4; + optional string currencyCodeIso4217 = 1; + optional uint64 amount1000 = 2; + optional string requestFrom = 3; + optional int64 expiryTimestamp = 5; + optional Money amount = 6; + optional PaymentBackground background = 7; +} + +message ReactionMessage { + optional MessageKey key = 1; + optional string text = 2; + optional string groupingKey = 3; + optional int64 senderTimestampMs = 4; +} + +message ProtocolMessage { + enum Type { + REVOKE = 0; + EPHEMERAL_SETTING = 3; + EPHEMERAL_SYNC_RESPONSE = 4; + HISTORY_SYNC_NOTIFICATION = 5; + APP_STATE_SYNC_KEY_SHARE = 6; + APP_STATE_SYNC_KEY_REQUEST = 7; + MSG_FANOUT_BACKFILL_REQUEST = 8; + INITIAL_SECURITY_NOTIFICATION_SETTING_SYNC = 9; + APP_STATE_FATAL_EXCEPTION_NOTIFICATION = 10; + SHARE_PHONE_NUMBER = 11; + MESSAGE_EDIT = 14; + PEER_DATA_OPERATION_REQUEST_MESSAGE = 16; + PEER_DATA_OPERATION_REQUEST_RESPONSE_MESSAGE = 17; + } + optional MessageKey key = 1; + optional Type type = 2; + optional uint32 ephemeralExpiration = 4; + optional int64 ephemeralSettingTimestamp = 5; + optional HistorySyncNotification historySyncNotification = 6; + optional AppStateSyncKeyShare appStateSyncKeyShare = 7; + optional AppStateSyncKeyRequest appStateSyncKeyRequest = 8; + optional InitialSecurityNotificationSettingSync initialSecurityNotificationSettingSync = 9; + optional AppStateFatalExceptionNotification appStateFatalExceptionNotification = 10; + optional DisappearingMode disappearingMode = 11; + optional Message editedMessage = 14; + optional int64 timestampMs = 15; + optional PeerDataOperationRequestMessage peerDataOperationRequestMessage = 16; + optional PeerDataOperationRequestResponseMessage peerDataOperationRequestResponseMessage = 17; +} + +message ProductMessage { + message ProductSnapshot { + optional ImageMessage productImage = 1; + optional string productId = 2; + optional string title = 3; + optional string description = 4; + optional string currencyCode = 5; + optional int64 priceAmount1000 = 6; + optional string retailerId = 7; + optional string url = 8; + optional uint32 productImageCount = 9; + optional string firstImageId = 11; + optional int64 salePriceAmount1000 = 12; + } + + message CatalogSnapshot { + optional ImageMessage catalogImage = 1; + optional string title = 2; + optional string description = 3; + } + + optional ProductSnapshot product = 1; + optional string businessOwnerJid = 2; + optional CatalogSnapshot catalog = 4; + optional string body = 5; + optional string footer = 6; + optional ContextInfo contextInfo = 17; +} + +message PollVoteMessage { + repeated bytes selectedOptions = 1; +} + +message PollUpdateMessage { + optional MessageKey pollCreationMessageKey = 1; + optional PollEncValue vote = 2; + optional PollUpdateMessageMetadata metadata = 3; + optional int64 senderTimestampMs = 4; +} + +message PollUpdateMessageMetadata { +} + +message PollEncValue { + optional bytes encPayload = 1; + optional bytes encIv = 2; +} + +message PollCreationMessage { + message Option { + optional string optionName = 1; + } + + optional bytes encKey = 1; + optional string name = 2; + repeated Option options = 3; + optional uint32 selectableOptionsCount = 4; + optional ContextInfo contextInfo = 5; +} + +message EphemeralSetting { + optional sfixed32 duration = 1; + optional sfixed64 timestamp = 2; +} + +message WallpaperSettings { + optional string filename = 1; + optional uint32 opacity = 2; +} + +message StickerMetadata { + 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 float weight = 10; + optional int64 lastStickerSentTs = 11; +} + +message Pushname { + optional string id = 1; + optional string pushname = 2; +} + +message PastParticipants { + optional string groupJid = 1; + repeated PastParticipant pastParticipants = 2; +} + +message PastParticipant { + enum LeaveReason { + LEFT = 0; + REMOVED = 1; + } + optional string userJid = 1; + optional LeaveReason leaveReason = 2; + optional uint64 leaveTs = 3; +} + +enum MediaVisibility { + DEFAULT = 0; + OFF = 1; + ON = 2; +} +message HistorySync { + enum HistorySyncType { + INITIAL_BOOTSTRAP = 0; + INITIAL_STATUS_V3 = 1; + FULL = 2; + RECENT = 3; + PUSH_NAME = 4; + NON_BLOCKING_DATA = 5; + } + required HistorySyncType syncType = 1; + repeated Conversation conversations = 2; + repeated WebMessageInfo statusV3Messages = 3; + optional uint32 chunkOrder = 5; + optional uint32 progress = 6; + repeated Pushname pushnames = 7; + optional GlobalSettings globalSettings = 8; + optional bytes threadIdUserSecret = 9; + optional uint32 threadDsTimeframeOffset = 10; + repeated StickerMetadata recentStickers = 11; + repeated PastParticipants pastParticipants = 12; +} + +message HistorySyncMsg { + optional WebMessageInfo message = 1; + optional uint64 msgOrderId = 2; +} + +message GroupParticipant { + enum Rank { + REGULAR = 0; + ADMIN = 1; + SUPERADMIN = 2; + } + required string userJid = 1; + optional Rank rank = 2; +} + +message GlobalSettings { + optional WallpaperSettings lightThemeWallpaper = 1; + optional MediaVisibility mediaVisibility = 2; + optional WallpaperSettings darkThemeWallpaper = 3; + optional AutoDownloadSettings autoDownloadWiFi = 4; + optional AutoDownloadSettings autoDownloadCellular = 5; + optional AutoDownloadSettings autoDownloadRoaming = 6; + optional bool showIndividualNotificationsPreview = 7; + optional bool showGroupNotificationsPreview = 8; + optional int32 disappearingModeDuration = 9; + optional int64 disappearingModeTimestamp = 10; + optional AvatarUserSettings avatarUserSettings = 11; +} + +message Conversation { + enum EndOfHistoryTransferType { + COMPLETE_BUT_MORE_MESSAGES_REMAIN_ON_PRIMARY = 0; + COMPLETE_AND_NO_MORE_MESSAGE_REMAIN_ON_PRIMARY = 1; + } + required string id = 1; + repeated HistorySyncMsg messages = 2; + optional string newJid = 3; + optional string oldJid = 4; + optional uint64 lastMsgTimestamp = 5; + optional uint32 unreadCount = 6; + optional bool readOnly = 7; + optional bool endOfHistoryTransfer = 8; + optional uint32 ephemeralExpiration = 9; + optional int64 ephemeralSettingTimestamp = 10; + optional EndOfHistoryTransferType endOfHistoryTransferType = 11; + optional uint64 conversationTimestamp = 12; + optional string name = 13; + optional string pHash = 14; + optional bool notSpam = 15; + optional bool archived = 16; + optional DisappearingMode disappearingMode = 17; + optional uint32 unreadMentionCount = 18; + optional bool markedAsUnread = 19; + repeated GroupParticipant participant = 20; + optional bytes tcToken = 21; + optional uint64 tcTokenTimestamp = 22; + optional bytes contactPrimaryIdentityKey = 23; + optional uint32 pinned = 24; + optional uint64 muteEndTime = 25; + optional WallpaperSettings wallpaper = 26; + optional MediaVisibility mediaVisibility = 27; + optional uint64 tcTokenSenderTimestamp = 28; + optional bool suspended = 29; + optional bool terminated = 30; + optional uint64 createdAt = 31; + optional string createdBy = 32; + optional string description = 33; + optional bool support = 34; + optional bool isParentGroup = 35; + optional bool isDefaultSubgroup = 36; + optional string parentGroupId = 37; + optional string displayName = 38; + optional string pnJid = 39; + optional bool shareOwnPn = 40; + optional bool pnhDuplicateLidThread = 41; + optional string lidJid = 42; +} + +message AvatarUserSettings { + optional string fbid = 1; + optional string password = 2; +} + +message AutoDownloadSettings { + optional bool downloadImages = 1; + optional bool downloadAudio = 2; + optional bool downloadVideo = 3; + optional bool downloadDocuments = 4; +} + +// Duplicate type omitted +//message PollEncValue { +// optional bytes encPayload = 1; +// optional bytes encIv = 2; +//} + +message MsgRowOpaqueData { + optional MsgOpaqueData currentMsg = 1; + optional MsgOpaqueData quotedMsg = 2; +} + +message MsgOpaqueData { + message PollOption { + optional string name = 1; + } + + optional string body = 1; + optional string caption = 3; + optional double lng = 5; + optional bool isLive = 6; + optional double lat = 7; + optional int32 paymentAmount1000 = 8; + optional string paymentNoteMsgBody = 9; + optional string canonicalUrl = 10; + optional string matchedText = 11; + optional string title = 12; + optional string description = 13; + optional bytes futureproofBuffer = 14; + optional string clientUrl = 15; + optional string loc = 16; + optional string pollName = 17; + repeated PollOption pollOptions = 18; + optional uint32 pollSelectableOptionsCount = 20; + optional bytes messageSecret = 21; + optional string originalSelfAuthor = 51; + optional int64 senderTimestampMs = 22; + optional string pollUpdateParentKey = 23; + optional PollEncValue encPollVote = 24; + optional bool isSentCagPollCreation = 28; + optional string encReactionTargetMessageKey = 25; + optional bytes encReactionEncPayload = 26; + optional bytes encReactionEncIv = 27; +} + +message ServerErrorReceipt { + optional string stanzaId = 1; +} + +message MediaRetryNotification { + enum ResultType { + GENERAL_ERROR = 0; + SUCCESS = 1; + NOT_FOUND = 2; + DECRYPTION_ERROR = 3; + } + optional string stanzaId = 1; + optional string directPath = 2; + optional ResultType result = 3; +} + +message MessageKey { + optional string remoteJid = 1; + optional bool fromMe = 2; + optional string id = 3; + optional string participant = 4; +} + +// Duplicate type omitted +//message MessageKey { +// optional string remoteJid = 1; +// optional bool fromMe = 2; +// optional string id = 3; +// optional string participant = 4; +//} + +message SyncdVersion { + optional uint64 version = 1; +} + +message SyncdValue { + optional bytes blob = 1; +} + +message SyncdSnapshot { + optional SyncdVersion version = 1; + repeated SyncdRecord records = 2; + optional bytes mac = 3; + optional KeyId keyId = 4; +} + +message SyncdRecord { + optional SyncdIndex index = 1; + optional SyncdValue value = 2; + optional KeyId keyId = 3; +} + +message SyncdPatch { + optional SyncdVersion version = 1; + repeated SyncdMutation mutations = 2; + optional ExternalBlobReference externalMutations = 3; + optional bytes snapshotMac = 4; + optional bytes patchMac = 5; + optional KeyId keyId = 6; + optional ExitCode exitCode = 7; + optional uint32 deviceIndex = 8; +} + +message SyncdMutations { + repeated SyncdMutation mutations = 1; +} + +message SyncdMutation { + enum SyncdOperation { + SET = 0; + REMOVE = 1; + } + optional SyncdOperation operation = 1; + optional SyncdRecord record = 2; +} + +message SyncdIndex { + optional bytes blob = 1; +} + +message KeyId { + optional bytes id = 1; +} + +message ExternalBlobReference { + optional bytes mediaKey = 1; + optional string directPath = 2; + optional string handle = 3; + optional uint64 fileSizeBytes = 4; + optional bytes fileSha256 = 5; + optional bytes fileEncSha256 = 6; +} + +message ExitCode { + optional uint64 code = 1; + optional string text = 2; +} + +message SyncActionValue { + optional int64 timestamp = 1; + optional StarAction starAction = 2; + optional ContactAction contactAction = 3; + optional MuteAction muteAction = 4; + optional PinAction pinAction = 5; + optional SecurityNotificationSetting securityNotificationSetting = 6; + optional PushNameSetting pushNameSetting = 7; + optional QuickReplyAction quickReplyAction = 8; + optional RecentEmojiWeightsAction recentEmojiWeightsAction = 11; + optional LabelEditAction labelEditAction = 14; + optional LabelAssociationAction labelAssociationAction = 15; + optional LocaleSetting localeSetting = 16; + optional ArchiveChatAction archiveChatAction = 17; + optional DeleteMessageForMeAction deleteMessageForMeAction = 18; + optional KeyExpiration keyExpiration = 19; + optional MarkChatAsReadAction markChatAsReadAction = 20; + optional ClearChatAction clearChatAction = 21; + optional DeleteChatAction deleteChatAction = 22; + optional UnarchiveChatsSetting unarchiveChatsSetting = 23; + optional PrimaryFeature primaryFeature = 24; + optional AndroidUnsupportedActions androidUnsupportedActions = 26; + optional AgentAction agentAction = 27; + optional SubscriptionAction subscriptionAction = 28; + optional UserStatusMuteAction userStatusMuteAction = 29; + optional TimeFormatAction timeFormatAction = 30; + optional NuxAction nuxAction = 31; + optional PrimaryVersionAction primaryVersionAction = 32; + optional StickerAction stickerAction = 33; + optional RemoveRecentStickerAction removeRecentStickerAction = 34; + optional ChatAssignmentAction chatAssignment = 35; + optional ChatAssignmentOpenedStatusAction chatAssignmentOpenedStatus = 36; + optional PnForLidChatAction pnForLidChatAction = 37; +} + +message UserStatusMuteAction { + optional bool muted = 1; +} + +message UnarchiveChatsSetting { + optional bool unarchiveChats = 1; +} + +message TimeFormatAction { + optional bool isTwentyFourHourFormatEnabled = 1; +} + +message SyncActionMessage { + optional MessageKey key = 1; + optional int64 timestamp = 2; +} + +message SyncActionMessageRange { + optional int64 lastMessageTimestamp = 1; + optional int64 lastSystemMessageTimestamp = 2; + repeated SyncActionMessage messages = 3; +} + +message SubscriptionAction { + optional bool isDeactivated = 1; + optional bool isAutoRenewing = 2; + optional int64 expirationDate = 3; +} + +message StickerAction { + optional string url = 1; + optional bytes fileEncSha256 = 2; + optional bytes mediaKey = 3; + optional string mimetype = 4; + optional uint32 height = 5; + optional uint32 width = 6; + optional string directPath = 7; + optional uint64 fileLength = 8; + optional bool isFavorite = 9; + optional uint32 deviceIdHint = 10; +} + +message StarAction { + optional bool starred = 1; +} + +message SecurityNotificationSetting { + optional bool showNotification = 1; +} + +message RemoveRecentStickerAction { + optional int64 lastStickerSentTs = 1; +} + +message RecentEmojiWeightsAction { + repeated RecentEmojiWeight weights = 1; +} + +message QuickReplyAction { + optional string shortcut = 1; + optional string message = 2; + repeated string keywords = 3; + optional int32 count = 4; + optional bool deleted = 5; +} + +message PushNameSetting { + optional string name = 1; +} + +message PrimaryVersionAction { + optional string version = 1; +} + +message PrimaryFeature { + repeated string flags = 1; +} + +message PnForLidChatAction { + optional string pnJid = 1; +} + +message PinAction { + optional bool pinned = 1; +} + +message NuxAction { + optional bool acknowledged = 1; +} + +message MuteAction { + optional bool muted = 1; + optional int64 muteEndTimestamp = 2; + optional bool autoMuted = 3; +} + +message MarkChatAsReadAction { + optional bool read = 1; + optional SyncActionMessageRange messageRange = 2; +} + +message LocaleSetting { + optional string locale = 1; +} + +message LabelEditAction { + optional string name = 1; + optional int32 color = 2; + optional int32 predefinedId = 3; + optional bool deleted = 4; +} + +message LabelAssociationAction { + optional bool labeled = 1; +} + +message KeyExpiration { + optional int32 expiredKeyEpoch = 1; +} + +message DeleteMessageForMeAction { + optional bool deleteMedia = 1; + optional int64 messageTimestamp = 2; +} + +message DeleteChatAction { + optional SyncActionMessageRange messageRange = 1; +} + +message ContactAction { + optional string fullName = 1; + optional string firstName = 2; + optional string lidJid = 3; +} + +message ClearChatAction { + optional SyncActionMessageRange messageRange = 1; +} + +message ChatAssignmentOpenedStatusAction { + optional bool chatOpened = 1; +} + +message ChatAssignmentAction { + optional string deviceAgentID = 1; +} + +message ArchiveChatAction { + optional bool archived = 1; + optional SyncActionMessageRange messageRange = 2; +} + +message AndroidUnsupportedActions { + optional bool allowed = 1; +} + +message AgentAction { + optional string name = 1; + optional int32 deviceID = 2; + optional bool isDeleted = 3; +} + +message SyncActionData { + optional bytes index = 1; + optional SyncActionValue value = 2; + optional bytes padding = 3; + optional int32 version = 4; +} + +message RecentEmojiWeight { + optional string emoji = 1; + optional float weight = 2; +} + +message VerifiedNameCertificate { + message Details { + optional uint64 serial = 1; + optional string issuer = 2; + optional string verifiedName = 4; + repeated LocalizedName localizedNames = 8; + optional uint64 issueTime = 10; + } + + optional bytes details = 1; + optional bytes signature = 2; + optional bytes serverSignature = 3; +} + +message LocalizedName { + optional string lg = 1; + optional string lc = 2; + optional string verifiedName = 3; +} + +message BizIdentityInfo { + enum VerifiedLevelValue { + UNKNOWN = 0; + LOW = 1; + HIGH = 2; + } + enum HostStorageType { + ON_PREMISE = 0; + FACEBOOK = 1; + } + enum ActualActorsType { + SELF = 0; + BSP = 1; + } + optional VerifiedLevelValue vlevel = 1; + optional VerifiedNameCertificate vnameCert = 2; + optional bool signed = 3; + optional bool revoked = 4; + optional HostStorageType hostStorage = 5; + optional ActualActorsType actualActors = 6; + optional uint64 privacyModeTs = 7; + optional uint64 featureControls = 8; +} + +message BizAccountPayload { + optional VerifiedNameCertificate vnameCert = 1; + optional bytes bizAcctLinkInfo = 2; +} + +message BizAccountLinkInfo { + enum HostStorageType { + ON_PREMISE = 0; + FACEBOOK = 1; + } + enum AccountType { + ENTERPRISE = 0; + } + optional uint64 whatsappBizAcctFbid = 1; + optional string whatsappAcctNumber = 2; + optional uint64 issueTime = 3; + optional HostStorageType hostStorage = 4; + optional AccountType accountType = 5; +} + +message HandshakeMessage { + optional HandshakeClientHello clientHello = 2; + optional HandshakeServerHello serverHello = 3; + optional HandshakeClientFinish clientFinish = 4; +} + +message HandshakeServerHello { + optional bytes ephemeral = 1; + optional bytes static = 2; + optional bytes payload = 3; +} + +message HandshakeClientHello { + optional bytes ephemeral = 1; + optional bytes static = 2; + optional bytes payload = 3; +} + +message HandshakeClientFinish { + optional bytes static = 1; + optional bytes payload = 2; +} + +message ClientPayload { + message WebInfo { + message WebdPayload { + optional bool usesParticipantInKey = 1; + optional bool supportsStarredMessages = 2; + optional bool supportsDocumentMessages = 3; + optional bool supportsUrlMessages = 4; + optional bool supportsMediaRetry = 5; + optional bool supportsE2EImage = 6; + optional bool supportsE2EVideo = 7; + optional bool supportsE2EAudio = 8; + optional bool supportsE2EDocument = 9; + optional string documentTypes = 10; + optional bytes features = 11; + } + + enum WebSubPlatform { + WEB_BROWSER = 0; + APP_STORE = 1; + WIN_STORE = 2; + DARWIN = 3; + WIN32 = 4; + } + optional string refToken = 1; + optional string version = 2; + optional WebdPayload webdPayload = 3; + optional WebSubPlatform webSubPlatform = 4; + } + + message UserAgent { + enum ReleaseChannel { + RELEASE = 0; + BETA = 1; + ALPHA = 2; + DEBUG = 3; + } + enum Platform { + ANDROID = 0; + IOS = 1; + WINDOWS_PHONE = 2; + BLACKBERRY = 3; + BLACKBERRYX = 4; + S40 = 5; + S60 = 6; + PYTHON_CLIENT = 7; + TIZEN = 8; + ENTERPRISE = 9; + SMB_ANDROID = 10; + KAIOS = 11; + SMB_IOS = 12; + WINDOWS = 13; + WEB = 14; + PORTAL = 15; + GREEN_ANDROID = 16; + GREEN_IPHONE = 17; + BLUE_ANDROID = 18; + BLUE_IPHONE = 19; + FBLITE_ANDROID = 20; + MLITE_ANDROID = 21; + IGLITE_ANDROID = 22; + PAGE = 23; + MACOS = 24; + OCULUS_MSG = 25; + OCULUS_CALL = 26; + MILAN = 27; + CAPI = 28; + WEAROS = 29; + ARDEVICE = 30; + VRDEVICE = 31; + } + message AppVersion { + optional uint32 primary = 1; + optional uint32 secondary = 2; + optional uint32 tertiary = 3; + optional uint32 quaternary = 4; + optional uint32 quinary = 5; + } + + optional Platform platform = 1; + optional AppVersion appVersion = 2; + optional string mcc = 3; + optional string mnc = 4; + optional string osVersion = 5; + optional string manufacturer = 6; + optional string device = 7; + optional string osBuildNumber = 8; + optional string phoneId = 9; + optional ReleaseChannel releaseChannel = 10; + optional string localeLanguageIso6391 = 11; + optional string localeCountryIso31661Alpha2 = 12; + optional string deviceBoard = 13; + } + + enum Product { + WHATSAPP = 0; + MESSENGER = 1; + } + enum IOSAppExtension { + SHARE_EXTENSION = 0; + SERVICE_EXTENSION = 1; + INTENTS_EXTENSION = 2; + } + message DevicePairingRegistrationData { + optional bytes eRegid = 1; + optional bytes eKeytype = 2; + optional bytes eIdent = 3; + optional bytes eSkeyId = 4; + optional bytes eSkeyVal = 5; + optional bytes eSkeySig = 6; + optional bytes buildHash = 7; + optional bytes deviceProps = 8; + } + + message DNSSource { + enum DNSResolutionMethod { + SYSTEM = 0; + GOOGLE = 1; + HARDCODED = 2; + OVERRIDE = 3; + FALLBACK = 4; + } + optional DNSResolutionMethod dnsMethod = 15; + optional bool appCached = 16; + } + + enum ConnectType { + CELLULAR_UNKNOWN = 0; + WIFI_UNKNOWN = 1; + CELLULAR_EDGE = 100; + CELLULAR_IDEN = 101; + CELLULAR_UMTS = 102; + CELLULAR_EVDO = 103; + CELLULAR_GPRS = 104; + CELLULAR_HSDPA = 105; + CELLULAR_HSUPA = 106; + CELLULAR_HSPA = 107; + CELLULAR_CDMA = 108; + CELLULAR_1XRTT = 109; + CELLULAR_EHRPD = 110; + CELLULAR_LTE = 111; + CELLULAR_HSPAP = 112; + } + enum ConnectReason { + PUSH = 0; + USER_ACTIVATED = 1; + SCHEDULED = 2; + ERROR_RECONNECT = 3; + NETWORK_SWITCH = 4; + PING_RECONNECT = 5; + } + enum BizMarketSegment { + DEFAULT = 0; + DEVX = 1; + INBOX = 2; + } + optional uint64 username = 1; + optional bool passive = 3; + optional UserAgent userAgent = 5; + optional WebInfo webInfo = 6; + optional string pushName = 7; + optional sfixed32 sessionId = 9; + optional bool shortConnect = 10; + optional ConnectType connectType = 12; + optional ConnectReason connectReason = 13; + repeated int32 shards = 14; + optional DNSSource dnsSource = 15; + optional uint32 connectAttemptCount = 16; + optional uint32 device = 18; + optional DevicePairingRegistrationData devicePairingData = 19; + optional Product product = 20; + optional bytes fbCat = 21; + optional bytes fbUserAgent = 22; + optional bool oc = 23; + optional int32 lc = 24; + optional IOSAppExtension iosAppExtension = 30; + optional uint64 fbAppId = 31; + optional bytes fbDeviceId = 32; + optional bool pull = 33; + optional bytes paddingBytes = 34; + optional BizMarketSegment bizMarketSegment = 35; + optional int32 yearClass = 36; + optional int32 memClass = 37; +} + +message WebNotificationsInfo { + optional uint64 timestamp = 2; + optional uint32 unreadChats = 3; + optional uint32 notifyMessageCount = 4; + repeated WebMessageInfo notifyMessages = 5; +} + +message WebMessageInfo { + 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; + GROUP_ANNOUNCE_MODE_MESSAGE_BOUNCE = 44; + CALL_MISSED_GROUP_VOICE = 45; + CALL_MISSED_GROUP_VIDEO = 46; + PAYMENT_CIPHERTEXT = 47; + PAYMENT_FUTUREPROOF = 48; + PAYMENT_TRANSACTION_STATUS_UPDATE_FAILED = 49; + PAYMENT_TRANSACTION_STATUS_UPDATE_REFUNDED = 50; + PAYMENT_TRANSACTION_STATUS_UPDATE_REFUND_FAILED = 51; + PAYMENT_TRANSACTION_STATUS_RECEIVER_PENDING_SETUP = 52; + PAYMENT_TRANSACTION_STATUS_RECEIVER_SUCCESS_AFTER_HICCUP = 53; + PAYMENT_ACTION_ACCOUNT_SETUP_REMINDER = 54; + PAYMENT_ACTION_SEND_PAYMENT_REMINDER = 55; + PAYMENT_ACTION_SEND_PAYMENT_INVITATION = 56; + PAYMENT_ACTION_REQUEST_DECLINED = 57; + PAYMENT_ACTION_REQUEST_EXPIRED = 58; + PAYMENT_ACTION_REQUEST_CANCELLED = 59; + BIZ_VERIFIED_TRANSITION_TOP_TO_BOTTOM = 60; + BIZ_VERIFIED_TRANSITION_BOTTOM_TO_TOP = 61; + BIZ_INTRO_TOP = 62; + BIZ_INTRO_BOTTOM = 63; + BIZ_NAME_CHANGE = 64; + BIZ_MOVE_TO_CONSUMER_APP = 65; + BIZ_TWO_TIER_MIGRATION_TOP = 66; + BIZ_TWO_TIER_MIGRATION_BOTTOM = 67; + OVERSIZED = 68; + GROUP_CHANGE_NO_FREQUENTLY_FORWARDED = 69; + GROUP_V4_ADD_INVITE_SENT = 70; + GROUP_PARTICIPANT_ADD_REQUEST_JOIN = 71; + CHANGE_EPHEMERAL_SETTING = 72; + E2E_DEVICE_CHANGED = 73; + VIEWED_ONCE = 74; + E2E_ENCRYPTED_NOW = 75; + BLUE_MSG_BSP_FB_TO_BSP_PREMISE = 76; + BLUE_MSG_BSP_FB_TO_SELF_FB = 77; + BLUE_MSG_BSP_FB_TO_SELF_PREMISE = 78; + BLUE_MSG_BSP_FB_UNVERIFIED = 79; + BLUE_MSG_BSP_FB_UNVERIFIED_TO_SELF_PREMISE_VERIFIED = 80; + BLUE_MSG_BSP_FB_VERIFIED = 81; + BLUE_MSG_BSP_FB_VERIFIED_TO_SELF_PREMISE_UNVERIFIED = 82; + BLUE_MSG_BSP_PREMISE_TO_SELF_PREMISE = 83; + BLUE_MSG_BSP_PREMISE_UNVERIFIED = 84; + BLUE_MSG_BSP_PREMISE_UNVERIFIED_TO_SELF_PREMISE_VERIFIED = 85; + BLUE_MSG_BSP_PREMISE_VERIFIED = 86; + BLUE_MSG_BSP_PREMISE_VERIFIED_TO_SELF_PREMISE_UNVERIFIED = 87; + BLUE_MSG_CONSUMER_TO_BSP_FB_UNVERIFIED = 88; + BLUE_MSG_CONSUMER_TO_BSP_PREMISE_UNVERIFIED = 89; + BLUE_MSG_CONSUMER_TO_SELF_FB_UNVERIFIED = 90; + BLUE_MSG_CONSUMER_TO_SELF_PREMISE_UNVERIFIED = 91; + BLUE_MSG_SELF_FB_TO_BSP_PREMISE = 92; + BLUE_MSG_SELF_FB_TO_SELF_PREMISE = 93; + BLUE_MSG_SELF_FB_UNVERIFIED = 94; + BLUE_MSG_SELF_FB_UNVERIFIED_TO_SELF_PREMISE_VERIFIED = 95; + BLUE_MSG_SELF_FB_VERIFIED = 96; + BLUE_MSG_SELF_FB_VERIFIED_TO_SELF_PREMISE_UNVERIFIED = 97; + BLUE_MSG_SELF_PREMISE_TO_BSP_PREMISE = 98; + BLUE_MSG_SELF_PREMISE_UNVERIFIED = 99; + BLUE_MSG_SELF_PREMISE_VERIFIED = 100; + BLUE_MSG_TO_BSP_FB = 101; + BLUE_MSG_TO_CONSUMER = 102; + BLUE_MSG_TO_SELF_FB = 103; + BLUE_MSG_UNVERIFIED_TO_BSP_FB_VERIFIED = 104; + BLUE_MSG_UNVERIFIED_TO_BSP_PREMISE_VERIFIED = 105; + BLUE_MSG_UNVERIFIED_TO_SELF_FB_VERIFIED = 106; + BLUE_MSG_UNVERIFIED_TO_VERIFIED = 107; + BLUE_MSG_VERIFIED_TO_BSP_FB_UNVERIFIED = 108; + BLUE_MSG_VERIFIED_TO_BSP_PREMISE_UNVERIFIED = 109; + BLUE_MSG_VERIFIED_TO_SELF_FB_UNVERIFIED = 110; + BLUE_MSG_VERIFIED_TO_UNVERIFIED = 111; + BLUE_MSG_BSP_FB_UNVERIFIED_TO_BSP_PREMISE_VERIFIED = 112; + BLUE_MSG_BSP_FB_UNVERIFIED_TO_SELF_FB_VERIFIED = 113; + BLUE_MSG_BSP_FB_VERIFIED_TO_BSP_PREMISE_UNVERIFIED = 114; + BLUE_MSG_BSP_FB_VERIFIED_TO_SELF_FB_UNVERIFIED = 115; + BLUE_MSG_SELF_FB_UNVERIFIED_TO_BSP_PREMISE_VERIFIED = 116; + BLUE_MSG_SELF_FB_VERIFIED_TO_BSP_PREMISE_UNVERIFIED = 117; + E2E_IDENTITY_UNAVAILABLE = 118; + GROUP_CREATING = 119; + GROUP_CREATE_FAILED = 120; + GROUP_BOUNCED = 121; + BLOCK_CONTACT = 122; + EPHEMERAL_SETTING_NOT_APPLIED = 123; + SYNC_FAILED = 124; + SYNCING = 125; + BIZ_PRIVACY_MODE_INIT_FB = 126; + BIZ_PRIVACY_MODE_INIT_BSP = 127; + BIZ_PRIVACY_MODE_TO_FB = 128; + BIZ_PRIVACY_MODE_TO_BSP = 129; + DISAPPEARING_MODE = 130; + E2E_DEVICE_FETCH_FAILED = 131; + ADMIN_REVOKE = 132; + GROUP_INVITE_LINK_GROWTH_LOCKED = 133; + COMMUNITY_LINK_PARENT_GROUP = 134; + COMMUNITY_LINK_SIBLING_GROUP = 135; + COMMUNITY_LINK_SUB_GROUP = 136; + COMMUNITY_UNLINK_PARENT_GROUP = 137; + COMMUNITY_UNLINK_SIBLING_GROUP = 138; + COMMUNITY_UNLINK_SUB_GROUP = 139; + GROUP_PARTICIPANT_ACCEPT = 140; + GROUP_PARTICIPANT_LINKED_GROUP_JOIN = 141; + COMMUNITY_CREATE = 142; + EPHEMERAL_KEEP_IN_CHAT = 143; + GROUP_MEMBERSHIP_JOIN_APPROVAL_REQUEST = 144; + GROUP_MEMBERSHIP_JOIN_APPROVAL_MODE = 145; + INTEGRITY_UNLINK_PARENT_GROUP = 146; + COMMUNITY_PARTICIPANT_PROMOTE = 147; + COMMUNITY_PARTICIPANT_DEMOTE = 148; + COMMUNITY_PARENT_GROUP_DELETED = 149; + COMMUNITY_LINK_PARENT_GROUP_MEMBERSHIP_APPROVAL = 150; + GROUP_PARTICIPANT_JOINED_GROUP_AND_PARENT_GROUP = 151; + MASKED_THREAD_CREATED = 152; + MASKED_THREAD_UNMASKED = 153; + BIZ_CHAT_ASSIGNMENT = 154; + CHAT_PSA = 155; + CHAT_POLL_CREATION_MESSAGE = 156; + CAG_MASKED_THREAD_CREATED = 157; + COMMUNITY_PARENT_GROUP_SUBJECT_CHANGED = 158; + CAG_INVITE_AUTO_ADD = 159; + BIZ_CHAT_ASSIGNMENT_UNASSIGN = 160; + CAG_INVITE_AUTO_JOINED = 161; + } + enum Status { + ERROR = 0; + PENDING = 1; + SERVER_ACK = 2; + DELIVERY_ACK = 3; + READ = 4; + PLAYED = 5; + } + enum BizPrivacyStatus { + E2EE = 0; + FB = 2; + BSP = 1; + BSP_AND_FB = 3; + } + required MessageKey key = 1; + optional Message message = 2; + optional uint64 messageTimestamp = 3; + optional Status status = 4; + optional string participant = 5; + optional uint64 messageC2STimestamp = 6; + 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; + optional StubType messageStubType = 24; + optional bool clearMedia = 25; + repeated string messageStubParameters = 26; + optional uint32 duration = 27; + repeated string labels = 28; + optional PaymentInfo paymentInfo = 29; + optional LiveLocationMessage finalLiveLocation = 30; + optional PaymentInfo quotedPaymentInfo = 31; + optional uint64 ephemeralStartTimestamp = 32; + optional uint32 ephemeralDuration = 33; + optional bool ephemeralOffToOn = 34; + optional bool ephemeralOutOfSync = 35; + optional BizPrivacyStatus bizPrivacyStatus = 36; + optional string verifiedBizName = 37; + optional MediaData mediaData = 38; + optional PhotoChange photoChange = 39; + repeated UserReceipt userReceipt = 40; + repeated Reaction reactions = 41; + optional MediaData quotedStickerData = 42; + optional bytes futureproofData = 43; + optional StatusPSA statusPsa = 44; + repeated PollUpdate pollUpdates = 45; + optional PollAdditionalMetadata pollAdditionalMetadata = 46; + optional string agentId = 47; + optional bool statusAlreadyViewed = 48; + optional bytes messageSecret = 49; + optional KeepInChat keepInChat = 50; + optional string originalSelfAuthorUserJidString = 51; + optional uint64 revokeMessageTimestamp = 52; +} + +message WebFeatures { + enum Flag { + NOT_STARTED = 0; + FORCE_UPGRADE = 1; + DEVELOPMENT = 2; + PRODUCTION = 3; + } + 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; + optional Flag payments = 11; + optional Flag stickerPackQuery = 12; + optional Flag liveLocationsFinal = 13; + optional Flag labelsEdit = 14; + optional Flag mediaUpload = 15; + optional Flag mediaUploadRichQuickReplies = 18; + optional Flag vnameV2 = 19; + optional Flag videoPlaybackUrl = 20; + optional Flag statusRanking = 21; + optional Flag voipIndividualVideo = 22; + optional Flag thirdPartyStickers = 23; + optional Flag frequentlyForwardedSetting = 24; + optional Flag groupsV4JoinPermission = 25; + optional Flag recentStickers = 26; + optional Flag catalog = 27; + optional Flag starredStickers = 28; + optional Flag voipGroupCall = 29; + optional Flag templateMessage = 30; + optional Flag templateMessageInteractivity = 31; + optional Flag ephemeralMessages = 32; + optional Flag e2ENotificationSync = 33; + optional Flag recentStickersV2 = 34; + optional Flag recentStickersV3 = 36; + optional Flag userNotice = 37; + optional Flag support = 39; + optional Flag groupUiiCleanup = 40; + optional Flag groupDogfoodingInternalOnly = 41; + optional Flag settingsSync = 42; + optional Flag archiveV2 = 43; + optional Flag ephemeralAllowGroupMembers = 44; + optional Flag ephemeral24HDuration = 45; + optional Flag mdForceUpgrade = 46; + optional Flag disappearingMode = 47; + optional Flag externalMdOptInAvailable = 48; + optional Flag noDeleteMessageTimeLimit = 49; +} + +message UserReceipt { + required string userJid = 1; + optional int64 receiptTimestamp = 2; + optional int64 readTimestamp = 3; + optional int64 playedTimestamp = 4; + repeated string pendingDeviceJid = 5; + repeated string deliveredDeviceJid = 6; +} + +message StatusPSA { + required uint64 campaignId = 44; + optional uint64 campaignExpirationTimestamp = 45; +} + +message Reaction { + optional MessageKey key = 1; + optional string text = 2; + optional string groupingKey = 3; + optional int64 senderTimestampMs = 4; + optional bool unread = 5; +} + +message PollUpdate { + optional MessageKey pollUpdateMessageKey = 1; + optional PollVoteMessage vote = 2; + optional int64 senderTimestampMs = 3; + optional int64 serverTimestampMs = 4; +} + +message PollAdditionalMetadata { + optional bool pollInvalidated = 1; +} + +message PhotoChange { + optional bytes oldPhoto = 1; + optional bytes newPhoto = 2; + optional uint32 newPhotoId = 3; +} + +message PaymentInfo { + enum TxnStatus { + UNKNOWN = 0; + PENDING_SETUP = 1; + PENDING_RECEIVER_SETUP = 2; + INIT = 3; + SUCCESS = 4; + COMPLETED = 5; + FAILED = 6; + FAILED_RISK = 7; + FAILED_PROCESSING = 8; + FAILED_RECEIVER_PROCESSING = 9; + FAILED_DA = 10; + FAILED_DA_FINAL = 11; + REFUNDED_TXN = 12; + REFUND_FAILED = 13; + REFUND_FAILED_PROCESSING = 14; + REFUND_FAILED_DA = 15; + EXPIRED_TXN = 16; + AUTH_CANCELED = 17; + AUTH_CANCEL_FAILED_PROCESSING = 18; + AUTH_CANCEL_FAILED = 19; + COLLECT_INIT = 20; + COLLECT_SUCCESS = 21; + COLLECT_FAILED = 22; + COLLECT_FAILED_RISK = 23; + COLLECT_REJECTED = 24; + COLLECT_EXPIRED = 25; + COLLECT_CANCELED = 26; + COLLECT_CANCELLING = 27; + IN_REVIEW = 28; + REVERSAL_SUCCESS = 29; + REVERSAL_PENDING = 30; + REFUND_PENDING = 31; + } + enum Status { + UNKNOWN_STATUS = 0; + PROCESSING = 1; + SENT = 2; + NEED_TO_ACCEPT = 3; + COMPLETE = 4; + COULD_NOT_COMPLETE = 5; + REFUNDED = 6; + EXPIRED = 7; + REJECTED = 8; + CANCELLED = 9; + WAITING_FOR_PAYER = 10; + WAITING = 11; + } + enum Currency { + UNKNOWN_CURRENCY = 0; + INR = 1; + } + optional Currency currencyDeprecated = 1; + optional uint64 amount1000 = 2; + optional string receiverJid = 3; + optional Status status = 4; + optional uint64 transactionTimestamp = 5; + optional MessageKey requestMessageKey = 6; + optional uint64 expiryTimestamp = 7; + optional bool futureproofed = 8; + optional string currency = 9; + optional TxnStatus txnStatus = 10; + optional bool useNoviFiatFormat = 11; + optional Money primaryAmount = 12; + optional Money exchangeAmount = 13; +} + +message NotificationMessageInfo { + optional MessageKey key = 1; + optional Message message = 2; + optional uint64 messageTimestamp = 3; + optional string participant = 4; +} + +message MediaData { + optional string localPath = 1; +} + +message KeepInChat { + optional KeepType keepType = 1; + optional int64 serverTimestamp = 2; + optional MessageKey key = 3; + optional string deviceJid = 4; + optional int64 clientTimestampMs = 5; + optional int64 serverTimestampMs = 6; +} + +message NoiseCertificate { + message Details { + optional uint32 serial = 1; + optional string issuer = 2; + optional uint64 expires = 3; + optional string subject = 4; + optional bytes key = 5; + } + + optional bytes details = 1; + optional bytes signature = 2; +} + +message CertChain { + message NoiseCertificate { + message Details { + optional uint32 serial = 1; + optional uint32 issuerSerial = 2; + optional bytes key = 3; + optional uint64 notBefore = 4; + optional uint64 notAfter = 5; + } + + optional bytes details = 1; + optional bytes signature = 2; + } + + optional NoiseCertificate leaf = 1; + optional NoiseCertificate intermediate = 2; +} + diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/proto/doc.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/proto/doc.go new file mode 100644 index 0000000..819b131 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/proto/doc.go @@ -0,0 +1,2 @@ +// Package proto contains the compiled protobuf structs from WhatsApp's protobuf schema. +package proto diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/token/token.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/token/token.go new file mode 100644 index 0000000..3a8ee5a --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/token/token.go @@ -0,0 +1,92 @@ +// Package token contains maps of predefined tokens that WhatsApp's binary XML +// encoding uses to save bytes when sending commonly used strings. +package token + +import "fmt" + +// All the currently known string tokens. +var ( + SingleByteTokens = [...]string{"", "xmlstreamstart", "xmlstreamend", "s.whatsapp.net", "type", "participant", "from", "receipt", "id", "broadcast", "status", "message", "notification", "notify", "to", "jid", "user", "class", "offline", "g.us", "result", "mediatype", "enc", "skmsg", "off_cnt", "xmlns", "presence", "participants", "ack", "t", "iq", "device_hash", "read", "value", "media", "picture", "chatstate", "unavailable", "text", "urn:xmpp:whatsapp:push", "devices", "verified_name", "contact", "composing", "edge_routing", "routing_info", "item", "image", "verified_level", "get", "fallback_hostname", "2", "media_conn", "1", "v", "handshake", "fallback_class", "count", "config", "offline_preview", "download_buckets", "w:profile:picture", "set", "creation", "location", "fallback_ip4", "msg", "urn:xmpp:ping", "fallback_ip6", "call-creator", "relaylatency", "success", "subscribe", "video", "business_hours_config", "platform", "hostname", "version", "unknown", "0", "ping", "hash", "edit", "subject", "max_buckets", "download", "delivery", "props", "sticker", "name", "last", "contacts", "business", "primary", "preview", "w:p", "pkmsg", "call-id", "retry", "prop", "call", "auth_ttl", "available", "relay_id", "last_id", "day_of_week", "w", "host", "seen", "bits", "list", "atn", "upload", "is_new", "w:stats", "key", "paused", "specific_hours", "multicast", "stream:error", "mmg.whatsapp.net", "code", "deny", "played", "profile", "fna", "device-list", "close_time", "latency", "gcm", "pop", "audio", "26", "w:web", "open_time", "error", "auth", "ip4", "update", "profile_options", "config_value", "category", "catalog_not_created", "00", "config_code", "mode", "catalog_status", "ip6", "blocklist", "registration", "7", "web", "fail", "w:m", "cart_enabled", "ttl", "gif", "300", "device_orientation", "identity", "query", "401", "media-gig2-1.cdn.whatsapp.net", "in", "3", "te2", "add", "fallback", "categories", "ptt", "encrypt", "notice", "thumbnail-document", "item-not-found", "12", "thumbnail-image", "stage", "thumbnail-link", "usync", "out", "thumbnail-video", "8", "01", "context", "sidelist", "thumbnail-gif", "terminate", "not-authorized", "orientation", "dhash", "capability", "side_list", "md-app-state", "description", "serial", "readreceipts", "te", "business_hours", "md-msg-hist", "tag", "attribute_padding", "document", "open_24h", "delete", "expiration", "active", "prev_v_id", "true", "passive", "index", "4", "conflict", "remove", "w:gp2", "config_expo_key", "screen_height", "replaced", "02", "screen_width", "uploadfieldstat", "2:47DEQpj8", "media-bog1-1.cdn.whatsapp.net", "encopt", "url", "catalog_exists", "keygen", "rate", "offer", "opus", "media-mia3-1.cdn.whatsapp.net", "privacy", "media-mia3-2.cdn.whatsapp.net", "signature", "preaccept", "token_id", "media-eze1-1.cdn.whatsapp.net"} + DoubleByteTokens = [...][]string{ + {"media-for1-1.cdn.whatsapp.net", "relay", "media-gru2-2.cdn.whatsapp.net", "uncompressed", "medium", "voip_settings", "device", "reason", "media-lim1-1.cdn.whatsapp.net", "media-qro1-2.cdn.whatsapp.net", "media-gru1-2.cdn.whatsapp.net", "action", "features", "media-gru2-1.cdn.whatsapp.net", "media-gru1-1.cdn.whatsapp.net", "media-otp1-1.cdn.whatsapp.net", "kyc-id", "priority", "phash", "mute", "token", "100", "media-qro1-1.cdn.whatsapp.net", "none", "media-mrs2-2.cdn.whatsapp.net", "sign_credential", "03", "media-mrs2-1.cdn.whatsapp.net", "protocol", "timezone", "transport", "eph_setting", "1080", "original_dimensions", "media-frx5-1.cdn.whatsapp.net", "background", "disable", "original_image_url", "5", "transaction-id", "direct_path", "103", "appointment_only", "request_image_url", "peer_pid", "address", "105", "104", "102", "media-cdt1-1.cdn.whatsapp.net", "101", "109", "110", "106", "background_location", "v_id", "sync", "status-old", "111", "107", "ppic", "media-scl2-1.cdn.whatsapp.net", "business_profile", "108", "invite", "04", "audio_duration", "media-mct1-1.cdn.whatsapp.net", "media-cdg2-1.cdn.whatsapp.net", "media-los2-1.cdn.whatsapp.net", "invis", "net", "voip_payload_type", "status-revoke-delay", "404", "state", "use_correct_order_for_hmac_sha1", "ver", "media-mad1-1.cdn.whatsapp.net", "order", "540", "skey", "blinded_credential", "android", "contact_remove", "enable_downlink_relay_latency_only", "duration", "enable_vid_one_way_codec_nego", "6", "media-sof1-1.cdn.whatsapp.net", "accept", "all", "signed_credential", "media-atl3-1.cdn.whatsapp.net", "media-lhr8-1.cdn.whatsapp.net", "website", "05", "latitude", "media-dfw5-1.cdn.whatsapp.net", "forbidden", "enable_audio_piggyback_network_mtu_fix", "media-dfw5-2.cdn.whatsapp.net", "note.m4r", "media-atl3-2.cdn.whatsapp.net", "jb_nack_discard_count_fix", "longitude", "Opening.m4r", "media-arn2-1.cdn.whatsapp.net", "email", "timestamp", "admin", "media-pmo1-1.cdn.whatsapp.net", "America/Sao_Paulo", "contact_add", "media-sin6-1.cdn.whatsapp.net", "interactive", "8000", "acs_public_key", "sigquit_anr_detector_release_rollover_percent", "media.fmed1-2.fna.whatsapp.net", "groupadd", "enabled_for_video_upgrade", "latency_update_threshold", "media-frt3-2.cdn.whatsapp.net", "calls_row_constraint_layout", "media.fgbb2-1.fna.whatsapp.net", "mms4_media_retry_notification_encryption_enabled", "timeout", "media-sin6-3.cdn.whatsapp.net", "audio_nack_jitter_multiplier", "jb_discard_count_adjust_pct_rc", "audio_reserve_bps", "delta", "account_sync", "default", "media.fjed4-6.fna.whatsapp.net", "06", "lock_video_orientation", "media-frt3-1.cdn.whatsapp.net", "w:g2", "media-sin6-2.cdn.whatsapp.net", "audio_nack_algo_mask", "media.fgbb2-2.fna.whatsapp.net", "media.fmed1-1.fna.whatsapp.net", "cond_range_target_bitrate", "mms4_server_error_receipt_encryption_enabled", "vid_rc_dyn", "fri", "cart_v1_1_order_message_changes_enabled", "reg_push", "jb_hist_deposit_value", "privatestats", "media.fist7-2.fna.whatsapp.net", "thu", "jb_discard_count_adjust_pct", "mon", "group_call_video_maximization_enabled", "mms_cat_v1_forward_hot_override_enabled", "audio_nack_new_rtt", "media.fsub2-3.fna.whatsapp.net", "media_upload_aggressive_retry_exponential_backoff_enabled", "tue", "wed", "media.fruh4-2.fna.whatsapp.net", "audio_nack_max_seq_req", "max_rtp_audio_packet_resends", "jb_hist_max_cdf_value", "07", "audio_nack_max_jb_delay", "mms_forward_partially_downloaded_video", "media-lcy1-1.cdn.whatsapp.net", "resume", "jb_inband_fec_aware", "new_commerce_entry_point_enabled", "480", "payments_upi_generate_qr_amount_limit", "sigquit_anr_detector_rollover_percent", "media.fsdu2-1.fna.whatsapp.net", "fbns", "aud_pkt_reorder_pct", "dec", "stop_probing_before_accept_send", "media_upload_max_aggressive_retries", "edit_business_profile_new_mode_enabled", "media.fhex4-1.fna.whatsapp.net", "media.fjed4-3.fna.whatsapp.net", "sigquit_anr_detector_64bit_rollover_percent", "cond_range_ema_jb_last_delay", "watls_enable_early_data_http_get", "media.fsdu2-2.fna.whatsapp.net", "message_qr_disambiguation_enabled", "media-mxp1-1.cdn.whatsapp.net", "sat", "vertical", "media.fruh4-5.fna.whatsapp.net", "200", "media-sof1-2.cdn.whatsapp.net", "-1", "height", "product_catalog_hide_show_items_enabled", "deep_copy_frm_last", "tsoffline", "vp8/h.264", "media.fgye5-3.fna.whatsapp.net", "media.ftuc1-2.fna.whatsapp.net", "smb_upsell_chat_banner_enabled", "canonical", "08", "9", ".", "media.fgyd4-4.fna.whatsapp.net", "media.fsti4-1.fna.whatsapp.net", "mms_vcache_aggregation_enabled", "mms_hot_content_timespan_in_seconds", "nse_ver", "rte", "third_party_sticker_web_sync", "cond_range_target_total_bitrate", "media_upload_aggressive_retry_enabled", "instrument_spam_report_enabled", "disable_reconnect_tone", "move_media_folder_from_sister_app", "one_tap_calling_in_group_chat_size", "10", "storage_mgmt_banner_threshold_mb", "enable_backup_passive_mode", "sharechat_inline_player_enabled", "media.fcnq2-1.fna.whatsapp.net", "media.fhex4-2.fna.whatsapp.net", "media.fist6-3.fna.whatsapp.net", "ephemeral_drop_column_stage", "reconnecting_after_network_change_threshold_ms", "media-lhr8-2.cdn.whatsapp.net", "cond_jb_last_delay_ema_alpha", "entry_point_block_logging_enabled", "critical_event_upload_log_config", "respect_initial_bitrate_estimate", "smaller_image_thumbs_status_enabled", "media.fbtz1-4.fna.whatsapp.net", "media.fjed4-1.fna.whatsapp.net", "width", "720", "enable_frame_dropper", "enable_one_side_mode", "urn:xmpp:whatsapp:dirty", "new_sticker_animation_behavior_v2", "media.flim3-2.fna.whatsapp.net", "media.fuio6-2.fna.whatsapp.net", "skip_forced_signaling", "dleq_proof", "status_video_max_bitrate", "lazy_send_probing_req", "enhanced_storage_management", "android_privatestats_endpoint_dit_enabled", "media.fscl13-2.fna.whatsapp.net", "video_duration"}, + {"group_call_discoverability_enabled", "media.faep9-2.fna.whatsapp.net", "msgr", "bloks_loggedin_access_app_id", "db_status_migration_step", "watls_prefer_ip6", "jabber:iq:privacy", "68", "media.fsaw1-11.fna.whatsapp.net", "mms4_media_conn_persist_enabled", "animated_stickers_thread_clean_up", "media.fcgk3-2.fna.whatsapp.net", "media.fcgk4-6.fna.whatsapp.net", "media.fgye5-2.fna.whatsapp.net", "media.flpb1-1.fna.whatsapp.net", "media.fsub2-1.fna.whatsapp.net", "media.fuio6-3.fna.whatsapp.net", "not-allowed", "partial_pjpeg_bw_threshold", "cap_estimated_bitrate", "mms_chatd_resume_check_over_thrift", "smb_upsell_business_profile_enabled", "product_catalog_webclient", "groups", "sigquit_anr_detector_release_updated_rollout", "syncd_key_rotation_enabled", "media.fdmm2-1.fna.whatsapp.net", "media-hou1-1.cdn.whatsapp.net", "remove_old_chat_notifications", "smb_biztools_deeplink_enabled", "use_downloadable_filters_int", "group_qr_codes_enabled", "max_receipt_processing_time", "optimistic_image_processing_enabled", "smaller_video_thumbs_status_enabled", "watls_early_data", "reconnecting_before_relay_failover_threshold_ms", "cond_range_packet_loss_pct", "groups_privacy_blacklist", "status-revoke-drop", "stickers_animated_thumbnail_download", "dedupe_transcode_shared_images", "dedupe_transcode_shared_videos", "media.fcnq2-2.fna.whatsapp.net", "media.fgyd4-1.fna.whatsapp.net", "media.fist7-1.fna.whatsapp.net", "media.flim3-3.fna.whatsapp.net", "add_contact_by_qr_enabled", "https://faq.whatsapp.com/payments", "multicast_limit_global", "sticker_notification_preview", "smb_better_catalog_list_adapters_enabled", "bloks_use_minscript_android", "pen_smoothing_enabled", "media.fcgk4-5.fna.whatsapp.net", "media.fevn1-3.fna.whatsapp.net", "media.fpoj7-1.fna.whatsapp.net", "media-arn2-2.cdn.whatsapp.net", "reconnecting_before_network_change_threshold_ms", "android_media_use_fresco_for_gifs", "cond_in_congestion", "status_image_max_edge", "sticker_search_enabled", "starred_stickers_web_sync", "db_blank_me_jid_migration_step", "media.fist6-2.fna.whatsapp.net", "media.ftuc1-1.fna.whatsapp.net", "09", "anr_fast_logs_upload_rollout", "camera_core_integration_enabled", "11", "third_party_sticker_caching", "thread_dump_contact_support", "wam_privatestats_enabled", "vcard_as_document_size_kb", "maxfpp", "fbip", "ephemeral_allow_group_members", "media-bom1-2.cdn.whatsapp.net", "media-xsp1-1.cdn.whatsapp.net", "disable_prewarm", "frequently_forwarded_max", "media.fbtz1-5.fna.whatsapp.net", "media.fevn7-1.fna.whatsapp.net", "media.fgyd4-2.fna.whatsapp.net", "sticker_tray_animation_fully_visible_items", "green_alert_banner_duration", "reconnecting_after_p2p_failover_threshold_ms", "connected", "share_biz_vcard_enabled", "stickers_animation", "0a", "1200", "WhatsApp", "group_description_length", "p_v_id", "payments_upi_intent_transaction_limit", "frequently_forwarded_messages", "media-xsp1-2.cdn.whatsapp.net", "media.faep8-1.fna.whatsapp.net", "media.faep8-2.fna.whatsapp.net", "media.faep9-1.fna.whatsapp.net", "media.fdmm2-2.fna.whatsapp.net", "media.fgzt3-1.fna.whatsapp.net", "media.flim4-2.fna.whatsapp.net", "media.frao1-1.fna.whatsapp.net", "media.fscl9-2.fna.whatsapp.net", "media.fsub2-2.fna.whatsapp.net", "superadmin", "media.fbog10-1.fna.whatsapp.net", "media.fcgh28-1.fna.whatsapp.net", "media.fjdo10-1.fna.whatsapp.net", "third_party_animated_sticker_import", "delay_fec", "attachment_picker_refresh", "android_linked_devices_re_auth_enabled", "rc_dyn", "green_alert_block_jitter", "add_contact_logging_enabled", "biz_message_logging_enabled", "conversation_media_preview_v2", "media-jnb1-1.cdn.whatsapp.net", "ab_key", "media.fcgk4-2.fna.whatsapp.net", "media.fevn1-1.fna.whatsapp.net", "media.fist6-1.fna.whatsapp.net", "media.fruh4-4.fna.whatsapp.net", "media.fsti4-2.fna.whatsapp.net", "mms_vcard_autodownload_size_kb", "watls_enabled", "notif_ch_override_off", "media.fsaw1-14.fna.whatsapp.net", "media.fscl13-1.fna.whatsapp.net", "db_group_participant_migration_step", "1020", "cond_range_sterm_rtt", "invites_logging_enabled", "triggered_block_enabled", "group_call_max_participants", "media-iad3-1.cdn.whatsapp.net", "product_catalog_open_deeplink", "shops_required_tos_version", "image_max_kbytes", "cond_low_quality_vid_mode", "db_receipt_migration_step", "jb_early_prob_hist_shrink", "media.fdmm2-3.fna.whatsapp.net", "media.fdmm2-4.fna.whatsapp.net", "media.fruh4-1.fna.whatsapp.net", "media.fsaw2-2.fna.whatsapp.net", "remove_geolocation_videos", "new_animation_behavior", "fieldstats_beacon_chance", "403", "authkey_reset_on_ban", "continuous_ptt_playback", "reconnecting_after_relay_failover_threshold_ms", "false", "group", "sun", "conversation_swipe_to_reply", "ephemeral_messages_setting", "smaller_video_thumbs_enabled", "md_device_sync_enabled", "bloks_shops_pdp_url_regex", "lasso_integration_enabled", "media-bom1-1.cdn.whatsapp.net", "new_backup_format_enabled", "256", "media.faep6-1.fna.whatsapp.net", "media.fasr1-1.fna.whatsapp.net", "media.fbtz1-7.fna.whatsapp.net", "media.fesb4-1.fna.whatsapp.net", "media.fjdo1-2.fna.whatsapp.net", "media.frba2-1.fna.whatsapp.net", "watls_no_dns", "600", "db_broadcast_me_jid_migration_step", "new_wam_runtime_enabled", "group_update", "enhanced_block_enabled", "sync_wifi_threshold_kb", "mms_download_nc_cat", "bloks_minification_enabled", "ephemeral_messages_enabled", "reject", "voip_outgoing_xml_signaling", "creator", "dl_bw", "payments_request_messages", "target_bitrate", "bloks_rendercore_enabled", "media-hbe1-1.cdn.whatsapp.net", "media-hel3-1.cdn.whatsapp.net", "media-kut2-2.cdn.whatsapp.net", "media-lax3-1.cdn.whatsapp.net", "media-lax3-2.cdn.whatsapp.net", "sticker_pack_deeplink_enabled", "hq_image_bw_threshold", "status_info", "voip", "dedupe_transcode_videos", "grp_uii_cleanup", "linked_device_max_count", "media.flim1-1.fna.whatsapp.net", "media.fsaw2-1.fna.whatsapp.net", "reconnecting_after_call_active_threshold_ms", "1140", "catalog_pdp_new_design", "media.fbtz1-10.fna.whatsapp.net", "media.fsaw1-15.fna.whatsapp.net", "0b", "consumer_rc_provider", "mms_async_fast_forward_ttl", "jb_eff_size_fix", "voip_incoming_xml_signaling", "media_provider_share_by_uuid", "suspicious_links", "dedupe_transcode_images", "green_alert_modal_start", "media-cgk1-1.cdn.whatsapp.net", "media-lga3-1.cdn.whatsapp.net", "template_doc_mime_types", "important_messages", "user_add", "vcard_max_size_kb", "media.fada2-1.fna.whatsapp.net", "media.fbog2-5.fna.whatsapp.net", "media.fbtz1-3.fna.whatsapp.net", "media.fcgk3-1.fna.whatsapp.net", "media.fcgk7-1.fna.whatsapp.net", "media.flim1-3.fna.whatsapp.net", "media.fscl9-1.fna.whatsapp.net", "ctwa_context_enterprise_enabled", "media.fsaw1-13.fna.whatsapp.net", "media.fuio11-2.fna.whatsapp.net", "status_collapse_muted", "db_migration_level_force", "recent_stickers_web_sync", "bloks_session_state", "bloks_shops_enabled", "green_alert_setting_deep_links_enabled", "restrict_groups", "battery", "green_alert_block_start", "refresh", "ctwa_context_enabled", "md_messaging_enabled", "status_image_quality", "md_blocklist_v2_server", "media-del1-1.cdn.whatsapp.net", "13", "userrate", "a_v_id", "cond_rtt_ema_alpha", "invalid"}, + {"media.fada1-1.fna.whatsapp.net", "media.fadb3-2.fna.whatsapp.net", "media.fbhz2-1.fna.whatsapp.net", "media.fcor2-1.fna.whatsapp.net", "media.fjed4-2.fna.whatsapp.net", "media.flhe4-1.fna.whatsapp.net", "media.frak1-2.fna.whatsapp.net", "media.fsub6-3.fna.whatsapp.net", "media.fsub6-7.fna.whatsapp.net", "media.fvvi1-1.fna.whatsapp.net", "search_v5_eligible", "wam_real_time_enabled", "report_disk_event", "max_tx_rott_based_bitrate", "product", "media.fjdo10-2.fna.whatsapp.net", "video_frame_crc_sample_interval", "media_max_autodownload", "15", "h.264", "wam_privatestats_buffer_count", "md_phash_v2_enabled", "account_transfer_enabled", "business_product_catalog", "enable_non_dyn_codec_param_fix", "is_user_under_epd_jurisdiction", "media.fbog2-4.fna.whatsapp.net", "media.fbtz1-2.fna.whatsapp.net", "media.fcfc1-1.fna.whatsapp.net", "media.fjed4-5.fna.whatsapp.net", "media.flhe4-2.fna.whatsapp.net", "media.flim1-2.fna.whatsapp.net", "media.flos5-1.fna.whatsapp.net", "android_key_store_auth_ver", "010", "anr_process_monitor", "delete_old_auth_key", "media.fcor10-3.fna.whatsapp.net", "storage_usage_enabled", "android_camera2_support_level", "dirty", "consumer_content_provider", "status_video_max_duration", "0c", "bloks_cache_enabled", "media.fadb2-2.fna.whatsapp.net", "media.fbko1-1.fna.whatsapp.net", "media.fbtz1-9.fna.whatsapp.net", "media.fcgk4-4.fna.whatsapp.net", "media.fesb4-2.fna.whatsapp.net", "media.fevn1-2.fna.whatsapp.net", "media.fist2-4.fna.whatsapp.net", "media.fjdo1-1.fna.whatsapp.net", "media.fruh4-6.fna.whatsapp.net", "media.fsrg5-1.fna.whatsapp.net", "media.fsub6-6.fna.whatsapp.net", "minfpp", "5000", "locales", "video_max_bitrate", "use_new_auth_key", "bloks_http_enabled", "heartbeat_interval", "media.fbog11-1.fna.whatsapp.net", "ephemeral_group_query_ts", "fec_nack", "search_in_storage_usage", "c", "media-amt2-1.cdn.whatsapp.net", "linked_devices_ui_enabled", "14", "async_data_load_on_startup", "voip_incoming_xml_ack", "16", "db_migration_step", "init_bwe", "max_participants", "wam_buffer_count", "media.fada2-2.fna.whatsapp.net", "media.fadb3-1.fna.whatsapp.net", "media.fcor2-2.fna.whatsapp.net", "media.fdiy1-2.fna.whatsapp.net", "media.frba3-2.fna.whatsapp.net", "media.fsaw2-3.fna.whatsapp.net", "1280", "status_grid_enabled", "w:biz", "product_catalog_deeplink", "media.fgye10-2.fna.whatsapp.net", "media.fuio11-1.fna.whatsapp.net", "optimistic_upload", "work_manager_init", "lc", "catalog_message", "cond_net_medium", "enable_periodical_aud_rr_processing", "cond_range_ema_rtt", "media-tir2-1.cdn.whatsapp.net", "frame_ms", "group_invite_sending", "payments_web_enabled", "wallpapers_v2", "0d", "browser", "hq_image_max_edge", "image_edit_zoom", "linked_devices_re_auth_enabled", "media.faly3-2.fna.whatsapp.net", "media.fdoh5-3.fna.whatsapp.net", "media.fesb3-1.fna.whatsapp.net", "media.fknu1-1.fna.whatsapp.net", "media.fmex3-1.fna.whatsapp.net", "media.fruh4-3.fna.whatsapp.net", "255", "web_upgrade_to_md_modal", "audio_piggyback_timeout_msec", "enable_audio_oob_fec_feature", "from_ip", "image_max_edge", "message_qr_enabled", "powersave", "receipt_pre_acking", "video_max_edge", "full", "011", "012", "enable_audio_oob_fec_for_sender", "md_voip_enabled", "enable_privatestats", "max_fec_ratio", "payments_cs_faq_url", "media-xsp1-3.cdn.whatsapp.net", "hq_image_quality", "media.fasr1-2.fna.whatsapp.net", "media.fbog3-1.fna.whatsapp.net", "media.ffjr1-6.fna.whatsapp.net", "media.fist2-3.fna.whatsapp.net", "media.flim4-3.fna.whatsapp.net", "media.fpbc2-4.fna.whatsapp.net", "media.fpku1-1.fna.whatsapp.net", "media.frba1-1.fna.whatsapp.net", "media.fudi1-1.fna.whatsapp.net", "media.fvvi1-2.fna.whatsapp.net", "gcm_fg_service", "enable_dec_ltr_size_check", "clear", "lg", "media.fgru11-1.fna.whatsapp.net", "18", "media-lga3-2.cdn.whatsapp.net", "pkey", "0e", "max_subject", "cond_range_lterm_rtt", "announcement_groups", "biz_profile_options", "s_t", "media.fabv2-1.fna.whatsapp.net", "media.fcai3-1.fna.whatsapp.net", "media.fcgh1-1.fna.whatsapp.net", "media.fctg1-4.fna.whatsapp.net", "media.fdiy1-1.fna.whatsapp.net", "media.fisb4-1.fna.whatsapp.net", "media.fpku1-2.fna.whatsapp.net", "media.fros9-1.fna.whatsapp.net", "status_v3_text", "usync_sidelist", "17", "announcement", "...", "md_group_notification", "0f", "animated_pack_in_store", "013", "America/Mexico_City", "1260", "media-ams4-1.cdn.whatsapp.net", "media-cgk1-2.cdn.whatsapp.net", "media-cpt1-1.cdn.whatsapp.net", "media-maa2-1.cdn.whatsapp.net", "media.fgye10-1.fna.whatsapp.net", "e", "catalog_cart", "hfm_string_changes", "init_bitrate", "packless_hsm", "group_info", "America/Belem", "50", "960", "cond_range_bwe", "decode", "encode", "media.fada1-8.fna.whatsapp.net", "media.fadb1-2.fna.whatsapp.net", "media.fasu6-1.fna.whatsapp.net", "media.fbog4-1.fna.whatsapp.net", "media.fcgk9-2.fna.whatsapp.net", "media.fdoh5-2.fna.whatsapp.net", "media.ffjr1-2.fna.whatsapp.net", "media.fgua1-1.fna.whatsapp.net", "media.fgye1-1.fna.whatsapp.net", "media.fist1-4.fna.whatsapp.net", "media.fpbc2-2.fna.whatsapp.net", "media.fres2-1.fna.whatsapp.net", "media.fsdq1-2.fna.whatsapp.net", "media.fsub6-5.fna.whatsapp.net", "profilo_enabled", "template_hsm", "use_disorder_prefetching_timer", "video_codec_priority", "vpx_max_qp", "ptt_reduce_recording_delay", "25", "iphone", "Windows", "s_o", "Africa/Lagos", "abt", "media-kut2-1.cdn.whatsapp.net", "media-mba1-1.cdn.whatsapp.net", "media-mxp1-2.cdn.whatsapp.net", "md_blocklist_v2", "url_text", "enable_short_offset", "group_join_permissions", "enable_audio_piggyback_feature", "image_quality", "media.fcgk7-2.fna.whatsapp.net", "media.fcgk8-2.fna.whatsapp.net", "media.fclo7-1.fna.whatsapp.net", "media.fcmn1-1.fna.whatsapp.net", "media.feoh1-1.fna.whatsapp.net", "media.fgyd4-3.fna.whatsapp.net", "media.fjed4-4.fna.whatsapp.net", "media.flim1-4.fna.whatsapp.net", "media.flim2-4.fna.whatsapp.net", "media.fplu6-1.fna.whatsapp.net", "media.frak1-1.fna.whatsapp.net", "media.fsdq1-1.fna.whatsapp.net", "to_ip", "015", "vp8", "19", "21", "1320", "auth_key_ver", "message_processing_dedup", "server-error", "wap4_enabled", "420", "014", "cond_range_rtt", "ptt_fast_lock_enabled", "media-ort2-1.cdn.whatsapp.net", "fwd_ui_start_ts"}, + {"contact_blacklist", "Asia/Jakarta", "media.fepa10-1.fna.whatsapp.net", "media.fmex10-3.fna.whatsapp.net", "disorder_prefetching_start_when_empty", "America/Bogota", "use_local_probing_rx_bitrate", "America/Argentina/Buenos_Aires", "cross_post", "media.fabb1-1.fna.whatsapp.net", "media.fbog4-2.fna.whatsapp.net", "media.fcgk9-1.fna.whatsapp.net", "media.fcmn2-1.fna.whatsapp.net", "media.fdel3-1.fna.whatsapp.net", "media.ffjr1-1.fna.whatsapp.net", "media.fgdl5-1.fna.whatsapp.net", "media.flpb1-2.fna.whatsapp.net", "media.fmex2-1.fna.whatsapp.net", "media.frba2-2.fna.whatsapp.net", "media.fros2-2.fna.whatsapp.net", "media.fruh2-1.fna.whatsapp.net", "media.fybz2-2.fna.whatsapp.net", "options", "20", "a", "017", "018", "mute_always", "user_notice", "Asia/Kolkata", "gif_provider", "locked", "media-gua1-1.cdn.whatsapp.net", "piggyback_exclude_force_flush", "24", "media.frec39-1.fna.whatsapp.net", "user_remove", "file_max_size", "cond_packet_loss_pct_ema_alpha", "media.facc1-1.fna.whatsapp.net", "media.fadb2-1.fna.whatsapp.net", "media.faly3-1.fna.whatsapp.net", "media.fbdo6-2.fna.whatsapp.net", "media.fcmn2-2.fna.whatsapp.net", "media.fctg1-3.fna.whatsapp.net", "media.ffez1-2.fna.whatsapp.net", "media.fist1-3.fna.whatsapp.net", "media.fist2-2.fna.whatsapp.net", "media.flim2-2.fna.whatsapp.net", "media.fmct2-3.fna.whatsapp.net", "media.fpei3-1.fna.whatsapp.net", "media.frba3-1.fna.whatsapp.net", "media.fsdu8-2.fna.whatsapp.net", "media.fstu2-1.fna.whatsapp.net", "media_type", "receipt_agg", "016", "enable_pli_for_crc_mismatch", "live", "enc_rekey", "frskmsg", "d", "media.fdel11-2.fna.whatsapp.net", "proto", "2250", "audio_piggyback_enable_cache", "skip_nack_if_ltrp_sent", "mark_dtx_jb_frames", "web_service_delay", "7282", "catalog_send_all", "outgoing", "360", "30", "LIMITED", "019", "audio_picker", "bpv2_phase", "media.fada1-7.fna.whatsapp.net", "media.faep7-1.fna.whatsapp.net", "media.fbko1-2.fna.whatsapp.net", "media.fbni1-2.fna.whatsapp.net", "media.fbtz1-1.fna.whatsapp.net", "media.fbtz1-8.fna.whatsapp.net", "media.fcjs3-1.fna.whatsapp.net", "media.fesb3-2.fna.whatsapp.net", "media.fgdl5-4.fna.whatsapp.net", "media.fist2-1.fna.whatsapp.net", "media.flhe2-2.fna.whatsapp.net", "media.flim2-1.fna.whatsapp.net", "media.fmex1-1.fna.whatsapp.net", "media.fpat3-2.fna.whatsapp.net", "media.fpat3-3.fna.whatsapp.net", "media.fros2-1.fna.whatsapp.net", "media.fsdu8-1.fna.whatsapp.net", "media.fsub3-2.fna.whatsapp.net", "payments_chat_plugin", "cond_congestion_no_rtcp_thr", "green_alert", "not-a-biz", "..", "shops_pdp_urls_config", "source", "media-dus1-1.cdn.whatsapp.net", "mute_video", "01b", "currency", "max_keys", "resume_check", "contact_array", "qr_scanning", "23", "b", "media.fbfh15-1.fna.whatsapp.net", "media.flim22-1.fna.whatsapp.net", "media.fsdu11-1.fna.whatsapp.net", "media.fsdu15-1.fna.whatsapp.net", "Chrome", "fts_version", "60", "media.fada1-6.fna.whatsapp.net", "media.faep4-2.fna.whatsapp.net", "media.fbaq5-1.fna.whatsapp.net", "media.fbni1-1.fna.whatsapp.net", "media.fcai3-2.fna.whatsapp.net", "media.fdel3-2.fna.whatsapp.net", "media.fdmm3-2.fna.whatsapp.net", "media.fhex3-1.fna.whatsapp.net", "media.fisb4-2.fna.whatsapp.net", "media.fkhi5-2.fna.whatsapp.net", "media.flos2-1.fna.whatsapp.net", "media.fmct2-1.fna.whatsapp.net", "media.fntr7-1.fna.whatsapp.net", "media.frak3-1.fna.whatsapp.net", "media.fruh5-2.fna.whatsapp.net", "media.fsub6-1.fna.whatsapp.net", "media.fuab1-2.fna.whatsapp.net", "media.fuio1-1.fna.whatsapp.net", "media.fver1-1.fna.whatsapp.net", "media.fymy1-1.fna.whatsapp.net", "product_catalog", "1380", "audio_oob_fec_max_pkts", "22", "254", "media-ort2-2.cdn.whatsapp.net", "media-sjc3-1.cdn.whatsapp.net", "1600", "01a", "01c", "405", "key_frame_interval", "body", "media.fcgh20-1.fna.whatsapp.net", "media.fesb10-2.fna.whatsapp.net", "125", "2000", "media.fbsb1-1.fna.whatsapp.net", "media.fcmn3-2.fna.whatsapp.net", "media.fcpq1-1.fna.whatsapp.net", "media.fdel1-2.fna.whatsapp.net", "media.ffor2-1.fna.whatsapp.net", "media.fgdl1-4.fna.whatsapp.net", "media.fhex2-1.fna.whatsapp.net", "media.fist1-2.fna.whatsapp.net", "media.fjed5-2.fna.whatsapp.net", "media.flim6-4.fna.whatsapp.net", "media.flos2-2.fna.whatsapp.net", "media.fntr6-2.fna.whatsapp.net", "media.fpku3-2.fna.whatsapp.net", "media.fros8-1.fna.whatsapp.net", "media.fymy1-2.fna.whatsapp.net", "ul_bw", "ltrp_qp_offset", "request", "nack", "dtx_delay_state_reset", "timeoffline", "28", "01f", "32", "enable_ltr_pool", "wa_msys_crypto", "01d", "58", "dtx_freeze_hg_update", "nack_if_rpsi_throttled", "253", "840", "media.famd15-1.fna.whatsapp.net", "media.fbog17-2.fna.whatsapp.net", "media.fcai19-2.fna.whatsapp.net", "media.fcai21-4.fna.whatsapp.net", "media.fesb10-4.fna.whatsapp.net", "media.fesb10-5.fna.whatsapp.net", "media.fmaa12-1.fna.whatsapp.net", "media.fmex11-3.fna.whatsapp.net", "media.fpoa33-1.fna.whatsapp.net", "1050", "021", "clean", "cond_range_ema_packet_loss_pct", "media.fadb6-5.fna.whatsapp.net", "media.faqp4-1.fna.whatsapp.net", "media.fbaq3-1.fna.whatsapp.net", "media.fbel2-1.fna.whatsapp.net", "media.fblr4-2.fna.whatsapp.net", "media.fclo8-1.fna.whatsapp.net", "media.fcoo1-2.fna.whatsapp.net", "media.ffjr1-4.fna.whatsapp.net", "media.ffor9-1.fna.whatsapp.net", "media.fisb3-1.fna.whatsapp.net", "media.fkhi2-2.fna.whatsapp.net", "media.fkhi4-1.fna.whatsapp.net", "media.fpbc1-2.fna.whatsapp.net", "media.fruh2-2.fna.whatsapp.net", "media.fruh5-1.fna.whatsapp.net", "media.fsub3-1.fna.whatsapp.net", "payments_transaction_limit", "252", "27", "29", "tintagel", "01e", "237", "780", "callee_updated_payload", "020", "257", "price", "025", "239", "payments_cs_phone_number", "mediaretry", "w:auth:backup:token", "Glass.caf", "max_bitrate", "240", "251", "660", "media.fbog16-1.fna.whatsapp.net", "media.fcgh21-1.fna.whatsapp.net", "media.fkul19-2.fna.whatsapp.net", "media.flim21-2.fna.whatsapp.net", "media.fmex10-4.fna.whatsapp.net", "64", "33", "34", "35", "interruption", "media.fabv3-1.fna.whatsapp.net", "media.fadb6-1.fna.whatsapp.net", "media.fagr1-1.fna.whatsapp.net", "media.famd1-1.fna.whatsapp.net", "media.famm6-1.fna.whatsapp.net", "media.faqp2-3.fna.whatsapp.net"}, + } +) + +// DictVersion is the version number of the token lists above. +// It's sent when connecting to the websocket so the server knows which tokens are supported. +const DictVersion = 2 + +type doubleByteTokenIndex struct { + dictionary byte + index byte +} + +var mdSingleByteTokenIndex map[string]byte +var mdDoubleByteTokenIndex map[string]doubleByteTokenIndex + +func init() { + mdSingleByteTokenIndex = make(map[string]byte, len(SingleByteTokens)) + mdDoubleByteTokenIndex = make(map[string]doubleByteTokenIndex, 256*4) + for index, token := range SingleByteTokens { + if token != "" { + mdSingleByteTokenIndex[token] = byte(index) + } + } + for dictIndex, tokens := range DoubleByteTokens { + for index, token := range tokens { + mdDoubleByteTokenIndex[token] = doubleByteTokenIndex{byte(dictIndex), byte(index)} + } + } +} + +// GetDoubleToken gets the string value of the double-byte token at the given index. +func GetDoubleToken(index1, index2 int) (string, error) { + if index1 < 0 || index1 >= len(DoubleByteTokens) { + return "", fmt.Errorf("index out of double byte token bounds %d-%d", index1, index2) + } else if index2 < 0 || index2 >= len(DoubleByteTokens[index1]) { + return "", fmt.Errorf("index out of double byte token index %d bounds %d", index1, index2) + } + + return DoubleByteTokens[index1][index2], nil +} + +// IndexOfSingleToken gets the index of the single-byte token with the given string value. +// If there's no token with the given value, the second return value will be false. +func IndexOfSingleToken(token string) (val byte, ok bool) { + val, ok = mdSingleByteTokenIndex[token] + return +} + +// IndexOfDoubleByteToken gets the index of the double-byte token with the given string value. +// If there's no token with the given value, the third return value will be false. +func IndexOfDoubleByteToken(token string) (byte, byte, bool) { + val, ok := mdDoubleByteTokenIndex[token] + return val.dictionary, val.index, ok +} + +// Type tokens used in the binary XML representation. +const ( + ListEmpty = 0 + Dictionary0 = 236 + Dictionary1 = 237 + Dictionary2 = 238 + Dictionary3 = 239 + ADJID = 247 + List8 = 248 + List16 = 249 + JIDPair = 250 + Hex8 = 251 + Binary8 = 252 + Binary20 = 253 + Binary32 = 254 + Nibble8 = 255 +) + +// Other constants +const ( + PackedMax = 127 + SingleByteMax = 256 +) diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/unpack.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/unpack.go new file mode 100644 index 0000000..a4557c5 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/unpack.go @@ -0,0 +1,31 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package binary + +import ( + "bytes" + "compress/zlib" + "fmt" + "io" +) + +// Unpack unpacks the given decrypted data from the WhatsApp web API. +// +// It checks the first byte to decide whether to uncompress the data with zlib or just return as-is +// (without the first byte). There's currently no corresponding Pack function because Marshal +// already returns the data with a leading zero (i.e. not compressed). +func Unpack(data []byte) ([]byte, error) { + dataType, data := data[0], data[1:] + if 2&dataType > 0 { + if decompressor, err := zlib.NewReader(bytes.NewReader(data)); err != nil { + return nil, fmt.Errorf("failed to create zlib reader: %w", err) + } else if data, err = io.ReadAll(decompressor); err != nil { + return nil, err + } + } + return data, nil +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/xml.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/xml.go new file mode 100644 index 0000000..0f41189 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/binary/xml.go @@ -0,0 +1,108 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package binary + +import ( + "encoding/hex" + "fmt" + "sort" + "strings" + "unicode" + "unicode/utf8" +) + +// Options to control how Node.XMLString behaves. +var ( + IndentXML = false + MaxBytesToPrintAsHex = 128 +) + +// XMLString converts the Node to its XML representation +func (n *Node) XMLString() string { + content := n.contentString() + if len(content) == 0 { + return fmt.Sprintf("<%[1]s%[2]s/>", n.Tag, n.attributeString()) + } + newline := "\n" + if len(content) == 1 || !IndentXML { + newline = "" + } + return fmt.Sprintf("<%[1]s%[2]s>%[4]s%[3]s%[4]s</%[1]s>", n.Tag, n.attributeString(), strings.Join(content, newline), newline) +} + +func (n *Node) attributeString() string { + if len(n.Attrs) == 0 { + return "" + } + stringAttrs := make([]string, len(n.Attrs)+1) + i := 1 + for key, value := range n.Attrs { + stringAttrs[i] = fmt.Sprintf(`%s="%v"`, key, value) + i++ + } + sort.Strings(stringAttrs) + return strings.Join(stringAttrs, " ") +} + +func printable(data []byte) string { + if !utf8.Valid(data) { + return "" + } + str := string(data) + for _, c := range str { + if !unicode.IsPrint(c) { + return "" + } + } + return str +} + +func (n *Node) contentString() []string { + split := make([]string, 0) + switch content := n.Content.(type) { + case []Node: + for _, item := range content { + split = append(split, strings.Split(item.XMLString(), "\n")...) + } + case []byte: + if strContent := printable(content); len(strContent) > 0 { + if IndentXML { + split = append(split, strings.Split(string(content), "\n")...) + } else { + split = append(split, strings.ReplaceAll(string(content), "\n", "\\n")) + } + } else if len(content) > MaxBytesToPrintAsHex { + split = append(split, fmt.Sprintf("<!-- %d bytes -->", len(content))) + } else if !IndentXML { + split = append(split, hex.EncodeToString(content)) + } else { + hexData := hex.EncodeToString(content) + for i := 0; i < len(hexData); i += 80 { + if len(hexData) < i+80 { + split = append(split, hexData[i:]) + } else { + split = append(split, hexData[i:i+80]) + } + } + } + case nil: + // don't append anything + default: + strContent := fmt.Sprintf("%s", content) + if IndentXML { + split = append(split, strings.Split(strContent, "\n")...) + } else { + split = append(split, strings.ReplaceAll(strContent, "\n", "\\n")) + } + } + if len(split) > 1 && IndentXML { + for i, line := range split { + split[i] = " " + line + } + } + return split +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/broadcast.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/broadcast.go new file mode 100644 index 0000000..a61ccfb --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/broadcast.go @@ -0,0 +1,142 @@ +// Copyright (c) 2022 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package whatsmeow + +import ( + "errors" + "fmt" + + waBinary "go.mau.fi/whatsmeow/binary" + "go.mau.fi/whatsmeow/types" +) + +func (cli *Client) getBroadcastListParticipants(jid types.JID) ([]types.JID, error) { + var list []types.JID + var err error + if jid == types.StatusBroadcastJID { + list, err = cli.getStatusBroadcastRecipients() + } else { + return nil, ErrBroadcastListUnsupported + } + if err != nil { + return nil, err + } + ownID := cli.getOwnID().ToNonAD() + if ownID.IsEmpty() { + return nil, ErrNotLoggedIn + } + + var hasSelf bool + for _, participant := range list { + if participant.User == ownID.User { + hasSelf = true + break + } + } + if !hasSelf { + list = append(list, ownID) + } + return list, nil +} + +func (cli *Client) getStatusBroadcastRecipients() ([]types.JID, error) { + statusPrivacyOptions, err := cli.GetStatusPrivacy() + if err != nil { + return nil, fmt.Errorf("failed to get status privacy: %w", err) + } + statusPrivacy := statusPrivacyOptions[0] + if statusPrivacy.Type == types.StatusPrivacyTypeWhitelist { + // Whitelist mode, just return the list + return statusPrivacy.List, nil + } + + // Blacklist or all contacts mode. Find all contacts from database, then filter them appropriately. + contacts, err := cli.Store.Contacts.GetAllContacts() + if err != nil { + return nil, fmt.Errorf("failed to get contact list from db: %w", err) + } + + blacklist := make(map[types.JID]struct{}) + if statusPrivacy.Type == types.StatusPrivacyTypeBlacklist { + for _, jid := range statusPrivacy.List { + blacklist[jid] = struct{}{} + } + } + + var contactsArray []types.JID + for jid, contact := range contacts { + _, isBlacklisted := blacklist[jid] + if isBlacklisted { + continue + } + // TODO should there be a better way to separate contacts and found push names in the db? + if len(contact.FullName) > 0 { + contactsArray = append(contactsArray, jid) + } + } + return contactsArray, nil +} + +var DefaultStatusPrivacy = []types.StatusPrivacy{{ + Type: types.StatusPrivacyTypeContacts, + IsDefault: true, +}} + +// GetStatusPrivacy gets the user's status privacy settings (who to send status broadcasts to). +// +// There can be multiple different stored settings, the first one is always the default. +func (cli *Client) GetStatusPrivacy() ([]types.StatusPrivacy, error) { + resp, err := cli.sendIQ(infoQuery{ + Namespace: "status", + Type: iqGet, + To: types.ServerJID, + Content: []waBinary.Node{{ + Tag: "privacy", + }}, + }) + if err != nil { + if errors.Is(err, ErrIQNotFound) { + return DefaultStatusPrivacy, nil + } + return nil, err + } + privacyLists := resp.GetChildByTag("privacy") + var outputs []types.StatusPrivacy + for _, list := range privacyLists.GetChildren() { + if list.Tag != "list" { + continue + } + + ag := list.AttrGetter() + var out types.StatusPrivacy + out.IsDefault = ag.OptionalBool("default") + out.Type = types.StatusPrivacyType(ag.String("type")) + children := list.GetChildren() + if len(children) > 0 { + out.List = make([]types.JID, 0, len(children)) + for _, child := range children { + jid, ok := child.Attrs["jid"].(types.JID) + if child.Tag == "user" && ok { + out.List = append(out.List, jid) + } + } + } + outputs = append(outputs, out) + if out.IsDefault { + // Move default to always be first in the list + outputs[len(outputs)-1] = outputs[0] + outputs[0] = out + } + if len(ag.Errors) > 0 { + return nil, ag.Error() + } + } + if len(outputs) == 0 { + return DefaultStatusPrivacy, nil + } + return outputs, nil +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/call.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/call.go new file mode 100644 index 0000000..f4de9bd --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/call.go @@ -0,0 +1,71 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package whatsmeow + +import ( + waBinary "go.mau.fi/whatsmeow/binary" + "go.mau.fi/whatsmeow/types" + "go.mau.fi/whatsmeow/types/events" +) + +func (cli *Client) handleCallEvent(node *waBinary.Node) { + go cli.sendAck(node) + + if len(node.GetChildren()) != 1 { + cli.dispatchEvent(&events.UnknownCallEvent{Node: node}) + return + } + ag := node.AttrGetter() + child := node.GetChildren()[0] + cag := child.AttrGetter() + basicMeta := types.BasicCallMeta{ + From: ag.JID("from"), + Timestamp: ag.UnixTime("t"), + CallCreator: cag.JID("call-creator"), + CallID: cag.String("call-id"), + } + switch child.Tag { + case "offer": + cli.dispatchEvent(&events.CallOffer{ + BasicCallMeta: basicMeta, + CallRemoteMeta: types.CallRemoteMeta{ + RemotePlatform: ag.String("platform"), + RemoteVersion: ag.String("version"), + }, + Data: &child, + }) + case "offer_notice": + cli.dispatchEvent(&events.CallOfferNotice{ + BasicCallMeta: basicMeta, + Media: cag.String("media"), + Type: cag.String("type"), + Data: &child, + }) + case "relaylatency": + cli.dispatchEvent(&events.CallRelayLatency{ + BasicCallMeta: basicMeta, + Data: &child, + }) + case "accept": + cli.dispatchEvent(&events.CallAccept{ + BasicCallMeta: basicMeta, + CallRemoteMeta: types.CallRemoteMeta{ + RemotePlatform: ag.String("platform"), + RemoteVersion: ag.String("version"), + }, + Data: &child, + }) + case "terminate": + cli.dispatchEvent(&events.CallTerminate{ + BasicCallMeta: basicMeta, + Reason: cag.String("reason"), + Data: &child, + }) + default: + cli.dispatchEvent(&events.UnknownCallEvent{Node: node}) + } +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/client.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/client.go new file mode 100644 index 0000000..3f832c9 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/client.go @@ -0,0 +1,641 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +// Package whatsmeow implements a client for interacting with the WhatsApp web multidevice API. +package whatsmeow + +import ( + "context" + "crypto/rand" + "encoding/hex" + "errors" + "fmt" + "net/http" + "net/url" + "runtime/debug" + "sync" + "sync/atomic" + "time" + + "go.mau.fi/whatsmeow/appstate" + waBinary "go.mau.fi/whatsmeow/binary" + waProto "go.mau.fi/whatsmeow/binary/proto" + "go.mau.fi/whatsmeow/socket" + "go.mau.fi/whatsmeow/store" + "go.mau.fi/whatsmeow/types" + "go.mau.fi/whatsmeow/types/events" + "go.mau.fi/whatsmeow/util/keys" + waLog "go.mau.fi/whatsmeow/util/log" +) + +// EventHandler is a function that can handle events from WhatsApp. +type EventHandler func(evt interface{}) +type nodeHandler func(node *waBinary.Node) + +var nextHandlerID uint32 + +type wrappedEventHandler struct { + fn EventHandler + id uint32 +} + +// Client contains everything necessary to connect to and interact with the WhatsApp web API. +type Client struct { + Store *store.Device + Log waLog.Logger + recvLog waLog.Logger + sendLog waLog.Logger + + socket *socket.NoiseSocket + socketLock sync.RWMutex + socketWait chan struct{} + + isLoggedIn uint32 + expectedDisconnectVal uint32 + EnableAutoReconnect bool + LastSuccessfulConnect time.Time + AutoReconnectErrors int + + sendActiveReceipts uint32 + + // EmitAppStateEventsOnFullSync can be set to true if you want to get app state events emitted + // even when re-syncing the whole state. + EmitAppStateEventsOnFullSync bool + + appStateProc *appstate.Processor + appStateSyncLock sync.Mutex + + historySyncNotifications chan *waProto.HistorySyncNotification + historySyncHandlerStarted uint32 + + uploadPreKeysLock sync.Mutex + lastPreKeyUpload time.Time + + mediaConnCache *MediaConn + mediaConnLock sync.Mutex + + responseWaiters map[string]chan<- *waBinary.Node + responseWaitersLock sync.Mutex + + nodeHandlers map[string]nodeHandler + handlerQueue chan *waBinary.Node + eventHandlers []wrappedEventHandler + eventHandlersLock sync.RWMutex + + messageRetries map[string]int + messageRetriesLock sync.Mutex + + appStateKeyRequests map[string]time.Time + appStateKeyRequestsLock sync.RWMutex + + messageSendLock sync.Mutex + + privacySettingsCache atomic.Value + + groupParticipantsCache map[types.JID][]types.JID + groupParticipantsCacheLock sync.Mutex + userDevicesCache map[types.JID][]types.JID + userDevicesCacheLock sync.Mutex + + recentMessagesMap map[recentMessageKey]*waProto.Message + recentMessagesList [recentMessagesSize]recentMessageKey + recentMessagesPtr int + recentMessagesLock sync.RWMutex + + sessionRecreateHistory map[types.JID]time.Time + sessionRecreateHistoryLock sync.Mutex + // GetMessageForRetry is used to find the source message for handling retry receipts + // when the message is not found in the recently sent message cache. + GetMessageForRetry func(requester, to types.JID, id types.MessageID) *waProto.Message + // PreRetryCallback is called before a retry receipt is accepted. + // If it returns false, the accepting will be cancelled and the retry receipt will be ignored. + PreRetryCallback func(receipt *events.Receipt, id types.MessageID, retryCount int, msg *waProto.Message) bool + + // PrePairCallback is called before pairing is completed. If it returns false, the pairing will be cancelled and + // the client will disconnect. + PrePairCallback func(jid types.JID, platform, businessName string) bool + + // Should untrusted identity errors be handled automatically? If true, the stored identity and existing signal + // sessions will be removed on untrusted identity errors, and an events.IdentityChange will be dispatched. + // If false, decrypting a message from untrusted devices will fail. + AutoTrustIdentity bool + + // Should SubscribePresence return an error if no privacy token is stored for the user? + ErrorOnSubscribePresenceWithoutToken bool + + uniqueID string + idCounter uint32 + + proxy socket.Proxy + http *http.Client +} + +// Size of buffer for the channel that all incoming XML nodes go through. +// In general it shouldn't go past a few buffered messages, but the channel is big to be safe. +const handlerQueueSize = 2048 + +// NewClient initializes a new WhatsApp web client. +// +// The logger can be nil, it will default to a no-op logger. +// +// The device store must be set. A default SQL-backed implementation is available in the store/sqlstore package. +// +// container, err := sqlstore.New("sqlite3", "file:yoursqlitefile.db?_foreign_keys=on", nil) +// if err != nil { +// panic(err) +// } +// // If you want multiple sessions, remember their JIDs and use .GetDevice(jid) or .GetAllDevices() instead. +// deviceStore, err := container.GetFirstDevice() +// if err != nil { +// panic(err) +// } +// client := whatsmeow.NewClient(deviceStore, nil) +func NewClient(deviceStore *store.Device, log waLog.Logger) *Client { + if log == nil { + log = waLog.Noop + } + randomBytes := make([]byte, 2) + _, _ = rand.Read(randomBytes) + cli := &Client{ + http: &http.Client{ + Transport: (http.DefaultTransport.(*http.Transport)).Clone(), + }, + proxy: http.ProxyFromEnvironment, + Store: deviceStore, + Log: log, + recvLog: log.Sub("Recv"), + sendLog: log.Sub("Send"), + uniqueID: fmt.Sprintf("%d.%d-", randomBytes[0], randomBytes[1]), + responseWaiters: make(map[string]chan<- *waBinary.Node), + eventHandlers: make([]wrappedEventHandler, 0, 1), + messageRetries: make(map[string]int), + handlerQueue: make(chan *waBinary.Node, handlerQueueSize), + appStateProc: appstate.NewProcessor(deviceStore, log.Sub("AppState")), + socketWait: make(chan struct{}), + + historySyncNotifications: make(chan *waProto.HistorySyncNotification, 32), + + groupParticipantsCache: make(map[types.JID][]types.JID), + userDevicesCache: make(map[types.JID][]types.JID), + + recentMessagesMap: make(map[recentMessageKey]*waProto.Message, recentMessagesSize), + sessionRecreateHistory: make(map[types.JID]time.Time), + GetMessageForRetry: func(requester, to types.JID, id types.MessageID) *waProto.Message { return nil }, + appStateKeyRequests: make(map[string]time.Time), + + EnableAutoReconnect: true, + AutoTrustIdentity: true, + } + cli.nodeHandlers = map[string]nodeHandler{ + "message": cli.handleEncryptedMessage, + "receipt": cli.handleReceipt, + "call": cli.handleCallEvent, + "chatstate": cli.handleChatState, + "presence": cli.handlePresence, + "notification": cli.handleNotification, + "success": cli.handleConnectSuccess, + "failure": cli.handleConnectFailure, + "stream:error": cli.handleStreamError, + "iq": cli.handleIQ, + "ib": cli.handleIB, + // Apparently there's also an <error> node which can have a code=479 and means "Invalid stanza sent (smax-invalid)" + } + return cli +} + +// SetProxyAddress is a helper method that parses a URL string and calls SetProxy. +// +// Returns an error if url.Parse fails to parse the given address. +func (cli *Client) SetProxyAddress(addr string) error { + parsed, err := url.Parse(addr) + if err != nil { + return err + } + cli.SetProxy(http.ProxyURL(parsed)) + return nil +} + +// SetProxy sets the proxy to use for WhatsApp web websocket connections and media uploads/downloads. +// +// Must be called before Connect() to take effect in the websocket connection. +// If you want to change the proxy after connecting, you must call Disconnect() and then Connect() again manually. +// +// By default, the client will find the proxy from the https_proxy environment variable like Go's net/http does. +// +// To disable reading proxy info from environment variables, explicitly set the proxy to nil: +// +// cli.SetProxy(nil) +// +// To use a different proxy for the websocket and media, pass a function that checks the request path or headers: +// +// cli.SetProxy(func(r *http.Request) (*url.URL, error) { +// if r.URL.Host == "web.whatsapp.com" && r.URL.Path == "/ws/chat" { +// return websocketProxyURL, nil +// } else { +// return mediaProxyURL, nil +// } +// }) +func (cli *Client) SetProxy(proxy socket.Proxy) { + cli.proxy = proxy + cli.http.Transport.(*http.Transport).Proxy = proxy +} + +func (cli *Client) getSocketWaitChan() <-chan struct{} { + cli.socketLock.RLock() + ch := cli.socketWait + cli.socketLock.RUnlock() + return ch +} + +func (cli *Client) closeSocketWaitChan() { + cli.socketLock.Lock() + close(cli.socketWait) + cli.socketWait = make(chan struct{}) + cli.socketLock.Unlock() +} + +func (cli *Client) getOwnID() types.JID { + id := cli.Store.ID + if id == nil { + return types.EmptyJID + } + return *id +} + +func (cli *Client) WaitForConnection(timeout time.Duration) bool { + timeoutChan := time.After(timeout) + cli.socketLock.RLock() + for cli.socket == nil || !cli.socket.IsConnected() || !cli.IsLoggedIn() { + ch := cli.socketWait + cli.socketLock.RUnlock() + select { + case <-ch: + case <-timeoutChan: + return false + } + cli.socketLock.RLock() + } + cli.socketLock.RUnlock() + return true +} + +// Connect connects the client to the WhatsApp web websocket. After connection, it will either +// authenticate if there's data in the device store, or emit a QREvent to set up a new link. +func (cli *Client) Connect() error { + cli.socketLock.Lock() + defer cli.socketLock.Unlock() + if cli.socket != nil { + if !cli.socket.IsConnected() { + cli.unlockedDisconnect() + } else { + return ErrAlreadyConnected + } + } + + cli.resetExpectedDisconnect() + fs := socket.NewFrameSocket(cli.Log.Sub("Socket"), socket.WAConnHeader, cli.proxy) + if err := fs.Connect(); err != nil { + fs.Close(0) + return err + } else if err = cli.doHandshake(fs, *keys.NewKeyPair()); err != nil { + fs.Close(0) + return fmt.Errorf("noise handshake failed: %w", err) + } + go cli.keepAliveLoop(cli.socket.Context()) + go cli.handlerQueueLoop(cli.socket.Context()) + return nil +} + +// IsLoggedIn returns true after the client is successfully connected and authenticated on WhatsApp. +func (cli *Client) IsLoggedIn() bool { + return atomic.LoadUint32(&cli.isLoggedIn) == 1 +} + +func (cli *Client) onDisconnect(ns *socket.NoiseSocket, remote bool) { + ns.Stop(false) + cli.socketLock.Lock() + defer cli.socketLock.Unlock() + if cli.socket == ns { + cli.socket = nil + cli.clearResponseWaiters(xmlStreamEndNode) + if !cli.isExpectedDisconnect() && remote { + cli.Log.Debugf("Emitting Disconnected event") + go cli.dispatchEvent(&events.Disconnected{}) + go cli.autoReconnect() + } else if remote { + cli.Log.Debugf("OnDisconnect() called, but it was expected, so not emitting event") + } else { + cli.Log.Debugf("OnDisconnect() called after manual disconnection") + } + } else { + cli.Log.Debugf("Ignoring OnDisconnect on different socket") + } +} + +func (cli *Client) expectDisconnect() { + atomic.StoreUint32(&cli.expectedDisconnectVal, 1) +} + +func (cli *Client) resetExpectedDisconnect() { + atomic.StoreUint32(&cli.expectedDisconnectVal, 0) +} + +func (cli *Client) isExpectedDisconnect() bool { + return atomic.LoadUint32(&cli.expectedDisconnectVal) == 1 +} + +func (cli *Client) autoReconnect() { + if !cli.EnableAutoReconnect || cli.Store.ID == nil { + return + } + for { + autoReconnectDelay := time.Duration(cli.AutoReconnectErrors) * 2 * time.Second + cli.Log.Debugf("Automatically reconnecting after %v", autoReconnectDelay) + cli.AutoReconnectErrors++ + time.Sleep(autoReconnectDelay) + err := cli.Connect() + if errors.Is(err, ErrAlreadyConnected) { + cli.Log.Debugf("Connect() said we're already connected after autoreconnect sleep") + return + } else if err != nil { + cli.Log.Errorf("Error reconnecting after autoreconnect sleep: %v", err) + } else { + return + } + } +} + +// IsConnected checks if the client is connected to the WhatsApp web websocket. +// Note that this doesn't check if the client is authenticated. See the IsLoggedIn field for that. +func (cli *Client) IsConnected() bool { + cli.socketLock.RLock() + connected := cli.socket != nil && cli.socket.IsConnected() + cli.socketLock.RUnlock() + return connected +} + +// Disconnect disconnects from the WhatsApp web websocket. +// +// This will not emit any events, the Disconnected event is only used when the +// connection is closed by the server or a network error. +func (cli *Client) Disconnect() { + if cli.socket == nil { + return + } + cli.socketLock.Lock() + cli.unlockedDisconnect() + cli.socketLock.Unlock() +} + +// Disconnect closes the websocket connection. +func (cli *Client) unlockedDisconnect() { + if cli.socket != nil { + cli.socket.Stop(true) + cli.socket = nil + cli.clearResponseWaiters(xmlStreamEndNode) + } +} + +// Logout sends a request to unlink the device, then disconnects from the websocket and deletes the local device store. +// +// If the logout request fails, the disconnection and local data deletion will not happen either. +// If an error is returned, but you want to force disconnect/clear data, call Client.Disconnect() and Client.Store.Delete() manually. +// +// Note that this will not emit any events. The LoggedOut event is only used for external logouts +// (triggered by the user from the main device or by WhatsApp servers). +func (cli *Client) Logout() error { + ownID := cli.getOwnID() + if ownID.IsEmpty() { + return ErrNotLoggedIn + } + _, err := cli.sendIQ(infoQuery{ + Namespace: "md", + Type: "set", + To: types.ServerJID, + Content: []waBinary.Node{{ + Tag: "remove-companion-device", + Attrs: waBinary.Attrs{ + "jid": ownID, + "reason": "user_initiated", + }, + }}, + }) + if err != nil { + return fmt.Errorf("error sending logout request: %w", err) + } + cli.Disconnect() + err = cli.Store.Delete() + if err != nil { + return fmt.Errorf("error deleting data from store: %w", err) + } + return nil +} + +// AddEventHandler registers a new function to receive all events emitted by this client. +// +// The returned integer is the event handler ID, which can be passed to RemoveEventHandler to remove it. +// +// All registered event handlers will receive all events. You should use a type switch statement to +// filter the events you want: +// +// func myEventHandler(evt interface{}) { +// switch v := evt.(type) { +// case *events.Message: +// fmt.Println("Received a message!") +// case *events.Receipt: +// fmt.Println("Received a receipt!") +// } +// } +// +// If you want to access the Client instance inside the event handler, the recommended way is to +// wrap the whole handler in another struct: +// +// type MyClient struct { +// WAClient *whatsmeow.Client +// eventHandlerID uint32 +// } +// +// func (mycli *MyClient) register() { +// mycli.eventHandlerID = mycli.WAClient.AddEventHandler(mycli.myEventHandler) +// } +// +// func (mycli *MyClient) myEventHandler(evt interface{}) { +// // Handle event and access mycli.WAClient +// } +func (cli *Client) AddEventHandler(handler EventHandler) uint32 { + nextID := atomic.AddUint32(&nextHandlerID, 1) + cli.eventHandlersLock.Lock() + cli.eventHandlers = append(cli.eventHandlers, wrappedEventHandler{handler, nextID}) + cli.eventHandlersLock.Unlock() + return nextID +} + +// RemoveEventHandler removes a previously registered event handler function. +// If the function with the given ID is found, this returns true. +// +// N.B. Do not run this directly from an event handler. That would cause a deadlock because the +// event dispatcher holds a read lock on the event handler list, and this method wants a write lock +// on the same list. Instead run it in a goroutine: +// +// func (mycli *MyClient) myEventHandler(evt interface{}) { +// if noLongerWantEvents { +// go mycli.WAClient.RemoveEventHandler(mycli.eventHandlerID) +// } +// } +func (cli *Client) RemoveEventHandler(id uint32) bool { + cli.eventHandlersLock.Lock() + defer cli.eventHandlersLock.Unlock() + for index := range cli.eventHandlers { + if cli.eventHandlers[index].id == id { + if index == 0 { + cli.eventHandlers[0].fn = nil + cli.eventHandlers = cli.eventHandlers[1:] + return true + } else if index < len(cli.eventHandlers)-1 { + copy(cli.eventHandlers[index:], cli.eventHandlers[index+1:]) + } + cli.eventHandlers[len(cli.eventHandlers)-1].fn = nil + cli.eventHandlers = cli.eventHandlers[:len(cli.eventHandlers)-1] + return true + } + } + return false +} + +// RemoveEventHandlers removes all event handlers that have been registered with AddEventHandler +func (cli *Client) RemoveEventHandlers() { + cli.eventHandlersLock.Lock() + cli.eventHandlers = make([]wrappedEventHandler, 0, 1) + cli.eventHandlersLock.Unlock() +} + +func (cli *Client) handleFrame(data []byte) { + decompressed, err := waBinary.Unpack(data) + if err != nil { + cli.Log.Warnf("Failed to decompress frame: %v", err) + cli.Log.Debugf("Errored frame hex: %s", hex.EncodeToString(data)) + return + } + node, err := waBinary.Unmarshal(decompressed) + if err != nil { + cli.Log.Warnf("Failed to decode node in frame: %v", err) + cli.Log.Debugf("Errored frame hex: %s", hex.EncodeToString(decompressed)) + return + } + cli.recvLog.Debugf("%s", node.XMLString()) + if node.Tag == "xmlstreamend" { + if !cli.isExpectedDisconnect() { + cli.Log.Warnf("Received stream end frame") + } + // TODO should we do something else? + } else if cli.receiveResponse(node) { + // handled + } else if _, ok := cli.nodeHandlers[node.Tag]; ok { + select { + case cli.handlerQueue <- node: + default: + cli.Log.Warnf("Handler queue is full, message ordering is no longer guaranteed") + go func() { + cli.handlerQueue <- node + }() + } + } else { + cli.Log.Debugf("Didn't handle WhatsApp node %s", node.Tag) + } +} + +func (cli *Client) handlerQueueLoop(ctx context.Context) { + for { + select { + case node := <-cli.handlerQueue: + cli.nodeHandlers[node.Tag](node) + case <-ctx.Done(): + return + } + } +} + +func (cli *Client) sendNodeAndGetData(node waBinary.Node) ([]byte, error) { + cli.socketLock.RLock() + sock := cli.socket + cli.socketLock.RUnlock() + if sock == nil { + return nil, ErrNotConnected + } + + payload, err := waBinary.Marshal(node) + if err != nil { + return nil, fmt.Errorf("failed to marshal node: %w", err) + } + + cli.sendLog.Debugf("%s", node.XMLString()) + return payload, sock.SendFrame(payload) +} + +func (cli *Client) sendNode(node waBinary.Node) error { + _, err := cli.sendNodeAndGetData(node) + return err +} + +func (cli *Client) dispatchEvent(evt interface{}) { + cli.eventHandlersLock.RLock() + defer func() { + cli.eventHandlersLock.RUnlock() + err := recover() + if err != nil { + cli.Log.Errorf("Event handler panicked while handling a %T: %v\n%s", evt, err, debug.Stack()) + } + }() + for _, handler := range cli.eventHandlers { + handler.fn(evt) + } +} + +// ParseWebMessage parses a WebMessageInfo object into *events.Message to match what real-time messages have. +// +// The chat JID can be found in the Conversation data: +// +// chatJID, err := types.ParseJID(conv.GetId()) +// for _, historyMsg := range conv.GetMessages() { +// evt, err := cli.ParseWebMessage(chatJID, historyMsg.GetMessage()) +// yourNormalEventHandler(evt) +// } +func (cli *Client) ParseWebMessage(chatJID types.JID, webMsg *waProto.WebMessageInfo) (*events.Message, error) { + info := types.MessageInfo{ + MessageSource: types.MessageSource{ + Chat: chatJID, + IsFromMe: webMsg.GetKey().GetFromMe(), + IsGroup: chatJID.Server == types.GroupServer, + }, + ID: webMsg.GetKey().GetId(), + PushName: webMsg.GetPushName(), + Timestamp: time.Unix(int64(webMsg.GetMessageTimestamp()), 0), + } + var err error + if info.IsFromMe { + info.Sender = cli.getOwnID().ToNonAD() + if info.Sender.IsEmpty() { + return nil, ErrNotLoggedIn + } + } else if chatJID.Server == types.DefaultUserServer { + info.Sender = chatJID + } else if webMsg.GetParticipant() != "" { + info.Sender, err = types.ParseJID(webMsg.GetParticipant()) + } else if webMsg.GetKey().GetParticipant() != "" { + info.Sender, err = types.ParseJID(webMsg.GetKey().GetParticipant()) + } else { + return nil, fmt.Errorf("couldn't find sender of message %s", info.ID) + } + if err != nil { + return nil, fmt.Errorf("failed to parse sender of message %s: %v", info.ID, err) + } + evt := &events.Message{ + RawMessage: webMsg.GetMessage(), + Info: info, + } + evt.UnwrapRaw() + return evt, nil +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/connectionevents.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/connectionevents.go new file mode 100644 index 0000000..5d0835f --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/connectionevents.go @@ -0,0 +1,151 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package whatsmeow + +import ( + "sync/atomic" + "time" + + waBinary "go.mau.fi/whatsmeow/binary" + "go.mau.fi/whatsmeow/types" + "go.mau.fi/whatsmeow/types/events" +) + +func (cli *Client) handleStreamError(node *waBinary.Node) { + atomic.StoreUint32(&cli.isLoggedIn, 0) + cli.clearResponseWaiters(node) + code, _ := node.Attrs["code"].(string) + conflict, _ := node.GetOptionalChildByTag("conflict") + conflictType := conflict.AttrGetter().OptionalString("type") + switch { + case code == "515": + cli.Log.Infof("Got 515 code, reconnecting...") + go func() { + cli.Disconnect() + err := cli.Connect() + if err != nil { + cli.Log.Errorf("Failed to reconnect after 515 code:", err) + } + }() + case code == "401" && conflictType == "device_removed": + cli.expectDisconnect() + cli.Log.Infof("Got device removed stream error, sending LoggedOut event and deleting session") + go cli.dispatchEvent(&events.LoggedOut{OnConnect: false, Reason: events.ConnectFailureLoggedOut}) + err := cli.Store.Delete() + if err != nil { + cli.Log.Warnf("Failed to delete store after device_removed error: %v", err) + } + case conflictType == "replaced": + cli.expectDisconnect() + cli.Log.Infof("Got replaced stream error, sending StreamReplaced event") + go cli.dispatchEvent(&events.StreamReplaced{}) + case code == "503": + // This seems to happen when the server wants to restart or something. + // The disconnection will be emitted as an events.Disconnected and then the auto-reconnect will do its thing. + cli.Log.Warnf("Got 503 stream error, assuming automatic reconnect will handle it") + default: + cli.Log.Errorf("Unknown stream error: %s", node.XMLString()) + go cli.dispatchEvent(&events.StreamError{Code: code, Raw: node}) + } +} + +func (cli *Client) handleIB(node *waBinary.Node) { + children := node.GetChildren() + for _, child := range children { + ag := child.AttrGetter() + switch child.Tag { + case "downgrade_webclient": + go cli.dispatchEvent(&events.QRScannedWithoutMultidevice{}) + case "offline_preview": + cli.dispatchEvent(&events.OfflineSyncPreview{ + Total: ag.Int("count"), + AppDataChanges: ag.Int("appdata"), + Messages: ag.Int("message"), + Notifications: ag.Int("notification"), + Receipts: ag.Int("receipt"), + }) + case "offline": + cli.dispatchEvent(&events.OfflineSyncCompleted{ + Count: ag.Int("count"), + }) + } + } +} + +func (cli *Client) handleConnectFailure(node *waBinary.Node) { + ag := node.AttrGetter() + reason := events.ConnectFailureReason(ag.Int("reason")) + cli.expectDisconnect() + if reason.IsLoggedOut() { + cli.Log.Infof("Got %s connect failure, sending LoggedOut event and deleting session", reason) + go cli.dispatchEvent(&events.LoggedOut{OnConnect: true, Reason: reason}) + err := cli.Store.Delete() + if err != nil { + cli.Log.Warnf("Failed to delete store after %d failure: %v", int(reason), err) + } + } else if reason == events.ConnectFailureTempBanned { + cli.Log.Warnf("Temporary ban connect failure: %s", node.XMLString()) + go cli.dispatchEvent(&events.TemporaryBan{ + Code: events.TempBanReason(ag.Int("code")), + Expire: time.Duration(ag.Int("expire")) * time.Second, + }) + } else if reason == events.ConnectFailureClientOutdated { + cli.Log.Errorf("Client outdated (405) connect failure") + go cli.dispatchEvent(&events.ClientOutdated{}) + } else { + cli.Log.Warnf("Unknown connect failure: %s", node.XMLString()) + go cli.dispatchEvent(&events.ConnectFailure{Reason: reason, Raw: node}) + } +} + +func (cli *Client) handleConnectSuccess(node *waBinary.Node) { + cli.Log.Infof("Successfully authenticated") + cli.LastSuccessfulConnect = time.Now() + cli.AutoReconnectErrors = 0 + atomic.StoreUint32(&cli.isLoggedIn, 1) + go func() { + if dbCount, err := cli.Store.PreKeys.UploadedPreKeyCount(); err != nil { + cli.Log.Errorf("Failed to get number of prekeys in database: %v", err) + } else if serverCount, err := cli.getServerPreKeyCount(); err != nil { + cli.Log.Warnf("Failed to get number of prekeys on server: %v", err) + } else { + cli.Log.Debugf("Database has %d prekeys, server says we have %d", dbCount, serverCount) + if serverCount < MinPreKeyCount || dbCount < MinPreKeyCount { + cli.uploadPreKeys() + sc, _ := cli.getServerPreKeyCount() + cli.Log.Debugf("Prekey count after upload: %d", sc) + } + } + err := cli.SetPassive(false) + if err != nil { + cli.Log.Warnf("Failed to send post-connect passive IQ: %v", err) + } + cli.dispatchEvent(&events.Connected{}) + cli.closeSocketWaitChan() + }() +} + +// SetPassive tells the WhatsApp server whether this device is passive or not. +// +// This seems to mostly affect whether the device receives certain events. +// By default, whatsmeow will automatically do SetPassive(false) after connecting. +func (cli *Client) SetPassive(passive bool) error { + tag := "active" + if passive { + tag = "passive" + } + _, err := cli.sendIQ(infoQuery{ + Namespace: "passive", + Type: "set", + To: types.ServerJID, + Content: []waBinary.Node{{Tag: tag}}, + }) + if err != nil { + return err + } + return nil +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/download.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/download.go new file mode 100644 index 0000000..99fd364 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/download.go @@ -0,0 +1,303 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package whatsmeow + +import ( + "crypto/hmac" + "crypto/sha256" + "encoding/base64" + "fmt" + "io" + "net/http" + "strings" + + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + + waProto "go.mau.fi/whatsmeow/binary/proto" + "go.mau.fi/whatsmeow/socket" + "go.mau.fi/whatsmeow/util/cbcutil" + "go.mau.fi/whatsmeow/util/hkdfutil" +) + +// MediaType represents a type of uploaded file on WhatsApp. +// The value is the key which is used as a part of generating the encryption keys. +type MediaType string + +// The known media types +const ( + MediaImage MediaType = "WhatsApp Image Keys" + MediaVideo MediaType = "WhatsApp Video Keys" + MediaAudio MediaType = "WhatsApp Audio Keys" + MediaDocument MediaType = "WhatsApp Document Keys" + MediaHistory MediaType = "WhatsApp History Keys" + MediaAppState MediaType = "WhatsApp App State Keys" + + MediaLinkThumbnail MediaType = "WhatsApp Link Thumbnail Keys" +) + +// DownloadableMessage represents a protobuf message that contains attachment info. +// +// All of the downloadable messages inside a Message struct implement this interface +// (ImageMessage, VideoMessage, AudioMessage, DocumentMessage, StickerMessage). +type DownloadableMessage interface { + proto.Message + GetDirectPath() string + GetMediaKey() []byte + GetFileSha256() []byte + GetFileEncSha256() []byte +} + +// DownloadableThumbnail represents a protobuf message that contains a thumbnail attachment. +// +// This is primarily meant for link preview thumbnails in ExtendedTextMessage. +type DownloadableThumbnail interface { + proto.Message + GetThumbnailDirectPath() string + GetThumbnailSha256() []byte + GetThumbnailEncSha256() []byte + GetMediaKey() []byte +} + +// All the message types that are intended to be downloadable +var ( + _ DownloadableMessage = (*waProto.ImageMessage)(nil) + _ DownloadableMessage = (*waProto.AudioMessage)(nil) + _ DownloadableMessage = (*waProto.VideoMessage)(nil) + _ DownloadableMessage = (*waProto.DocumentMessage)(nil) + _ DownloadableMessage = (*waProto.StickerMessage)(nil) + _ DownloadableMessage = (*waProto.StickerMetadata)(nil) + _ DownloadableMessage = (*waProto.HistorySyncNotification)(nil) + _ DownloadableMessage = (*waProto.ExternalBlobReference)(nil) + _ DownloadableThumbnail = (*waProto.ExtendedTextMessage)(nil) +) + +type downloadableMessageWithLength interface { + DownloadableMessage + GetFileLength() uint64 +} + +type downloadableMessageWithSizeBytes interface { + DownloadableMessage + GetFileSizeBytes() uint64 +} + +type downloadableMessageWithURL interface { + DownloadableMessage + GetUrl() string +} + +var classToMediaType = map[protoreflect.Name]MediaType{ + "ImageMessage": MediaImage, + "AudioMessage": MediaAudio, + "VideoMessage": MediaVideo, + "DocumentMessage": MediaDocument, + "StickerMessage": MediaImage, + "StickerMetadata": MediaImage, + + "HistorySyncNotification": MediaHistory, + "ExternalBlobReference": MediaAppState, +} + +var classToThumbnailMediaType = map[protoreflect.Name]MediaType{ + "ExtendedTextMessage": MediaLinkThumbnail, +} + +var mediaTypeToMMSType = map[MediaType]string{ + MediaImage: "image", + MediaAudio: "audio", + MediaVideo: "video", + MediaDocument: "document", + MediaHistory: "md-msg-hist", + MediaAppState: "md-app-state", + + MediaLinkThumbnail: "thumbnail-link", +} + +// DownloadAny loops through the downloadable parts of the given message and downloads the first non-nil item. +func (cli *Client) DownloadAny(msg *waProto.Message) (data []byte, err error) { + if msg == nil { + return nil, ErrNothingDownloadableFound + } + switch { + case msg.ImageMessage != nil: + return cli.Download(msg.ImageMessage) + case msg.VideoMessage != nil: + return cli.Download(msg.VideoMessage) + case msg.AudioMessage != nil: + return cli.Download(msg.AudioMessage) + case msg.DocumentMessage != nil: + return cli.Download(msg.DocumentMessage) + case msg.StickerMessage != nil: + return cli.Download(msg.StickerMessage) + default: + return nil, ErrNothingDownloadableFound + } +} + +func getSize(msg DownloadableMessage) int { + switch sized := msg.(type) { + case downloadableMessageWithLength: + return int(sized.GetFileLength()) + case downloadableMessageWithSizeBytes: + return int(sized.GetFileSizeBytes()) + default: + return -1 + } +} + +// DownloadThumbnail downloads a thumbnail from a message. +// +// This is primarily intended for downloading link preview thumbnails, which are in ExtendedTextMessage: +// +// var msg *waProto.Message +// ... +// thumbnailImageBytes, err := cli.DownloadThumbnail(msg.GetExtendedTextMessage()) +func (cli *Client) DownloadThumbnail(msg DownloadableThumbnail) ([]byte, error) { + mediaType, ok := classToThumbnailMediaType[msg.ProtoReflect().Descriptor().Name()] + if !ok { + return nil, fmt.Errorf("%w '%s'", ErrUnknownMediaType, string(msg.ProtoReflect().Descriptor().Name())) + } else if len(msg.GetThumbnailDirectPath()) > 0 { + return cli.DownloadMediaWithPath(msg.GetThumbnailDirectPath(), msg.GetThumbnailEncSha256(), msg.GetThumbnailSha256(), msg.GetMediaKey(), -1, mediaType, mediaTypeToMMSType[mediaType]) + } else { + return nil, ErrNoURLPresent + } +} + +// GetMediaType returns the MediaType value corresponding to the given protobuf message. +func GetMediaType(msg DownloadableMessage) MediaType { + return classToMediaType[msg.ProtoReflect().Descriptor().Name()] +} + +// Download downloads the attachment from the given protobuf message. +// +// The attachment is a specific part of a Message protobuf struct, not the message itself, e.g. +// +// var msg *waProto.Message +// ... +// imageData, err := cli.Download(msg.GetImageMessage()) +// +// You can also use DownloadAny to download the first non-nil sub-message. +func (cli *Client) Download(msg DownloadableMessage) ([]byte, error) { + mediaType, ok := classToMediaType[msg.ProtoReflect().Descriptor().Name()] + if !ok { + return nil, fmt.Errorf("%w '%s'", ErrUnknownMediaType, string(msg.ProtoReflect().Descriptor().Name())) + } + urlable, ok := msg.(downloadableMessageWithURL) + var url string + var isWebWhatsappNetURL bool + if ok { + url = urlable.GetUrl() + isWebWhatsappNetURL = strings.HasPrefix(urlable.GetUrl(), "https://web.whatsapp.net") + } + if len(url) > 0 && !isWebWhatsappNetURL { + return cli.downloadAndDecrypt(urlable.GetUrl(), msg.GetMediaKey(), mediaType, getSize(msg), msg.GetFileEncSha256(), msg.GetFileSha256()) + } else if len(msg.GetDirectPath()) > 0 { + return cli.DownloadMediaWithPath(msg.GetDirectPath(), msg.GetFileEncSha256(), msg.GetFileSha256(), msg.GetMediaKey(), getSize(msg), mediaType, mediaTypeToMMSType[mediaType]) + } else { + if isWebWhatsappNetURL { + cli.Log.Warnf("Got a media message with a web.whatsapp.net URL (%s) and no direct path", url) + } + return nil, ErrNoURLPresent + } +} + +// DownloadMediaWithPath downloads an attachment by manually specifying the path and encryption details. +func (cli *Client) DownloadMediaWithPath(directPath string, encFileHash, fileHash, mediaKey []byte, fileLength int, mediaType MediaType, mmsType string) (data []byte, err error) { + var mediaConn *MediaConn + mediaConn, err = cli.refreshMediaConn(false) + if err != nil { + return nil, fmt.Errorf("failed to refresh media connections: %w", err) + } + if len(mmsType) == 0 { + mmsType = mediaTypeToMMSType[mediaType] + } + for i, host := range mediaConn.Hosts { + mediaURL := fmt.Sprintf("https://%s%s&hash=%s&mms-type=%s&__wa-mms=", host.Hostname, directPath, base64.URLEncoding.EncodeToString(encFileHash), mmsType) + data, err = cli.downloadAndDecrypt(mediaURL, mediaKey, mediaType, fileLength, encFileHash, fileHash) + // TODO there are probably some errors that shouldn't retry + if err != nil { + if i >= len(mediaConn.Hosts)-1 { + return nil, fmt.Errorf("failed to download media from last host: %w", err) + } + cli.Log.Warnf("Failed to download media: %s, trying with next host...", err) + } + } + return +} + +func (cli *Client) downloadAndDecrypt(url string, mediaKey []byte, appInfo MediaType, fileLength int, fileEncSha256, fileSha256 []byte) (data []byte, err error) { + iv, cipherKey, macKey, _ := getMediaKeys(mediaKey, appInfo) + var ciphertext, mac []byte + if ciphertext, mac, err = cli.downloadEncryptedMedia(url, fileEncSha256); err != nil { + + } else if err = validateMedia(iv, ciphertext, macKey, mac); err != nil { + + } else if data, err = cbcutil.Decrypt(cipherKey, iv, ciphertext); err != nil { + err = fmt.Errorf("failed to decrypt file: %w", err) + } else if fileLength >= 0 && len(data) != fileLength { + err = fmt.Errorf("%w: expected %d, got %d", ErrFileLengthMismatch, fileLength, len(data)) + } else if len(fileSha256) == 32 && sha256.Sum256(data) != *(*[32]byte)(fileSha256) { + err = ErrInvalidMediaSHA256 + } + return +} + +func getMediaKeys(mediaKey []byte, appInfo MediaType) (iv, cipherKey, macKey, refKey []byte) { + mediaKeyExpanded := hkdfutil.SHA256(mediaKey, nil, []byte(appInfo), 112) + return mediaKeyExpanded[:16], mediaKeyExpanded[16:48], mediaKeyExpanded[48:80], mediaKeyExpanded[80:] +} + +func (cli *Client) downloadEncryptedMedia(url string, checksum []byte) (file, mac []byte, err error) { + var req *http.Request + req, err = http.NewRequest(http.MethodGet, url, nil) + if err != nil { + err = fmt.Errorf("failed to prepare request: %w", err) + return + } + req.Header.Set("Origin", socket.Origin) + req.Header.Set("Referer", socket.Origin+"/") + var resp *http.Response + resp, err = cli.http.Do(req) + if err != nil { + return + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + if resp.StatusCode == http.StatusNotFound { + err = ErrMediaDownloadFailedWith404 + } else if resp.StatusCode == http.StatusGone { + err = ErrMediaDownloadFailedWith410 + } else { + err = fmt.Errorf("download failed with status code %d", resp.StatusCode) + } + return + } + var data []byte + data, err = io.ReadAll(resp.Body) + if err != nil { + return + } else if len(data) <= 10 { + err = ErrTooShortFile + return + } + file, mac = data[:len(data)-10], data[len(data)-10:] + if len(checksum) == 32 && sha256.Sum256(data) != *(*[32]byte)(checksum) { + err = ErrInvalidMediaEncSHA256 + } + return +} + +func validateMedia(iv, file, macKey, mac []byte) error { + h := hmac.New(sha256.New, macKey) + h.Write(iv) + h.Write(file) + if !hmac.Equal(h.Sum(nil)[:10], mac) { + return ErrInvalidMediaHMAC + } + return nil +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/errors.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/errors.go new file mode 100644 index 0000000..62227f3 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/errors.go @@ -0,0 +1,240 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package whatsmeow + +import ( + "errors" + "fmt" + + waBinary "go.mau.fi/whatsmeow/binary" +) + +// Miscellaneous errors +var ( + ErrNoSession = errors.New("can't encrypt message for device: no signal session established") + ErrIQTimedOut = errors.New("info query timed out") + ErrNotConnected = errors.New("websocket not connected") + ErrNotLoggedIn = errors.New("the store doesn't contain a device JID") + ErrMessageTimedOut = errors.New("timed out waiting for message send response") + + ErrAlreadyConnected = errors.New("websocket is already connected") + + ErrQRAlreadyConnected = errors.New("GetQRChannel must be called before connecting") + ErrQRStoreContainsID = errors.New("GetQRChannel can only be called when there's no user ID in the client's Store") + + ErrNoPushName = errors.New("can't send presence without PushName set") + + ErrNoPrivacyToken = errors.New("no privacy token stored") +) + +// Errors that happen while confirming device pairing +var ( + ErrPairInvalidDeviceIdentityHMAC = errors.New("invalid device identity HMAC in pair success message") + ErrPairInvalidDeviceSignature = errors.New("invalid device signature in pair success message") + ErrPairRejectedLocally = errors.New("local PrePairCallback rejected pairing") +) + +// PairProtoError is included in an events.PairError if the pairing failed due to a protobuf error. +type PairProtoError struct { + Message string + ProtoErr error +} + +func (err *PairProtoError) Error() string { + return fmt.Sprintf("%s: %v", err.Message, err.ProtoErr) +} + +func (err *PairProtoError) Unwrap() error { + return err.ProtoErr +} + +// PairDatabaseError is included in an events.PairError if the pairing failed due to being unable to save the credentials to the device store. +type PairDatabaseError struct { + Message string + DBErr error +} + +func (err *PairDatabaseError) Error() string { + return fmt.Sprintf("%s: %v", err.Message, err.DBErr) +} + +func (err *PairDatabaseError) Unwrap() error { + return err.DBErr +} + +var ( + // ErrProfilePictureUnauthorized is returned by GetProfilePictureInfo when trying to get the profile picture of a user + // whose privacy settings prevent you from seeing their profile picture (status code 401). + ErrProfilePictureUnauthorized = errors.New("the user has hidden their profile picture from you") + // ErrProfilePictureNotSet is returned by GetProfilePictureInfo when the given user or group doesn't have a profile + // picture (status code 404). + ErrProfilePictureNotSet = errors.New("that user or group does not have a profile picture") + // ErrGroupInviteLinkUnauthorized is returned by GetGroupInviteLink if you don't have the permission to get the link (status code 401). + ErrGroupInviteLinkUnauthorized = errors.New("you don't have the permission to get the group's invite link") + // ErrNotInGroup is returned by group info getting methods if you're not in the group (status code 403). + ErrNotInGroup = errors.New("you're not participating in that group") + // ErrGroupNotFound is returned by group info getting methods if the group doesn't exist (status code 404). + ErrGroupNotFound = errors.New("that group does not exist") + // ErrInviteLinkInvalid is returned by methods that use group invite links if the invite link is malformed. + ErrInviteLinkInvalid = errors.New("that group invite link is not valid") + // ErrInviteLinkRevoked is returned by methods that use group invite links if the invite link was valid, but has been revoked and can no longer be used. + ErrInviteLinkRevoked = errors.New("that group invite link has been revoked") + // ErrBusinessMessageLinkNotFound is returned by ResolveBusinessMessageLink if the link doesn't exist or has been revoked. + ErrBusinessMessageLinkNotFound = errors.New("that business message link does not exist or has been revoked") + // ErrContactQRLinkNotFound is returned by ResolveContactQRLink if the link doesn't exist or has been revoked. + ErrContactQRLinkNotFound = errors.New("that contact QR link does not exist or has been revoked") + // ErrInvalidImageFormat is returned by SetGroupPhoto if the given photo is not in the correct format. + ErrInvalidImageFormat = errors.New("the given data is not a valid image") + // ErrMediaNotAvailableOnPhone is returned by DecryptMediaRetryNotification if the given event contains error code 2. + ErrMediaNotAvailableOnPhone = errors.New("media no longer available on phone") + // ErrUnknownMediaRetryError is returned by DecryptMediaRetryNotification if the given event contains an unknown error code. + ErrUnknownMediaRetryError = errors.New("unknown media retry error") + // ErrInvalidDisappearingTimer is returned by SetDisappearingTimer if the given timer is not one of the allowed values. + ErrInvalidDisappearingTimer = errors.New("invalid disappearing timer provided") +) + +// Some errors that Client.SendMessage can return +var ( + ErrBroadcastListUnsupported = errors.New("sending to non-status broadcast lists is not yet supported") + ErrUnknownServer = errors.New("can't send message to unknown server") + ErrRecipientADJID = errors.New("message recipient must be normal (non-AD) JID") + ErrServerReturnedError = errors.New("server returned error") +) + +// Some errors that Client.Download can return +var ( + ErrMediaDownloadFailedWith404 = errors.New("download failed with status code 404") + ErrMediaDownloadFailedWith410 = errors.New("download failed with status code 410") + ErrNoURLPresent = errors.New("no url present") + ErrFileLengthMismatch = errors.New("file length does not match") + ErrTooShortFile = errors.New("file too short") + ErrInvalidMediaHMAC = errors.New("invalid media hmac") + ErrInvalidMediaEncSHA256 = errors.New("hash of media ciphertext doesn't match") + ErrInvalidMediaSHA256 = errors.New("hash of media plaintext doesn't match") + ErrUnknownMediaType = errors.New("unknown media type") + ErrNothingDownloadableFound = errors.New("didn't find any attachments in message") +) + +var ( + ErrOriginalMessageSecretNotFound = errors.New("original message secret key not found") + ErrNotEncryptedReactionMessage = errors.New("given message isn't an encrypted reaction message") + ErrNotPollUpdateMessage = errors.New("given message isn't a poll update message") +) + +type wrappedIQError struct { + HumanError error + IQError error +} + +func (err *wrappedIQError) Error() string { + return err.HumanError.Error() +} + +func (err *wrappedIQError) Is(other error) bool { + return errors.Is(other, err.HumanError) +} + +func (err *wrappedIQError) Unwrap() error { + return err.IQError +} + +func wrapIQError(human, iq error) error { + return &wrappedIQError{human, iq} +} + +// IQError is a generic error container for info queries +type IQError struct { + Code int + Text string + ErrorNode *waBinary.Node + RawNode *waBinary.Node +} + +// Common errors returned by info queries for use with errors.Is +var ( + ErrIQBadRequest error = &IQError{Code: 400, Text: "bad-request"} + ErrIQNotAuthorized error = &IQError{Code: 401, Text: "not-authorized"} + ErrIQForbidden error = &IQError{Code: 403, Text: "forbidden"} + ErrIQNotFound error = &IQError{Code: 404, Text: "item-not-found"} + ErrIQNotAllowed error = &IQError{Code: 405, Text: "not-allowed"} + ErrIQNotAcceptable error = &IQError{Code: 406, Text: "not-acceptable"} + ErrIQGone error = &IQError{Code: 410, Text: "gone"} + ErrIQResourceLimit error = &IQError{Code: 419, Text: "resource-limit"} + ErrIQLocked error = &IQError{Code: 423, Text: "locked"} + ErrIQInternalServerError error = &IQError{Code: 500, Text: "internal-server-error"} + ErrIQServiceUnavailable error = &IQError{Code: 503, Text: "service-unavailable"} + ErrIQPartialServerError error = &IQError{Code: 530, Text: "partial-server-error"} +) + +func parseIQError(node *waBinary.Node) error { + var err IQError + err.RawNode = node + val, ok := node.GetOptionalChildByTag("error") + if ok { + err.ErrorNode = &val + ag := val.AttrGetter() + err.Code = ag.OptionalInt("code") + err.Text = ag.OptionalString("text") + } + return &err +} + +func (iqe *IQError) Error() string { + if iqe.Code == 0 { + if iqe.ErrorNode != nil { + return fmt.Sprintf("info query returned unknown error: %s", iqe.ErrorNode.XMLString()) + } else if iqe.RawNode != nil { + return fmt.Sprintf("info query returned unexpected response: %s", iqe.RawNode.XMLString()) + } else { + return "unknown info query error" + } + } + return fmt.Sprintf("info query returned status %d: %s", iqe.Code, iqe.Text) +} + +func (iqe *IQError) Is(other error) bool { + otherIQE, ok := other.(*IQError) + if !ok { + return false + } else if iqe.Code != 0 && otherIQE.Code != 0 { + return otherIQE.Code == iqe.Code && otherIQE.Text == iqe.Text + } else if iqe.ErrorNode != nil && otherIQE.ErrorNode != nil { + return iqe.ErrorNode.XMLString() == otherIQE.ErrorNode.XMLString() + } else { + return false + } +} + +// ElementMissingError is returned by various functions that parse XML elements when a required element is missing. +type ElementMissingError struct { + Tag string + In string +} + +func (eme *ElementMissingError) Error() string { + return fmt.Sprintf("missing <%s> element in %s", eme.Tag, eme.In) +} + +var ErrIQDisconnected = &DisconnectedError{Action: "info query"} + +// DisconnectedError is returned if the websocket disconnects before an info query or other request gets a response. +type DisconnectedError struct { + Action string + Node *waBinary.Node +} + +func (err *DisconnectedError) Error() string { + return fmt.Sprintf("websocket disconnected before %s returned response", err.Action) +} + +func (err *DisconnectedError) Is(other error) bool { + otherDisc, ok := other.(*DisconnectedError) + if !ok { + return false + } + return otherDisc.Action == err.Action +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/group.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/group.go new file mode 100644 index 0000000..c771b5a --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/group.go @@ -0,0 +1,790 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package whatsmeow + +import ( + "context" + "errors" + "fmt" + "strings" + + waBinary "go.mau.fi/whatsmeow/binary" + "go.mau.fi/whatsmeow/types" + "go.mau.fi/whatsmeow/types/events" +) + +const InviteLinkPrefix = "https://chat.whatsapp.com/" + +func (cli *Client) sendGroupIQ(ctx context.Context, iqType infoQueryType, jid types.JID, content waBinary.Node) (*waBinary.Node, error) { + return cli.sendIQ(infoQuery{ + Context: ctx, + Namespace: "w:g2", + Type: iqType, + To: jid, + Content: []waBinary.Node{content}, + }) +} + +// ReqCreateGroup contains the request data for CreateGroup. +type ReqCreateGroup struct { + // Group names are limited to 25 characters. A longer group name will cause a 406 not acceptable error. + Name string + // You don't need to include your own JID in the participants array, the WhatsApp servers will add it implicitly. + Participants []types.JID + // A create key can be provided to deduplicate the group create notification that will be triggered + // when the group is created. If provided, the JoinedGroup event will contain the same key. + CreateKey types.MessageID + // Set IsParent to true to create a community instead of a normal group. + // When creating a community, the linked announcement group will be created automatically by the server. + types.GroupParent + // Set LinkedParentJID to create a group inside a community. + types.GroupLinkedParent +} + +// CreateGroup creates a group on WhatsApp with the given name and participants. +// +// See ReqCreateGroup for parameters. +func (cli *Client) CreateGroup(req ReqCreateGroup) (*types.GroupInfo, error) { + participantNodes := make([]waBinary.Node, len(req.Participants), len(req.Participants)+1) + for i, participant := range req.Participants { + participantNodes[i] = waBinary.Node{ + Tag: "participant", + Attrs: waBinary.Attrs{"jid": participant}, + } + } + if req.CreateKey == "" { + req.CreateKey = GenerateMessageID() + } + if req.IsParent { + if req.DefaultMembershipApprovalMode == "" { + req.DefaultMembershipApprovalMode = "request_required" + } + participantNodes = append(participantNodes, waBinary.Node{ + Tag: "parent", + Attrs: waBinary.Attrs{ + "default_membership_approval_mode": req.DefaultMembershipApprovalMode, + }, + }) + } else if !req.LinkedParentJID.IsEmpty() { + participantNodes = append(participantNodes, waBinary.Node{ + Tag: "linked_parent", + Attrs: waBinary.Attrs{"jid": req.LinkedParentJID}, + }) + } + // WhatsApp web doesn't seem to include the static prefix for these + key := strings.TrimPrefix(req.CreateKey, "3EB0") + resp, err := cli.sendGroupIQ(context.TODO(), iqSet, types.GroupServerJID, waBinary.Node{ + Tag: "create", + Attrs: waBinary.Attrs{ + "subject": req.Name, + "key": key, + }, + Content: participantNodes, + }) + if err != nil { + return nil, err + } + groupNode, ok := resp.GetOptionalChildByTag("group") + if !ok { + return nil, &ElementMissingError{Tag: "group", In: "response to create group query"} + } + return cli.parseGroupNode(&groupNode) +} + +// UnlinkGroup removes a child group from a parent community. +func (cli *Client) UnlinkGroup(parent, child types.JID) error { + _, err := cli.sendGroupIQ(context.TODO(), iqSet, parent, waBinary.Node{ + Tag: "unlink", + Attrs: waBinary.Attrs{"unlink_type": types.GroupLinkChangeTypeSub}, + Content: []waBinary.Node{{ + Tag: "group", + Attrs: waBinary.Attrs{"jid": child}, + }}, + }) + return err +} + +// LinkGroup adds an existing group as a child group in a community. +// +// To create a new group within a community, set LinkedParentJID in the CreateGroup request. +func (cli *Client) LinkGroup(parent, child types.JID) error { + _, err := cli.sendGroupIQ(context.TODO(), iqSet, parent, waBinary.Node{ + Tag: "links", + Content: []waBinary.Node{{ + Tag: "link", + Attrs: waBinary.Attrs{"link_type": types.GroupLinkChangeTypeSub}, + Content: []waBinary.Node{{ + Tag: "group", + Attrs: waBinary.Attrs{"jid": child}, + }}, + }}, + }) + return err +} + +// LeaveGroup leaves the specified group on WhatsApp. +func (cli *Client) LeaveGroup(jid types.JID) error { + _, err := cli.sendGroupIQ(context.TODO(), iqSet, types.GroupServerJID, waBinary.Node{ + Tag: "leave", + Content: []waBinary.Node{{ + Tag: "group", + Attrs: waBinary.Attrs{"id": jid}, + }}, + }) + return err +} + +type ParticipantChange string + +const ( + ParticipantChangeAdd ParticipantChange = "add" + ParticipantChangeRemove ParticipantChange = "remove" + ParticipantChangePromote ParticipantChange = "promote" + ParticipantChangeDemote ParticipantChange = "demote" +) + +// UpdateGroupParticipants can be used to add, remove, promote and demote members in a WhatsApp group. +func (cli *Client) UpdateGroupParticipants(jid types.JID, participantChanges map[types.JID]ParticipantChange) (*waBinary.Node, error) { + content := make([]waBinary.Node, len(participantChanges)) + i := 0 + for participantJID, change := range participantChanges { + content[i] = waBinary.Node{ + Tag: string(change), + Content: []waBinary.Node{{ + Tag: "participant", + Attrs: waBinary.Attrs{"jid": participantJID}, + }}, + } + i++ + } + resp, err := cli.sendIQ(infoQuery{ + Namespace: "w:g2", + Type: iqSet, + To: jid, + Content: content, + }) + if err != nil { + return nil, err + } + // TODO proper return value? + return resp, nil +} + +// SetGroupPhoto updates the group picture/icon of the given group on WhatsApp. +// The avatar should be a JPEG photo, other formats may be rejected with ErrInvalidImageFormat. +// The bytes can be nil to remove the photo. Returns the new picture ID. +func (cli *Client) SetGroupPhoto(jid types.JID, avatar []byte) (string, error) { + var content interface{} + if avatar != nil { + content = []waBinary.Node{{ + Tag: "picture", + Attrs: waBinary.Attrs{"type": "image"}, + Content: avatar, + }} + } + resp, err := cli.sendIQ(infoQuery{ + Namespace: "w:profile:picture", + Type: iqSet, + To: types.ServerJID, + Target: jid, + Content: content, + }) + if errors.Is(err, ErrIQNotAcceptable) { + return "", wrapIQError(ErrInvalidImageFormat, err) + } else if err != nil { + return "", err + } + if avatar == nil { + return "remove", nil + } + pictureID, ok := resp.GetChildByTag("picture").Attrs["id"].(string) + if !ok { + return "", fmt.Errorf("didn't find picture ID in response") + } + return pictureID, nil +} + +// SetGroupName updates the name (subject) of the given group on WhatsApp. +func (cli *Client) SetGroupName(jid types.JID, name string) error { + _, err := cli.sendGroupIQ(context.TODO(), iqSet, jid, waBinary.Node{ + Tag: "subject", + Content: []byte(name), + }) + return err +} + +// SetGroupTopic updates the topic (description) of the given group on WhatsApp. +// +// The previousID and newID fields are optional. If the previous ID is not specified, this will +// automatically fetch the current group info to find the previous topic ID. If the new ID is not +// specified, one will be generated with GenerateMessageID(). +func (cli *Client) SetGroupTopic(jid types.JID, previousID, newID, topic string) error { + if previousID == "" { + oldInfo, err := cli.GetGroupInfo(jid) + if err != nil { + return fmt.Errorf("failed to get old group info to update topic: %v", err) + } + previousID = oldInfo.TopicID + } + if newID == "" { + newID = GenerateMessageID() + } + attrs := waBinary.Attrs{ + "id": newID, + } + if previousID != "" { + attrs["prev"] = previousID + } + content := []waBinary.Node{{ + Tag: "body", + Content: []byte(topic), + }} + if len(topic) == 0 { + attrs["delete"] = "true" + content = nil + } + _, err := cli.sendGroupIQ(context.TODO(), iqSet, jid, waBinary.Node{ + Tag: "description", + Attrs: attrs, + Content: content, + }) + return err +} + +// SetGroupLocked changes whether the group is locked (i.e. whether only admins can modify group info). +func (cli *Client) SetGroupLocked(jid types.JID, locked bool) error { + tag := "locked" + if !locked { + tag = "unlocked" + } + _, err := cli.sendGroupIQ(context.TODO(), iqSet, jid, waBinary.Node{Tag: tag}) + return err +} + +// SetGroupAnnounce changes whether the group is in announce mode (i.e. whether only admins can send messages). +func (cli *Client) SetGroupAnnounce(jid types.JID, announce bool) error { + tag := "announcement" + if !announce { + tag = "not_announcement" + } + _, err := cli.sendGroupIQ(context.TODO(), iqSet, jid, waBinary.Node{Tag: tag}) + return err +} + +// GetGroupInviteLink requests the invite link to the group from the WhatsApp servers. +// +// If reset is true, then the old invite link will be revoked and a new one generated. +func (cli *Client) GetGroupInviteLink(jid types.JID, reset bool) (string, error) { + iqType := iqGet + if reset { + iqType = iqSet + } + resp, err := cli.sendGroupIQ(context.TODO(), iqType, jid, waBinary.Node{Tag: "invite"}) + if errors.Is(err, ErrIQNotAuthorized) { + return "", wrapIQError(ErrGroupInviteLinkUnauthorized, err) + } else if errors.Is(err, ErrIQNotFound) { + return "", wrapIQError(ErrGroupNotFound, err) + } else if errors.Is(err, ErrIQForbidden) { + return "", wrapIQError(ErrNotInGroup, err) + } else if err != nil { + return "", err + } + code, ok := resp.GetChildByTag("invite").Attrs["code"].(string) + if !ok { + return "", fmt.Errorf("didn't find invite code in response") + } + return InviteLinkPrefix + code, nil +} + +// GetGroupInfoFromInvite gets the group info from an invite message. +// +// Note that this is specifically for invite messages, not invite links. Use GetGroupInfoFromLink for resolving chat.whatsapp.com links. +func (cli *Client) GetGroupInfoFromInvite(jid, inviter types.JID, code string, expiration int64) (*types.GroupInfo, error) { + resp, err := cli.sendGroupIQ(context.TODO(), iqGet, jid, waBinary.Node{ + Tag: "query", + Content: []waBinary.Node{{ + Tag: "add_request", + Attrs: waBinary.Attrs{ + "code": code, + "expiration": expiration, + "admin": inviter, + }, + }}, + }) + if err != nil { + return nil, err + } + groupNode, ok := resp.GetOptionalChildByTag("group") + if !ok { + return nil, &ElementMissingError{Tag: "group", In: "response to invite group info query"} + } + return cli.parseGroupNode(&groupNode) +} + +// JoinGroupWithInvite joins a group using an invite message. +// +// Note that this is specifically for invite messages, not invite links. Use JoinGroupWithLink for joining with chat.whatsapp.com links. +func (cli *Client) JoinGroupWithInvite(jid, inviter types.JID, code string, expiration int64) error { + _, err := cli.sendGroupIQ(context.TODO(), iqSet, jid, waBinary.Node{ + Tag: "accept", + Attrs: waBinary.Attrs{ + "code": code, + "expiration": expiration, + "admin": inviter, + }, + }) + return err +} + +// GetGroupInfoFromLink resolves the given invite link and asks the WhatsApp servers for info about the group. +// This will not cause the user to join the group. +func (cli *Client) GetGroupInfoFromLink(code string) (*types.GroupInfo, error) { + code = strings.TrimPrefix(code, InviteLinkPrefix) + resp, err := cli.sendGroupIQ(context.TODO(), iqGet, types.GroupServerJID, waBinary.Node{ + Tag: "invite", + Attrs: waBinary.Attrs{"code": code}, + }) + if errors.Is(err, ErrIQGone) { + return nil, wrapIQError(ErrInviteLinkRevoked, err) + } else if errors.Is(err, ErrIQNotAcceptable) { + return nil, wrapIQError(ErrInviteLinkInvalid, err) + } else if err != nil { + return nil, err + } + groupNode, ok := resp.GetOptionalChildByTag("group") + if !ok { + return nil, &ElementMissingError{Tag: "group", In: "response to group link info query"} + } + return cli.parseGroupNode(&groupNode) +} + +// JoinGroupWithLink joins the group using the given invite link. +func (cli *Client) JoinGroupWithLink(code string) (types.JID, error) { + code = strings.TrimPrefix(code, InviteLinkPrefix) + resp, err := cli.sendGroupIQ(context.TODO(), iqSet, types.GroupServerJID, waBinary.Node{ + Tag: "invite", + Attrs: waBinary.Attrs{"code": code}, + }) + if errors.Is(err, ErrIQGone) { + return types.EmptyJID, wrapIQError(ErrInviteLinkRevoked, err) + } else if errors.Is(err, ErrIQNotAcceptable) { + return types.EmptyJID, wrapIQError(ErrInviteLinkInvalid, err) + } else if err != nil { + return types.EmptyJID, err + } + groupNode, ok := resp.GetOptionalChildByTag("group") + if !ok { + return types.EmptyJID, &ElementMissingError{Tag: "group", In: "response to group link join query"} + } + return groupNode.AttrGetter().JID("jid"), nil +} + +// GetJoinedGroups returns the list of groups the user is participating in. +func (cli *Client) GetJoinedGroups() ([]*types.GroupInfo, error) { + resp, err := cli.sendGroupIQ(context.TODO(), iqGet, types.GroupServerJID, waBinary.Node{ + Tag: "participating", + Content: []waBinary.Node{ + {Tag: "participants"}, + {Tag: "description"}, + }, + }) + if err != nil { + return nil, err + } + groups, ok := resp.GetOptionalChildByTag("groups") + if !ok { + return nil, &ElementMissingError{Tag: "groups", In: "response to group list query"} + } + children := groups.GetChildren() + infos := make([]*types.GroupInfo, 0, len(children)) + for _, child := range children { + if child.Tag != "group" { + cli.Log.Debugf("Unexpected child in group list response: %s", child.XMLString()) + continue + } + parsed, parseErr := cli.parseGroupNode(&child) + if parseErr != nil { + cli.Log.Warnf("Error parsing group %s: %v", parsed.JID, parseErr) + } + infos = append(infos, parsed) + } + return infos, nil +} + +// GetSubGroups gets the subgroups of the given community. +func (cli *Client) GetSubGroups(community types.JID) ([]*types.GroupLinkTarget, error) { + res, err := cli.sendGroupIQ(context.TODO(), iqGet, community, waBinary.Node{Tag: "sub_groups"}) + if err != nil { + return nil, err + } + groups, ok := res.GetOptionalChildByTag("sub_groups") + if !ok { + return nil, &ElementMissingError{Tag: "sub_groups", In: "response to subgroups query"} + } + var parsedGroups []*types.GroupLinkTarget + for _, child := range groups.GetChildren() { + if child.Tag == "group" { + parsedGroup, err := parseGroupLinkTargetNode(&child) + if err != nil { + return parsedGroups, fmt.Errorf("failed to parse group in subgroups list: %w", err) + } + parsedGroups = append(parsedGroups, &parsedGroup) + } + } + return parsedGroups, nil +} + +// GetLinkedGroupsParticipants gets all the participants in the groups of the given community. +func (cli *Client) GetLinkedGroupsParticipants(community types.JID) ([]types.JID, error) { + res, err := cli.sendGroupIQ(context.TODO(), iqGet, community, waBinary.Node{Tag: "linked_groups_participants"}) + if err != nil { + return nil, err + } + participants, ok := res.GetOptionalChildByTag("linked_groups_participants") + if !ok { + return nil, &ElementMissingError{Tag: "linked_groups_participants", In: "response to community participants query"} + } + return parseParticipantList(&participants), nil +} + +// GetGroupInfo requests basic info about a group chat from the WhatsApp servers. +func (cli *Client) GetGroupInfo(jid types.JID) (*types.GroupInfo, error) { + return cli.getGroupInfo(context.TODO(), jid, true) +} + +func (cli *Client) getGroupInfo(ctx context.Context, jid types.JID, lockParticipantCache bool) (*types.GroupInfo, error) { + res, err := cli.sendGroupIQ(ctx, iqGet, jid, waBinary.Node{ + Tag: "query", + Attrs: waBinary.Attrs{"request": "interactive"}, + }) + if errors.Is(err, ErrIQNotFound) { + return nil, wrapIQError(ErrGroupNotFound, err) + } else if errors.Is(err, ErrIQForbidden) { + return nil, wrapIQError(ErrNotInGroup, err) + } else if err != nil { + return nil, err + } + + groupNode, ok := res.GetOptionalChildByTag("group") + if !ok { + return nil, &ElementMissingError{Tag: "groups", In: "response to group info query"} + } + groupInfo, err := cli.parseGroupNode(&groupNode) + if err != nil { + return groupInfo, err + } + if lockParticipantCache { + cli.groupParticipantsCacheLock.Lock() + defer cli.groupParticipantsCacheLock.Unlock() + } + participants := make([]types.JID, len(groupInfo.Participants)) + for i, part := range groupInfo.Participants { + participants[i] = part.JID + } + cli.groupParticipantsCache[jid] = participants + return groupInfo, nil +} + +func (cli *Client) getGroupMembers(ctx context.Context, jid types.JID) ([]types.JID, error) { + cli.groupParticipantsCacheLock.Lock() + defer cli.groupParticipantsCacheLock.Unlock() + if _, ok := cli.groupParticipantsCache[jid]; !ok { + _, err := cli.getGroupInfo(ctx, jid, false) + if err != nil { + return nil, err + } + } + return cli.groupParticipantsCache[jid], nil +} + +func (cli *Client) parseGroupNode(groupNode *waBinary.Node) (*types.GroupInfo, error) { + var group types.GroupInfo + ag := groupNode.AttrGetter() + + group.JID = types.NewJID(ag.String("id"), types.GroupServer) + group.OwnerJID = ag.OptionalJIDOrEmpty("creator") + + group.Name = ag.String("subject") + group.NameSetAt = ag.UnixTime("s_t") + group.NameSetBy = ag.OptionalJIDOrEmpty("s_o") + + group.GroupCreated = ag.UnixTime("creation") + + group.AnnounceVersionID = ag.OptionalString("a_v_id") + group.ParticipantVersionID = ag.OptionalString("p_v_id") + + for _, child := range groupNode.GetChildren() { + childAG := child.AttrGetter() + switch child.Tag { + case "participant": + pcpType := childAG.OptionalString("type") + participant := types.GroupParticipant{ + IsAdmin: pcpType == "admin" || pcpType == "superadmin", + IsSuperAdmin: pcpType == "superadmin", + JID: childAG.JID("jid"), + } + if errorCode := childAG.OptionalInt("error"); errorCode != 0 { + participant.Error = errorCode + addRequest, ok := child.GetOptionalChildByTag("add_request") + if ok { + addAG := addRequest.AttrGetter() + participant.AddRequest = &types.GroupParticipantAddRequest{ + Code: addAG.String("code"), + Expiration: addAG.UnixTime("expiration"), + } + } + } + group.Participants = append(group.Participants, participant) + case "description": + body, bodyOK := child.GetOptionalChildByTag("body") + if bodyOK { + topicBytes, _ := body.Content.([]byte) + group.Topic = string(topicBytes) + group.TopicID = childAG.String("id") + group.TopicSetBy = childAG.OptionalJIDOrEmpty("participant") + group.TopicSetAt = childAG.UnixTime("t") + } + case "announcement": + group.IsAnnounce = true + case "locked": + group.IsLocked = true + case "ephemeral": + group.IsEphemeral = true + group.DisappearingTimer = uint32(childAG.Uint64("expiration")) + case "member_add_mode": + modeBytes, _ := child.Content.([]byte) + group.MemberAddMode = types.GroupMemberAddMode(modeBytes) + case "linked_parent": + group.LinkedParentJID = childAG.JID("jid") + case "default_sub_group": + group.IsDefaultSubGroup = true + case "parent": + group.IsParent = true + group.DefaultMembershipApprovalMode = childAG.OptionalString("default_membership_approval_mode") + default: + cli.Log.Debugf("Unknown element in group node %s: %s", group.JID.String(), child.XMLString()) + } + if !childAG.OK() { + cli.Log.Warnf("Possibly failed to parse %s element in group node: %+v", child.Tag, childAG.Errors) + } + } + + return &group, ag.Error() +} + +func parseGroupLinkTargetNode(groupNode *waBinary.Node) (types.GroupLinkTarget, error) { + ag := groupNode.AttrGetter() + jidKey := ag.OptionalJIDOrEmpty("jid") + if jidKey.IsEmpty() { + jidKey = types.NewJID(ag.String("id"), types.GroupServer) + } + return types.GroupLinkTarget{ + JID: jidKey, + GroupName: types.GroupName{ + Name: ag.String("subject"), + NameSetAt: ag.UnixTime("s_t"), + }, + GroupIsDefaultSub: types.GroupIsDefaultSub{ + IsDefaultSubGroup: groupNode.GetChildByTag("default_sub_group").Tag == "default_sub_group", + }, + }, ag.Error() +} + +func parseParticipantList(node *waBinary.Node) (participants []types.JID) { + children := node.GetChildren() + participants = make([]types.JID, 0, len(children)) + for _, child := range children { + jid, ok := child.Attrs["jid"].(types.JID) + if child.Tag != "participant" || !ok { + continue + } + participants = append(participants, jid) + } + return +} + +func (cli *Client) parseGroupCreate(node *waBinary.Node) (*events.JoinedGroup, error) { + groupNode, ok := node.GetOptionalChildByTag("group") + if !ok { + return nil, fmt.Errorf("group create notification didn't contain group info") + } + var evt events.JoinedGroup + ag := node.AttrGetter() + evt.Reason = ag.OptionalString("reason") + evt.CreateKey = ag.OptionalString("key") + evt.Type = ag.OptionalString("type") + info, err := cli.parseGroupNode(&groupNode) + if err != nil { + return nil, fmt.Errorf("failed to parse group info in create notification: %w", err) + } + evt.GroupInfo = *info + return &evt, nil +} + +func (cli *Client) parseGroupChange(node *waBinary.Node) (*events.GroupInfo, error) { + var evt events.GroupInfo + ag := node.AttrGetter() + evt.JID = ag.JID("from") + evt.Notify = ag.OptionalString("notify") + evt.Sender = ag.OptionalJID("participant") + evt.Timestamp = ag.UnixTime("t") + if !ag.OK() { + return nil, fmt.Errorf("group change doesn't contain required attributes: %w", ag.Error()) + } + + for _, child := range node.GetChildren() { + cag := child.AttrGetter() + if child.Tag == "add" || child.Tag == "remove" || child.Tag == "promote" || child.Tag == "demote" { + evt.PrevParticipantVersionID = cag.String("prev_v_id") + evt.ParticipantVersionID = cag.String("v_id") + } + switch child.Tag { + case "add": + evt.JoinReason = cag.OptionalString("reason") + evt.Join = parseParticipantList(&child) + case "remove": + evt.Leave = parseParticipantList(&child) + case "promote": + evt.Promote = parseParticipantList(&child) + case "demote": + evt.Demote = parseParticipantList(&child) + case "locked": + evt.Locked = &types.GroupLocked{IsLocked: true} + case "unlocked": + evt.Locked = &types.GroupLocked{IsLocked: false} + case "delete": + evt.Delete = &types.GroupDelete{Deleted: true, DeleteReason: cag.String("reason")} + case "subject": + evt.Name = &types.GroupName{ + Name: cag.String("subject"), + NameSetAt: cag.UnixTime("s_t"), + NameSetBy: cag.OptionalJIDOrEmpty("s_o"), + } + case "description": + var topicStr string + _, isDelete := child.GetOptionalChildByTag("delete") + if !isDelete { + topicChild := child.GetChildByTag("body") + topicBytes, ok := topicChild.Content.([]byte) + if !ok { + return nil, fmt.Errorf("group change description has unexpected body: %s", topicChild.XMLString()) + } + topicStr = string(topicBytes) + } + var setBy types.JID + if evt.Sender != nil { + setBy = *evt.Sender + } + evt.Topic = &types.GroupTopic{ + Topic: topicStr, + TopicID: cag.String("id"), + TopicSetAt: evt.Timestamp, + TopicSetBy: setBy, + TopicDeleted: isDelete, + } + case "announcement": + evt.Announce = &types.GroupAnnounce{ + IsAnnounce: true, + AnnounceVersionID: cag.String("v_id"), + } + case "not_announcement": + evt.Announce = &types.GroupAnnounce{ + IsAnnounce: false, + AnnounceVersionID: cag.String("v_id"), + } + case "invite": + link := InviteLinkPrefix + cag.String("code") + evt.NewInviteLink = &link + case "ephemeral": + timer := uint32(cag.Uint64("expiration")) + evt.Ephemeral = &types.GroupEphemeral{ + IsEphemeral: true, + DisappearingTimer: timer, + } + case "not_ephemeral": + evt.Ephemeral = &types.GroupEphemeral{IsEphemeral: false} + case "link": + evt.Link = &types.GroupLinkChange{ + Type: types.GroupLinkChangeType(cag.String("link_type")), + } + groupNode, ok := child.GetOptionalChildByTag("group") + if !ok { + return nil, &ElementMissingError{Tag: "group", In: "group link"} + } + var err error + evt.Link.Group, err = parseGroupLinkTargetNode(&groupNode) + if err != nil { + return nil, fmt.Errorf("failed to parse group link node in group change: %w", err) + } + case "unlink": + evt.Unlink = &types.GroupLinkChange{ + Type: types.GroupLinkChangeType(cag.String("unlink_type")), + UnlinkReason: types.GroupUnlinkReason(cag.String("unlink_reason")), + } + groupNode, ok := child.GetOptionalChildByTag("group") + if !ok { + return nil, &ElementMissingError{Tag: "group", In: "group unlink"} + } + var err error + evt.Unlink.Group, err = parseGroupLinkTargetNode(&groupNode) + if err != nil { + return nil, fmt.Errorf("failed to parse group unlink node in group change: %w", err) + } + default: + evt.UnknownChanges = append(evt.UnknownChanges, &child) + } + if !cag.OK() { + return nil, fmt.Errorf("group change %s element doesn't contain required attributes: %w", child.Tag, cag.Error()) + } + } + return &evt, nil +} + +func (cli *Client) updateGroupParticipantCache(evt *events.GroupInfo) { + if len(evt.Join) == 0 && len(evt.Leave) == 0 { + return + } + cli.groupParticipantsCacheLock.Lock() + defer cli.groupParticipantsCacheLock.Unlock() + cached, ok := cli.groupParticipantsCache[evt.JID] + if !ok { + return + } +Outer: + for _, jid := range evt.Join { + for _, existingJID := range cached { + if jid == existingJID { + continue Outer + } + } + cached = append(cached, jid) + } + for _, jid := range evt.Leave { + for i, existingJID := range cached { + if existingJID == jid { + cached[i] = cached[len(cached)-1] + cached = cached[:len(cached)-1] + break + } + } + } + cli.groupParticipantsCache[evt.JID] = cached +} + +func (cli *Client) parseGroupNotification(node *waBinary.Node) (interface{}, error) { + children := node.GetChildren() + if len(children) == 1 && children[0].Tag == "create" { + return cli.parseGroupCreate(&children[0]) + } else { + groupChange, err := cli.parseGroupChange(node) + if err != nil { + return nil, err + } + cli.updateGroupParticipantCache(groupChange) + return groupChange, nil + } +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/handshake.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/handshake.go new file mode 100644 index 0000000..dbfe9d9 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/handshake.go @@ -0,0 +1,131 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package whatsmeow + +import ( + "bytes" + "fmt" + "time" + + "google.golang.org/protobuf/proto" + + waProto "go.mau.fi/whatsmeow/binary/proto" + "go.mau.fi/whatsmeow/socket" + "go.mau.fi/whatsmeow/util/keys" +) + +const NoiseHandshakeResponseTimeout = 20 * time.Second + +// doHandshake implements the Noise_XX_25519_AESGCM_SHA256 handshake for the WhatsApp web API. +func (cli *Client) doHandshake(fs *socket.FrameSocket, ephemeralKP keys.KeyPair) error { + nh := socket.NewNoiseHandshake() + nh.Start(socket.NoiseStartPattern, fs.Header) + nh.Authenticate(ephemeralKP.Pub[:]) + data, err := proto.Marshal(&waProto.HandshakeMessage{ + ClientHello: &waProto.HandshakeClientHello{ + Ephemeral: ephemeralKP.Pub[:], + }, + }) + if err != nil { + return fmt.Errorf("failed to marshal handshake message: %w", err) + } + err = fs.SendFrame(data) + if err != nil { + return fmt.Errorf("failed to send handshake message: %w", err) + } + var resp []byte + select { + case resp = <-fs.Frames: + case <-time.After(NoiseHandshakeResponseTimeout): + return fmt.Errorf("timed out waiting for handshake response") + } + var handshakeResponse waProto.HandshakeMessage + err = proto.Unmarshal(resp, &handshakeResponse) + if err != nil { + return fmt.Errorf("failed to unmarshal handshake response: %w", err) + } + serverEphemeral := handshakeResponse.GetServerHello().GetEphemeral() + serverStaticCiphertext := handshakeResponse.GetServerHello().GetStatic() + certificateCiphertext := handshakeResponse.GetServerHello().GetPayload() + if len(serverEphemeral) != 32 || serverStaticCiphertext == nil || certificateCiphertext == nil { + return fmt.Errorf("missing parts of handshake response") + } + serverEphemeralArr := *(*[32]byte)(serverEphemeral) + + nh.Authenticate(serverEphemeral) + err = nh.MixSharedSecretIntoKey(*ephemeralKP.Priv, serverEphemeralArr) + if err != nil { + return fmt.Errorf("failed to mix server ephemeral key in: %w", err) + } + + staticDecrypted, err := nh.Decrypt(serverStaticCiphertext) + if err != nil { + return fmt.Errorf("failed to decrypt server static ciphertext: %w", err) + } else if len(staticDecrypted) != 32 { + return fmt.Errorf("unexpected length of server static plaintext %d (expected 32)", len(staticDecrypted)) + } + err = nh.MixSharedSecretIntoKey(*ephemeralKP.Priv, *(*[32]byte)(staticDecrypted)) + if err != nil { + return fmt.Errorf("failed to mix server static key in: %w", err) + } + + certDecrypted, err := nh.Decrypt(certificateCiphertext) + if err != nil { + return fmt.Errorf("failed to decrypt noise certificate ciphertext: %w", err) + } + var cert waProto.NoiseCertificate + err = proto.Unmarshal(certDecrypted, &cert) + if err != nil { + return fmt.Errorf("failed to unmarshal noise certificate: %w", err) + } + certDetailsRaw := cert.GetDetails() + certSignature := cert.GetSignature() + if certDetailsRaw == nil || certSignature == nil { + return fmt.Errorf("missing parts of noise certificate") + } + var certDetails waProto.NoiseCertificate_Details + err = proto.Unmarshal(certDetailsRaw, &certDetails) + if err != nil { + return fmt.Errorf("failed to unmarshal noise certificate details: %w", err) + } else if !bytes.Equal(certDetails.GetKey(), staticDecrypted) { + return fmt.Errorf("cert key doesn't match decrypted static") + } + + encryptedPubkey := nh.Encrypt(cli.Store.NoiseKey.Pub[:]) + err = nh.MixSharedSecretIntoKey(*cli.Store.NoiseKey.Priv, serverEphemeralArr) + if err != nil { + return fmt.Errorf("failed to mix noise private key in: %w", err) + } + + clientFinishPayloadBytes, err := proto.Marshal(cli.Store.GetClientPayload()) + if err != nil { + return fmt.Errorf("failed to marshal client finish payload: %w", err) + } + encryptedClientFinishPayload := nh.Encrypt(clientFinishPayloadBytes) + data, err = proto.Marshal(&waProto.HandshakeMessage{ + ClientFinish: &waProto.HandshakeClientFinish{ + Static: encryptedPubkey, + Payload: encryptedClientFinishPayload, + }, + }) + if err != nil { + return fmt.Errorf("failed to marshal handshake finish message: %w", err) + } + err = fs.SendFrame(data) + if err != nil { + return fmt.Errorf("failed to send handshake finish message: %w", err) + } + + ns, err := nh.Finish(fs, cli.handleFrame, cli.onDisconnect) + if err != nil { + return fmt.Errorf("failed to create noise socket: %w", err) + } + + cli.socket = ns + + return nil +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/internals.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/internals.go new file mode 100644 index 0000000..f71e71e --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/internals.go @@ -0,0 +1,67 @@ +// Copyright (c) 2022 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package whatsmeow + +import ( + "context" + + waBinary "go.mau.fi/whatsmeow/binary" +) + +type DangerousInternalClient struct { + c *Client +} + +// DangerousInternals allows access to some unexported methods in Client. +// +// Deprecated: dangerous +func (cli *Client) DangerousInternals() *DangerousInternalClient { + return &DangerousInternalClient{cli} +} + +type DangerousInfoQuery = infoQuery +type DangerousInfoQueryType = infoQueryType + +func (int *DangerousInternalClient) SendIQ(query DangerousInfoQuery) (*waBinary.Node, error) { + return int.c.sendIQ(query) +} + +func (int *DangerousInternalClient) SendIQAsync(query DangerousInfoQuery) (<-chan *waBinary.Node, error) { + return int.c.sendIQAsync(query) +} + +func (int *DangerousInternalClient) SendNode(node waBinary.Node) error { + return int.c.sendNode(node) +} + +func (int *DangerousInternalClient) WaitResponse(reqID string) chan *waBinary.Node { + return int.c.waitResponse(reqID) +} + +func (int *DangerousInternalClient) CancelResponse(reqID string, ch chan *waBinary.Node) { + int.c.cancelResponse(reqID, ch) +} + +func (int *DangerousInternalClient) QueryMediaConn() (*MediaConn, error) { + return int.c.queryMediaConn() +} + +func (int *DangerousInternalClient) RefreshMediaConn(force bool) (*MediaConn, error) { + return int.c.refreshMediaConn(force) +} + +func (int *DangerousInternalClient) GetServerPreKeyCount() (int, error) { + return int.c.getServerPreKeyCount() +} + +func (int *DangerousInternalClient) RequestAppStateKeys(ctx context.Context, keyIDs [][]byte) { + int.c.requestAppStateKeys(ctx, keyIDs) +} + +func (int *DangerousInternalClient) SendRetryReceipt(node *waBinary.Node, forceIncludeIdentity bool) { + int.c.sendRetryReceipt(node, forceIncludeIdentity) +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/keepalive.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/keepalive.go new file mode 100644 index 0000000..d5e4028 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/keepalive.go @@ -0,0 +1,78 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package whatsmeow + +import ( + "context" + "math/rand" + "time" + + waBinary "go.mau.fi/whatsmeow/binary" + "go.mau.fi/whatsmeow/types" + "go.mau.fi/whatsmeow/types/events" +) + +var ( + // KeepAliveResponseDeadline specifies the duration to wait for a response to websocket keepalive pings. + KeepAliveResponseDeadline = 10 * time.Second + // KeepAliveIntervalMin specifies the minimum interval for websocket keepalive pings. + KeepAliveIntervalMin = 20 * time.Second + // KeepAliveIntervalMax specifies the maximum interval for websocket keepalive pings. + KeepAliveIntervalMax = 30 * time.Second +) + +func (cli *Client) keepAliveLoop(ctx context.Context) { + var lastSuccess time.Time + var errorCount int + for { + interval := rand.Int63n(KeepAliveIntervalMax.Milliseconds()-KeepAliveIntervalMin.Milliseconds()) + KeepAliveIntervalMin.Milliseconds() + select { + case <-time.After(time.Duration(interval) * time.Millisecond): + isSuccess, shouldContinue := cli.sendKeepAlive(ctx) + if !shouldContinue { + return + } else if !isSuccess { + errorCount++ + go cli.dispatchEvent(&events.KeepAliveTimeout{ + ErrorCount: errorCount, + LastSuccess: lastSuccess, + }) + } else { + if errorCount > 0 { + errorCount = 0 + go cli.dispatchEvent(&events.KeepAliveRestored{}) + } + lastSuccess = time.Now() + } + case <-ctx.Done(): + return + } + } +} + +func (cli *Client) sendKeepAlive(ctx context.Context) (isSuccess, shouldContinue bool) { + respCh, err := cli.sendIQAsync(infoQuery{ + Namespace: "w:p", + Type: "get", + To: types.ServerJID, + Content: []waBinary.Node{{Tag: "ping"}}, + }) + if err != nil { + cli.Log.Warnf("Failed to send keepalive: %v", err) + return false, true + } + select { + case <-respCh: + // All good + return true, true + case <-time.After(KeepAliveResponseDeadline): + cli.Log.Warnf("Keepalive timed out") + return false, true + case <-ctx.Done(): + return false, false + } +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/mediaconn.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/mediaconn.go new file mode 100644 index 0000000..2e83303 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/mediaconn.go @@ -0,0 +1,93 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package whatsmeow + +import ( + "fmt" + "time" + + waBinary "go.mau.fi/whatsmeow/binary" + "go.mau.fi/whatsmeow/types" +) + +//type MediaConnIP struct { +// IP4 net.IP +// IP6 net.IP +//} + +// MediaConnHost represents a single host to download media from. +type MediaConnHost struct { + Hostname string + //IPs []MediaConnIP +} + +// MediaConn contains a list of WhatsApp servers from which attachments can be downloaded from. +type MediaConn struct { + Auth string + AuthTTL int + TTL int + MaxBuckets int + FetchedAt time.Time + Hosts []MediaConnHost +} + +// Expiry returns the time when the MediaConn expires. +func (mc *MediaConn) Expiry() time.Time { + return mc.FetchedAt.Add(time.Duration(mc.TTL) * time.Second) +} + +func (cli *Client) refreshMediaConn(force bool) (*MediaConn, error) { + cli.mediaConnLock.Lock() + defer cli.mediaConnLock.Unlock() + if cli.mediaConnCache == nil || force || time.Now().After(cli.mediaConnCache.Expiry()) { + var err error + cli.mediaConnCache, err = cli.queryMediaConn() + if err != nil { + return nil, err + } + } + return cli.mediaConnCache, nil +} + +func (cli *Client) queryMediaConn() (*MediaConn, error) { + resp, err := cli.sendIQ(infoQuery{ + Namespace: "w:m", + Type: "set", + To: types.ServerJID, + Content: []waBinary.Node{{Tag: "media_conn"}}, + }) + if err != nil { + return nil, fmt.Errorf("failed to query media connections: %w", err) + } else if len(resp.GetChildren()) == 0 || resp.GetChildren()[0].Tag != "media_conn" { + return nil, fmt.Errorf("failed to query media connections: unexpected child tag") + } + respMC := resp.GetChildren()[0] + var mc MediaConn + ag := respMC.AttrGetter() + mc.FetchedAt = time.Now() + mc.Auth = ag.String("auth") + mc.TTL = ag.Int("ttl") + mc.AuthTTL = ag.Int("auth_ttl") + mc.MaxBuckets = ag.Int("max_buckets") + if !ag.OK() { + return nil, fmt.Errorf("failed to parse media connections: %+v", ag.Errors) + } + for _, child := range respMC.GetChildren() { + if child.Tag != "host" { + cli.Log.Warnf("Unexpected child in media_conn element: %s", child.XMLString()) + continue + } + cag := child.AttrGetter() + mc.Hosts = append(mc.Hosts, MediaConnHost{ + Hostname: cag.String("hostname"), + }) + if !cag.OK() { + return nil, fmt.Errorf("failed to parse media connection host: %+v", ag.Errors) + } + } + return &mc, nil +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/mediaretry.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/mediaretry.go new file mode 100644 index 0000000..167df5f --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/mediaretry.go @@ -0,0 +1,185 @@ +// Copyright (c) 2022 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package whatsmeow + +import ( + "crypto/rand" + "fmt" + + "google.golang.org/protobuf/proto" + + waBinary "go.mau.fi/whatsmeow/binary" + waProto "go.mau.fi/whatsmeow/binary/proto" + "go.mau.fi/whatsmeow/types" + "go.mau.fi/whatsmeow/types/events" + "go.mau.fi/whatsmeow/util/gcmutil" + "go.mau.fi/whatsmeow/util/hkdfutil" +) + +func getMediaRetryKey(mediaKey []byte) (cipherKey []byte) { + return hkdfutil.SHA256(mediaKey, nil, []byte("WhatsApp Media Retry Notification"), 32) +} + +func encryptMediaRetryReceipt(messageID types.MessageID, mediaKey []byte) (ciphertext, iv []byte, err error) { + receipt := &waProto.ServerErrorReceipt{ + StanzaId: proto.String(messageID), + } + var plaintext []byte + plaintext, err = proto.Marshal(receipt) + if err != nil { + err = fmt.Errorf("failed to marshal payload: %w", err) + return + } + iv = make([]byte, 12) + _, err = rand.Read(iv) + if err != nil { + panic(err) + } + ciphertext, err = gcmutil.Encrypt(getMediaRetryKey(mediaKey), iv, plaintext, []byte(messageID)) + return +} + +// SendMediaRetryReceipt sends a request to the phone to re-upload the media in a message. +// +// This is mostly relevant when handling history syncs and getting a 404 or 410 error downloading media. +// Rough example on how to use it (will not work out of the box, you must adjust it depending on what you need exactly): +// +// var mediaRetryCache map[types.MessageID]*waProto.ImageMessage +// +// evt, err := cli.ParseWebMessage(chatJID, historyMsg.GetMessage()) +// imageMsg := evt.Message.GetImageMessage() // replace this with the part of the message you want to download +// data, err := cli.Download(imageMsg) +// if errors.Is(err, whatsmeow.ErrMediaDownloadFailedWith404) || errors.Is(err, whatsmeow.ErrMediaDownloadFailedWith410) { +// err = cli.SendMediaRetryReceipt(&evt.Info, imageMsg.GetMediaKey()) +// // You need to store the event data somewhere as it's necessary for handling the retry response. +// mediaRetryCache[evt.Info.ID] = imageMsg +// } +// +// The response will come as an *events.MediaRetry. The response will then have to be decrypted +// using DecryptMediaRetryNotification and the same media key passed here. If the media retry was successful, +// the decrypted notification should contain an updated DirectPath, which can be used to download the file. +// +// func eventHandler(rawEvt interface{}) { +// switch evt := rawEvt.(type) { +// case *events.MediaRetry: +// imageMsg := mediaRetryCache[evt.MessageID] +// retryData, err := whatsmeow.DecryptMediaRetryNotification(evt, imageMsg.GetMediaKey()) +// if err != nil || retryData.GetResult != waProto.MediaRetryNotification_SUCCESS { +// return +// } +// // Use the new path to download the attachment +// imageMsg.DirectPath = retryData.DirectPath +// data, err := cli.Download(imageMsg) +// // Alternatively, you can use cli.DownloadMediaWithPath and provide the individual fields manually. +// } +// } +func (cli *Client) SendMediaRetryReceipt(message *types.MessageInfo, mediaKey []byte) error { + ciphertext, iv, err := encryptMediaRetryReceipt(message.ID, mediaKey) + if err != nil { + return fmt.Errorf("failed to prepare encrypted retry receipt: %w", err) + } + ownID := cli.getOwnID().ToNonAD() + if ownID.IsEmpty() { + return ErrNotLoggedIn + } + + rmrAttrs := waBinary.Attrs{ + "jid": message.Chat, + "from_me": message.IsFromMe, + } + if message.IsGroup { + rmrAttrs["participant"] = message.Sender + } + + encryptedRequest := []waBinary.Node{ + {Tag: "enc_p", Content: ciphertext}, + {Tag: "enc_iv", Content: iv}, + } + + err = cli.sendNode(waBinary.Node{ + Tag: "receipt", + Attrs: waBinary.Attrs{ + "id": message.ID, + "to": ownID, + "type": "server-error", + }, + Content: []waBinary.Node{ + {Tag: "encrypt", Content: encryptedRequest}, + {Tag: "rmr", Attrs: rmrAttrs}, + }, + }) + if err != nil { + return err + } + return nil +} + +// DecryptMediaRetryNotification decrypts a media retry notification using the media key. +// See Client.SendMediaRetryReceipt for more info on how to use this. +func DecryptMediaRetryNotification(evt *events.MediaRetry, mediaKey []byte) (*waProto.MediaRetryNotification, error) { + var notif waProto.MediaRetryNotification + if evt.Error != nil && evt.Ciphertext == nil { + if evt.Error.Code == 2 { + return nil, ErrMediaNotAvailableOnPhone + } + return nil, fmt.Errorf("%w (code: %d)", ErrUnknownMediaRetryError, evt.Error.Code) + } else if plaintext, err := gcmutil.Decrypt(getMediaRetryKey(mediaKey), evt.IV, evt.Ciphertext, []byte(evt.MessageID)); err != nil { + return nil, fmt.Errorf("failed to decrypt notification: %w", err) + } else if err = proto.Unmarshal(plaintext, ¬if); err != nil { + return nil, fmt.Errorf("failed to unmarshal notification (invalid encryption key?): %w", err) + } else { + return ¬if, nil + } +} + +func parseMediaRetryNotification(node *waBinary.Node) (*events.MediaRetry, error) { + ag := node.AttrGetter() + var evt events.MediaRetry + evt.Timestamp = ag.UnixTime("t") + evt.MessageID = types.MessageID(ag.String("id")) + if !ag.OK() { + return nil, ag.Error() + } + rmr, ok := node.GetOptionalChildByTag("rmr") + if !ok { + return nil, &ElementMissingError{Tag: "rmr", In: "retry notification"} + } + rmrAG := rmr.AttrGetter() + evt.ChatID = rmrAG.JID("jid") + evt.FromMe = rmrAG.Bool("from_me") + evt.SenderID = rmrAG.OptionalJIDOrEmpty("participant") + if !rmrAG.OK() { + return nil, fmt.Errorf("missing attributes in <rmr> tag: %w", rmrAG.Error()) + } + + errNode, ok := node.GetOptionalChildByTag("error") + if ok { + evt.Error = &events.MediaRetryError{ + Code: errNode.AttrGetter().Int("code"), + } + return &evt, nil + } + + evt.Ciphertext, ok = node.GetChildByTag("encrypt", "enc_p").Content.([]byte) + if !ok { + return nil, &ElementMissingError{Tag: "enc_p", In: fmt.Sprintf("retry notification %s", evt.MessageID)} + } + evt.IV, ok = node.GetChildByTag("encrypt", "enc_iv").Content.([]byte) + if !ok { + return nil, &ElementMissingError{Tag: "enc_iv", In: fmt.Sprintf("retry notification %s", evt.MessageID)} + } + return &evt, nil +} + +func (cli *Client) handleMediaRetryNotification(node *waBinary.Node) { + evt, err := parseMediaRetryNotification(node) + if err != nil { + cli.Log.Warnf("Failed to parse media retry notification: %v", err) + return + } + cli.dispatchEvent(evt) +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/message.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/message.go new file mode 100644 index 0000000..2c6c2db --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/message.go @@ -0,0 +1,498 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package whatsmeow + +import ( + "bytes" + "compress/zlib" + "crypto/rand" + "encoding/hex" + "errors" + "fmt" + "io" + "runtime/debug" + "sync/atomic" + "time" + + "go.mau.fi/libsignal/signalerror" + "google.golang.org/protobuf/proto" + + "go.mau.fi/libsignal/groups" + "go.mau.fi/libsignal/protocol" + "go.mau.fi/libsignal/session" + + "go.mau.fi/whatsmeow/appstate" + waBinary "go.mau.fi/whatsmeow/binary" + waProto "go.mau.fi/whatsmeow/binary/proto" + "go.mau.fi/whatsmeow/store" + "go.mau.fi/whatsmeow/types" + "go.mau.fi/whatsmeow/types/events" +) + +var pbSerializer = store.SignalProtobufSerializer + +func (cli *Client) handleEncryptedMessage(node *waBinary.Node) { + info, err := cli.parseMessageInfo(node) + if err != nil { + cli.Log.Warnf("Failed to parse message: %v", err) + } else { + if info.VerifiedName != nil && len(info.VerifiedName.Details.GetVerifiedName()) > 0 { + go cli.updateBusinessName(info.Sender, info, info.VerifiedName.Details.GetVerifiedName()) + } + if len(info.PushName) > 0 && info.PushName != "-" { + go cli.updatePushName(info.Sender, info, info.PushName) + } + cli.decryptMessages(info, node) + } +} + +func (cli *Client) parseMessageSource(node *waBinary.Node, requireParticipant bool) (source types.MessageSource, err error) { + clientID := cli.getOwnID() + if clientID.IsEmpty() { + err = ErrNotLoggedIn + return + } + ag := node.AttrGetter() + from := ag.JID("from") + if from.Server == types.GroupServer || from.Server == types.BroadcastServer { + source.IsGroup = true + source.Chat = from + if requireParticipant { + source.Sender = ag.JID("participant") + } else { + source.Sender = ag.OptionalJIDOrEmpty("participant") + } + if source.Sender.User == clientID.User { + source.IsFromMe = true + } + if from.Server == types.BroadcastServer { + source.BroadcastListOwner = ag.OptionalJIDOrEmpty("recipient") + } + } else if from.User == clientID.User { + source.IsFromMe = true + source.Sender = from + recipient := ag.OptionalJID("recipient") + if recipient != nil { + source.Chat = *recipient + } else { + source.Chat = from.ToNonAD() + } + } else { + source.Chat = from.ToNonAD() + source.Sender = from + } + err = ag.Error() + return +} + +func (cli *Client) parseMessageInfo(node *waBinary.Node) (*types.MessageInfo, error) { + var info types.MessageInfo + var err error + info.MessageSource, err = cli.parseMessageSource(node, true) + if err != nil { + return nil, err + } + ag := node.AttrGetter() + info.ID = types.MessageID(ag.String("id")) + info.Timestamp = ag.UnixTime("t") + info.PushName = ag.OptionalString("notify") + info.Category = ag.OptionalString("category") + if !ag.OK() { + return nil, ag.Error() + } + + for _, child := range node.GetChildren() { + if child.Tag == "multicast" { + info.Multicast = true + } else if child.Tag == "verified_name" { + info.VerifiedName, err = parseVerifiedNameContent(child) + if err != nil { + cli.Log.Warnf("Failed to parse verified_name node in %s: %v", info.ID, err) + } + } else if mediaType, ok := child.AttrGetter().GetString("mediatype", false); ok { + info.MediaType = mediaType + } + } + + return &info, nil +} + +func (cli *Client) decryptMessages(info *types.MessageInfo, node *waBinary.Node) { + go cli.sendAck(node) + if len(node.GetChildrenByTag("unavailable")) > 0 && len(node.GetChildrenByTag("enc")) == 0 { + cli.Log.Warnf("Unavailable message %s from %s", info.ID, info.SourceString()) + go cli.sendRetryReceipt(node, true) + cli.dispatchEvent(&events.UndecryptableMessage{Info: *info, IsUnavailable: true}) + return + } + children := node.GetChildren() + cli.Log.Debugf("Decrypting %d messages from %s", len(children), info.SourceString()) + handled := false + containsDirectMsg := false + for _, child := range children { + if child.Tag != "enc" { + continue + } + encType, ok := child.Attrs["type"].(string) + if !ok { + continue + } + var decrypted []byte + var err error + if encType == "pkmsg" || encType == "msg" { + decrypted, err = cli.decryptDM(&child, info.Sender, encType == "pkmsg") + containsDirectMsg = true + } else if info.IsGroup && encType == "skmsg" { + decrypted, err = cli.decryptGroupMsg(&child, info.Sender, info.Chat) + } else { + cli.Log.Warnf("Unhandled encrypted message (type %s) from %s", encType, info.SourceString()) + continue + } + if err != nil { + cli.Log.Warnf("Error decrypting message from %s: %v", info.SourceString(), err) + isUnavailable := encType == "skmsg" && !containsDirectMsg && errors.Is(err, signalerror.ErrNoSenderKeyForUser) + go cli.sendRetryReceipt(node, isUnavailable) + cli.dispatchEvent(&events.UndecryptableMessage{Info: *info, IsUnavailable: isUnavailable}) + return + } + + var msg waProto.Message + err = proto.Unmarshal(decrypted, &msg) + if err != nil { + cli.Log.Warnf("Error unmarshaling decrypted message from %s: %v", info.SourceString(), err) + continue + } + + cli.handleDecryptedMessage(info, &msg) + handled = true + } + if handled { + go cli.sendMessageReceipt(info) + } +} + +func (cli *Client) clearUntrustedIdentity(target types.JID) { + err := cli.Store.Identities.DeleteIdentity(target.SignalAddress().String()) + if err != nil { + cli.Log.Warnf("Failed to delete untrusted identity of %s from store: %v", target, err) + } + err = cli.Store.Sessions.DeleteSession(target.SignalAddress().String()) + if err != nil { + cli.Log.Warnf("Failed to delete session with %s (untrusted identity) from store: %v", target, err) + } + cli.dispatchEvent(&events.IdentityChange{JID: target, Timestamp: time.Now(), Implicit: true}) +} + +func (cli *Client) decryptDM(child *waBinary.Node, from types.JID, isPreKey bool) ([]byte, error) { + content, _ := child.Content.([]byte) + + builder := session.NewBuilderFromSignal(cli.Store, from.SignalAddress(), pbSerializer) + cipher := session.NewCipher(builder, from.SignalAddress()) + var plaintext []byte + if isPreKey { + preKeyMsg, err := protocol.NewPreKeySignalMessageFromBytes(content, pbSerializer.PreKeySignalMessage, pbSerializer.SignalMessage) + if err != nil { + return nil, fmt.Errorf("failed to parse prekey message: %w", err) + } + plaintext, _, err = cipher.DecryptMessageReturnKey(preKeyMsg) + if cli.AutoTrustIdentity && errors.Is(err, signalerror.ErrUntrustedIdentity) { + cli.Log.Warnf("Got %v error while trying to decrypt prekey message from %s, clearing stored identity and retrying", err, from) + cli.clearUntrustedIdentity(from) + plaintext, _, err = cipher.DecryptMessageReturnKey(preKeyMsg) + } + if err != nil { + return nil, fmt.Errorf("failed to decrypt prekey message: %w", err) + } + } else { + msg, err := protocol.NewSignalMessageFromBytes(content, pbSerializer.SignalMessage) + if err != nil { + return nil, fmt.Errorf("failed to parse normal message: %w", err) + } + plaintext, err = cipher.Decrypt(msg) + if err != nil { + return nil, fmt.Errorf("failed to decrypt normal message: %w", err) + } + } + return unpadMessage(plaintext) +} + +func (cli *Client) decryptGroupMsg(child *waBinary.Node, from types.JID, chat types.JID) ([]byte, error) { + content, _ := child.Content.([]byte) + + senderKeyName := protocol.NewSenderKeyName(chat.String(), from.SignalAddress()) + builder := groups.NewGroupSessionBuilder(cli.Store, pbSerializer) + cipher := groups.NewGroupCipher(builder, senderKeyName, cli.Store) + msg, err := protocol.NewSenderKeyMessageFromBytes(content, pbSerializer.SenderKeyMessage) + if err != nil { + return nil, fmt.Errorf("failed to parse group message: %w", err) + } + plaintext, err := cipher.Decrypt(msg) + if err != nil { + return nil, fmt.Errorf("failed to decrypt group message: %w", err) + } + return unpadMessage(plaintext) +} + +const checkPadding = true + +func isValidPadding(plaintext []byte) bool { + lastByte := plaintext[len(plaintext)-1] + expectedPadding := bytes.Repeat([]byte{lastByte}, int(lastByte)) + return bytes.HasSuffix(plaintext, expectedPadding) +} + +func unpadMessage(plaintext []byte) ([]byte, error) { + if checkPadding && !isValidPadding(plaintext) { + return nil, fmt.Errorf("plaintext doesn't have expected padding") + } + return plaintext[:len(plaintext)-int(plaintext[len(plaintext)-1])], nil +} + +func padMessage(plaintext []byte) []byte { + var pad [1]byte + _, err := rand.Read(pad[:]) + if err != nil { + panic(err) + } + pad[0] &= 0xf + if pad[0] == 0 { + pad[0] = 0xf + } + plaintext = append(plaintext, bytes.Repeat(pad[:], int(pad[0]))...) + return plaintext +} + +func (cli *Client) handleSenderKeyDistributionMessage(chat, from types.JID, rawSKDMsg *waProto.SenderKeyDistributionMessage) { + builder := groups.NewGroupSessionBuilder(cli.Store, pbSerializer) + senderKeyName := protocol.NewSenderKeyName(chat.String(), from.SignalAddress()) + sdkMsg, err := protocol.NewSenderKeyDistributionMessageFromBytes(rawSKDMsg.AxolotlSenderKeyDistributionMessage, pbSerializer.SenderKeyDistributionMessage) + if err != nil { + cli.Log.Errorf("Failed to parse sender key distribution message from %s for %s: %v", from, chat, err) + return + } + builder.Process(senderKeyName, sdkMsg) + cli.Log.Debugf("Processed sender key distribution message from %s in %s", senderKeyName.Sender().String(), senderKeyName.GroupID()) +} + +func (cli *Client) handleHistorySyncNotificationLoop() { + defer func() { + atomic.StoreUint32(&cli.historySyncHandlerStarted, 0) + err := recover() + if err != nil { + cli.Log.Errorf("History sync handler panicked: %v\n%s", err, debug.Stack()) + } + + // Check in case something new appeared in the channel between the loop stopping + // and the atomic variable being updated. If yes, restart the loop. + if len(cli.historySyncNotifications) > 0 && atomic.CompareAndSwapUint32(&cli.historySyncHandlerStarted, 0, 1) { + cli.Log.Warnf("New history sync notifications appeared after loop stopped, restarting loop...") + go cli.handleHistorySyncNotificationLoop() + } + }() + for notif := range cli.historySyncNotifications { + cli.handleHistorySyncNotification(notif) + } +} + +func (cli *Client) handleHistorySyncNotification(notif *waProto.HistorySyncNotification) { + var historySync waProto.HistorySync + if data, err := cli.Download(notif); err != nil { + cli.Log.Errorf("Failed to download history sync data: %v", err) + } else if reader, err := zlib.NewReader(bytes.NewReader(data)); err != nil { + cli.Log.Errorf("Failed to create zlib reader for history sync data: %v", err) + } else if rawData, err := io.ReadAll(reader); err != nil { + cli.Log.Errorf("Failed to decompress history sync data: %v", err) + } else if err = proto.Unmarshal(rawData, &historySync); err != nil { + cli.Log.Errorf("Failed to unmarshal history sync data: %v", err) + } else { + cli.Log.Debugf("Received history sync (type %s, chunk %d)", historySync.GetSyncType(), historySync.GetChunkOrder()) + if historySync.GetSyncType() == waProto.HistorySync_PUSH_NAME { + go cli.handleHistoricalPushNames(historySync.GetPushnames()) + } else if len(historySync.GetConversations()) > 0 { + go cli.storeHistoricalMessageSecrets(historySync.GetConversations()) + } + cli.dispatchEvent(&events.HistorySync{ + Data: &historySync, + }) + } +} + +func (cli *Client) handleAppStateSyncKeyShare(keys *waProto.AppStateSyncKeyShare) { + onlyResyncIfNotSynced := true + + cli.Log.Debugf("Got %d new app state keys", len(keys.GetKeys())) + cli.appStateKeyRequestsLock.RLock() + for _, key := range keys.GetKeys() { + marshaledFingerprint, err := proto.Marshal(key.GetKeyData().GetFingerprint()) + if err != nil { + cli.Log.Errorf("Failed to marshal fingerprint of app state sync key %X", key.GetKeyId().GetKeyId()) + continue + } + _, isReRequest := cli.appStateKeyRequests[hex.EncodeToString(key.GetKeyId().GetKeyId())] + if isReRequest { + onlyResyncIfNotSynced = false + } + err = cli.Store.AppStateKeys.PutAppStateSyncKey(key.GetKeyId().GetKeyId(), store.AppStateSyncKey{ + Data: key.GetKeyData().GetKeyData(), + Fingerprint: marshaledFingerprint, + Timestamp: key.GetKeyData().GetTimestamp(), + }) + if err != nil { + cli.Log.Errorf("Failed to store app state sync key %X: %v", key.GetKeyId().GetKeyId(), err) + continue + } + cli.Log.Debugf("Received app state sync key %X", key.GetKeyId().GetKeyId()) + } + cli.appStateKeyRequestsLock.RUnlock() + + for _, name := range appstate.AllPatchNames { + err := cli.FetchAppState(name, false, onlyResyncIfNotSynced) + if err != nil { + cli.Log.Errorf("Failed to do initial fetch of app state %s: %v", name, err) + } + } +} + +func (cli *Client) handleProtocolMessage(info *types.MessageInfo, msg *waProto.Message) { + protoMsg := msg.GetProtocolMessage() + + if protoMsg.GetHistorySyncNotification() != nil && info.IsFromMe { + cli.historySyncNotifications <- protoMsg.HistorySyncNotification + if atomic.CompareAndSwapUint32(&cli.historySyncHandlerStarted, 0, 1) { + go cli.handleHistorySyncNotificationLoop() + } + go cli.sendProtocolMessageReceipt(info.ID, "hist_sync") + } + + if protoMsg.GetAppStateSyncKeyShare() != nil && info.IsFromMe { + go cli.handleAppStateSyncKeyShare(protoMsg.AppStateSyncKeyShare) + } + + if info.Category == "peer" { + go cli.sendProtocolMessageReceipt(info.ID, "peer_msg") + } +} + +func (cli *Client) processProtocolParts(info *types.MessageInfo, msg *waProto.Message) { + // Hopefully sender key distribution messages and protocol messages can't be inside ephemeral messages + if msg.GetDeviceSentMessage().GetMessage() != nil { + msg = msg.GetDeviceSentMessage().GetMessage() + } + if msg.GetSenderKeyDistributionMessage() != nil { + if !info.IsGroup { + cli.Log.Warnf("Got sender key distribution message in non-group chat from", info.Sender) + } else { + cli.handleSenderKeyDistributionMessage(info.Chat, info.Sender, msg.SenderKeyDistributionMessage) + } + } + // N.B. Edits are protocol messages, but they're also wrapped inside EditedMessage, + // which is only unwrapped after processProtocolParts, so this won't trigger for edits. + if msg.GetProtocolMessage() != nil { + cli.handleProtocolMessage(info, msg) + } + if msgSecret := msg.GetMessageContextInfo().GetMessageSecret(); len(msgSecret) > 0 { + err := cli.Store.MsgSecrets.PutMessageSecret(info.Chat, info.Sender, info.ID, msgSecret) + if err != nil { + cli.Log.Errorf("Failed to store message secret key for %s: %v", info.ID, err) + } else { + cli.Log.Debugf("Stored message secret key for %s", info.ID) + } + } +} + +func (cli *Client) storeHistoricalMessageSecrets(conversations []*waProto.Conversation) { + var secrets []store.MessageSecretInsert + var privacyTokens []store.PrivacyToken + ownID := cli.getOwnID().ToNonAD() + if ownID.IsEmpty() { + return + } + for _, conv := range conversations { + chatJID, _ := types.ParseJID(conv.GetId()) + if chatJID.IsEmpty() { + continue + } + if chatJID.Server == types.DefaultUserServer && conv.GetTcToken() != nil { + ts := conv.GetTcTokenSenderTimestamp() + if ts == 0 { + ts = conv.GetTcTokenTimestamp() + } + privacyTokens = append(privacyTokens, store.PrivacyToken{ + User: chatJID, + Token: conv.GetTcToken(), + Timestamp: time.Unix(int64(ts), 0), + }) + } + for _, msg := range conv.GetMessages() { + if secret := msg.GetMessage().GetMessageSecret(); secret != nil { + var senderJID types.JID + msgKey := msg.GetMessage().GetKey() + if msgKey.GetFromMe() { + senderJID = ownID + } else if chatJID.Server == types.DefaultUserServer { + senderJID = chatJID + } else if msgKey.GetParticipant() != "" { + senderJID, _ = types.ParseJID(msgKey.GetParticipant()) + } else if msg.GetMessage().GetParticipant() != "" { + senderJID, _ = types.ParseJID(msg.GetMessage().GetParticipant()) + } + if senderJID.IsEmpty() || msgKey.GetId() == "" { + continue + } + secrets = append(secrets, store.MessageSecretInsert{ + Chat: chatJID, + Sender: senderJID, + ID: msgKey.GetId(), + Secret: secret, + }) + } + } + } + if len(secrets) > 0 { + cli.Log.Debugf("Storing %d message secret keys in history sync", len(secrets)) + err := cli.Store.MsgSecrets.PutMessageSecrets(secrets) + if err != nil { + cli.Log.Errorf("Failed to store message secret keys in history sync: %v", err) + } else { + cli.Log.Infof("Stored %d message secret keys from history sync", len(secrets)) + } + } + if len(privacyTokens) > 0 { + cli.Log.Debugf("Storing %d privacy tokens in history sync", len(privacyTokens)) + err := cli.Store.PrivacyTokens.PutPrivacyTokens(privacyTokens...) + if err != nil { + cli.Log.Errorf("Failed to store privacy tokens in history sync: %v", err) + } else { + cli.Log.Infof("Stored %d privacy tokens from history sync", len(privacyTokens)) + } + } +} + +func (cli *Client) handleDecryptedMessage(info *types.MessageInfo, msg *waProto.Message) { + cli.processProtocolParts(info, msg) + evt := &events.Message{Info: *info, RawMessage: msg} + cli.dispatchEvent(evt.UnwrapRaw()) +} + +func (cli *Client) sendProtocolMessageReceipt(id, msgType string) { + clientID := cli.Store.ID + if len(id) == 0 || clientID == nil { + return + } + err := cli.sendNode(waBinary.Node{ + Tag: "receipt", + Attrs: waBinary.Attrs{ + "id": id, + "type": msgType, + "to": types.NewJID(clientID.User, types.LegacyUserServer), + }, + Content: nil, + }) + if err != nil { + cli.Log.Warnf("Failed to send acknowledgement for protocol message %s: %v", id, err) + } +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/msgsecret.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/msgsecret.go new file mode 100644 index 0000000..a4cbb17 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/msgsecret.go @@ -0,0 +1,270 @@ +// Copyright (c) 2022 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package whatsmeow + +import ( + "crypto/rand" + "crypto/sha256" + "fmt" + "time" + + "google.golang.org/protobuf/proto" + + waProto "go.mau.fi/whatsmeow/binary/proto" + "go.mau.fi/whatsmeow/types" + "go.mau.fi/whatsmeow/types/events" + "go.mau.fi/whatsmeow/util/gcmutil" + "go.mau.fi/whatsmeow/util/hkdfutil" +) + +type MsgSecretType string + +const ( + EncSecretPollVote MsgSecretType = "Poll Vote" + EncSecretReaction MsgSecretType = "Enc Reaction" +) + +func generateMsgSecretKey( + modificationType MsgSecretType, modificationSender types.JID, + origMsgID types.MessageID, origMsgSender types.JID, origMsgSecret []byte, +) ([]byte, []byte) { + origMsgSenderStr := origMsgSender.ToNonAD().String() + modificationSenderStr := modificationSender.ToNonAD().String() + + useCaseSecret := make([]byte, 0, len(origMsgID)+len(origMsgSenderStr)+len(modificationSenderStr)+len(modificationType)) + useCaseSecret = append(useCaseSecret, origMsgID...) + useCaseSecret = append(useCaseSecret, origMsgSenderStr...) + useCaseSecret = append(useCaseSecret, modificationSenderStr...) + useCaseSecret = append(useCaseSecret, modificationType...) + + secretKey := hkdfutil.SHA256(origMsgSecret, nil, useCaseSecret, 32) + additionalData := []byte(fmt.Sprintf("%s\x00%s", origMsgID, modificationSenderStr)) + + return secretKey, additionalData +} + +func getOrigSenderFromKey(msg *events.Message, key *waProto.MessageKey) (types.JID, error) { + if key.GetFromMe() { + // fromMe always means the poll and vote were sent by the same user + return msg.Info.Sender, nil + } else if msg.Info.Chat.Server == types.DefaultUserServer { + sender, err := types.ParseJID(key.GetRemoteJid()) + if err != nil { + return types.EmptyJID, fmt.Errorf("failed to parse JID %q of original message sender: %w", key.GetRemoteJid(), err) + } + return sender, nil + } else { + sender, err := types.ParseJID(key.GetParticipant()) + if sender.Server != types.DefaultUserServer { + err = fmt.Errorf("unexpected server") + } + if err != nil { + return types.EmptyJID, fmt.Errorf("failed to parse JID %q of original message sender: %w", key.GetParticipant(), err) + } + return sender, nil + } +} + +type messageEncryptedSecret interface { + GetEncIv() []byte + GetEncPayload() []byte +} + +func (cli *Client) decryptMsgSecret(msg *events.Message, useCase MsgSecretType, encrypted messageEncryptedSecret, origMsgKey *waProto.MessageKey) ([]byte, error) { + pollSender, err := getOrigSenderFromKey(msg, origMsgKey) + if err != nil { + return nil, err + } + baseEncKey, err := cli.Store.MsgSecrets.GetMessageSecret(msg.Info.Chat, pollSender, origMsgKey.GetId()) + if err != nil { + return nil, fmt.Errorf("failed to get original message secret key: %w", err) + } else if baseEncKey == nil { + return nil, ErrOriginalMessageSecretNotFound + } + secretKey, additionalData := generateMsgSecretKey(useCase, msg.Info.Sender, origMsgKey.GetId(), pollSender, baseEncKey) + plaintext, err := gcmutil.Decrypt(secretKey, encrypted.GetEncIv(), encrypted.GetEncPayload(), additionalData) + if err != nil { + return nil, fmt.Errorf("failed to decrypt secret message: %w", err) + } + return plaintext, nil +} + +func (cli *Client) encryptMsgSecret(chat, origSender types.JID, origMsgID types.MessageID, useCase MsgSecretType, plaintext []byte) (ciphertext, iv []byte, err error) { + ownID := cli.getOwnID() + if ownID.IsEmpty() { + return nil, nil, ErrNotLoggedIn + } + + baseEncKey, err := cli.Store.MsgSecrets.GetMessageSecret(chat, origSender, origMsgID) + if err != nil { + return nil, nil, fmt.Errorf("failed to get original message secret key: %w", err) + } else if baseEncKey == nil { + return nil, nil, ErrOriginalMessageSecretNotFound + } + secretKey, additionalData := generateMsgSecretKey(useCase, ownID, origMsgID, origSender, baseEncKey) + + iv = make([]byte, 12) + _, err = rand.Read(iv) + if err != nil { + return nil, nil, fmt.Errorf("failed to generate iv: %w", err) + } + ciphertext, err = gcmutil.Encrypt(secretKey, iv, plaintext, additionalData) + if err != nil { + return nil, nil, fmt.Errorf("failed to encrypt secret message: %w", err) + } + return ciphertext, iv, nil +} + +// DecryptReaction decrypts a reaction update message. This form of reactions hasn't been rolled out yet, +// so this function is likely not of much use. +// +// if evt.Message.GetEncReactionMessage() != nil { +// reaction, err := cli.DecryptReaction(evt) +// if err != nil { +// fmt.Println(":(", err) +// return +// } +// fmt.Printf("Reaction message: %+v\n", reaction) +// } +func (cli *Client) DecryptReaction(reaction *events.Message) (*waProto.ReactionMessage, error) { + encReaction := reaction.Message.GetEncReactionMessage() + if encReaction != nil { + return nil, ErrNotEncryptedReactionMessage + } + plaintext, err := cli.decryptMsgSecret(reaction, EncSecretReaction, encReaction, encReaction.GetTargetMessageKey()) + if err != nil { + return nil, fmt.Errorf("failed to decrypt reaction: %w", err) + } + var msg waProto.ReactionMessage + err = proto.Unmarshal(plaintext, &msg) + if err != nil { + return nil, fmt.Errorf("failed to decode reaction protobuf: %w", err) + } + return &msg, nil +} + +// DecryptPollVote decrypts a poll update message. The vote itself includes SHA-256 hashes of the selected options. +// +// if evt.Message.GetPollUpdateMessage() != nil { +// pollVote, err := cli.DecryptPollVote(evt) +// if err != nil { +// fmt.Println(":(", err) +// return +// } +// fmt.Println("Selected hashes:") +// for _, hash := range pollVote.GetSelectedOptions() { +// fmt.Printf("- %X\n", hash) +// } +// } +func (cli *Client) DecryptPollVote(vote *events.Message) (*waProto.PollVoteMessage, error) { + pollUpdate := vote.Message.GetPollUpdateMessage() + if pollUpdate == nil { + return nil, ErrNotPollUpdateMessage + } + plaintext, err := cli.decryptMsgSecret(vote, EncSecretPollVote, pollUpdate.GetVote(), pollUpdate.GetPollCreationMessageKey()) + if err != nil { + return nil, fmt.Errorf("failed to decrypt poll vote: %w", err) + } + var msg waProto.PollVoteMessage + err = proto.Unmarshal(plaintext, &msg) + if err != nil { + return nil, fmt.Errorf("failed to decode poll vote protobuf: %w", err) + } + return &msg, nil +} + +func getKeyFromInfo(msgInfo *types.MessageInfo) *waProto.MessageKey { + creationKey := &waProto.MessageKey{ + RemoteJid: proto.String(msgInfo.Chat.String()), + FromMe: proto.Bool(msgInfo.IsFromMe), + Id: proto.String(msgInfo.ID), + } + if msgInfo.IsGroup { + creationKey.Participant = proto.String(msgInfo.Sender.String()) + } + return creationKey +} + +// HashPollOptions hashes poll option names using SHA-256 for voting. +// This is used by BuildPollVote to convert selected option names to hashes. +func HashPollOptions(optionNames []string) [][]byte { + optionHashes := make([][]byte, len(optionNames)) + for i, option := range optionNames { + optionHash := sha256.Sum256([]byte(option)) + optionHashes[i] = optionHash[:] + } + return optionHashes +} + +// BuildPollVote builds a poll vote message using the given poll message info and option names. +// The built message can be sent normally using Client.SendMessage. +// +// For example, to vote for the first option after receiving a message event (*events.Message): +// +// if evt.Message.GetPollCreationMessage() != nil { +// pollVoteMsg, err := cli.BuildPollVote(&evt.Info, []string{evt.Message.GetPollCreationMessage().GetOptions()[0].GetOptionName()}) +// if err != nil { +// fmt.Println(":(", err) +// return +// } +// resp, err := cli.SendMessage(context.Background(), evt.Info.Chat, pollVoteMsg) +// } +func (cli *Client) BuildPollVote(pollInfo *types.MessageInfo, optionNames []string) (*waProto.Message, error) { + pollUpdate, err := cli.EncryptPollVote(pollInfo, &waProto.PollVoteMessage{ + SelectedOptions: HashPollOptions(optionNames), + }) + return &waProto.Message{PollUpdateMessage: pollUpdate}, err +} + +// BuildPollCreation builds a poll creation message with the given poll name, options and maximum number of selections. +// The built message can be sent normally using Client.SendMessage. +// +// resp, err := cli.SendMessage(context.Background(), chat, cli.BuildPollCreation("meow?", []string{"yes", "no"}, 1)) +func (cli *Client) BuildPollCreation(name string, optionNames []string, selectableOptionCount int) *waProto.Message { + msgSecret := make([]byte, 32) + _, err := rand.Read(msgSecret) + if err != nil { + panic(err) + } + if selectableOptionCount < 0 || selectableOptionCount > len(optionNames) { + selectableOptionCount = 0 + } + options := make([]*waProto.PollCreationMessage_Option, len(optionNames)) + for i, option := range optionNames { + options[i] = &waProto.PollCreationMessage_Option{OptionName: proto.String(option)} + } + return &waProto.Message{ + PollCreationMessage: &waProto.PollCreationMessage{ + Name: proto.String(name), + Options: options, + SelectableOptionsCount: proto.Uint32(uint32(selectableOptionCount)), + }, + MessageContextInfo: &waProto.MessageContextInfo{ + MessageSecret: msgSecret, + }, + } +} + +// EncryptPollVote encrypts a poll vote message. This is a slightly lower-level function, using BuildPollVote is recommended. +func (cli *Client) EncryptPollVote(pollInfo *types.MessageInfo, vote *waProto.PollVoteMessage) (*waProto.PollUpdateMessage, error) { + plaintext, err := proto.Marshal(vote) + if err != nil { + return nil, fmt.Errorf("failed to marshal poll vote protobuf: %w", err) + } + ciphertext, iv, err := cli.encryptMsgSecret(pollInfo.Chat, pollInfo.Sender, pollInfo.ID, EncSecretPollVote, plaintext) + if err != nil { + return nil, fmt.Errorf("failed to encrypt poll vote: %w", err) + } + return &waProto.PollUpdateMessage{ + PollCreationMessageKey: getKeyFromInfo(pollInfo), + Vote: &waProto.PollEncValue{ + EncPayload: ciphertext, + EncIv: iv, + }, + SenderTimestampMs: proto.Int64(time.Now().UnixMilli()), + }, nil +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/notification.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/notification.go new file mode 100644 index 0000000..567722b --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/notification.go @@ -0,0 +1,261 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package whatsmeow + +import ( + "errors" + + "go.mau.fi/whatsmeow/appstate" + waBinary "go.mau.fi/whatsmeow/binary" + "go.mau.fi/whatsmeow/store" + "go.mau.fi/whatsmeow/types" + "go.mau.fi/whatsmeow/types/events" +) + +func (cli *Client) handleEncryptNotification(node *waBinary.Node) { + from := node.AttrGetter().JID("from") + if from == types.ServerJID { + count := node.GetChildByTag("count") + ag := count.AttrGetter() + otksLeft := ag.Int("value") + if !ag.OK() { + cli.Log.Warnf("Didn't get number of OTKs left in encryption notification %s", node.XMLString()) + return + } + cli.Log.Infof("Got prekey count from server: %s", node.XMLString()) + if otksLeft < MinPreKeyCount { + cli.uploadPreKeys() + } + } else if _, ok := node.GetOptionalChildByTag("identity"); ok { + cli.Log.Debugf("Got identity change for %s: %s, deleting all identities/sessions for that number", from, node.XMLString()) + err := cli.Store.Identities.DeleteAllIdentities(from.User) + if err != nil { + cli.Log.Warnf("Failed to delete all identities of %s from store after identity change: %v", from, err) + } + err = cli.Store.Sessions.DeleteAllSessions(from.User) + if err != nil { + cli.Log.Warnf("Failed to delete all sessions of %s from store after identity change: %v", from, err) + } + ts := node.AttrGetter().UnixTime("t") + cli.dispatchEvent(&events.IdentityChange{JID: from, Timestamp: ts}) + } else { + cli.Log.Debugf("Got unknown encryption notification from server: %s", node.XMLString()) + } +} + +func (cli *Client) handleAppStateNotification(node *waBinary.Node) { + for _, collection := range node.GetChildrenByTag("collection") { + ag := collection.AttrGetter() + name := appstate.WAPatchName(ag.String("name")) + version := ag.Uint64("version") + cli.Log.Debugf("Got server sync notification that app state %s has updated to version %d", name, version) + err := cli.FetchAppState(name, false, false) + if errors.Is(err, ErrIQDisconnected) || errors.Is(err, ErrNotConnected) { + // There are some app state changes right before a remote logout, so stop syncing if we're disconnected. + cli.Log.Debugf("Failed to sync app state after notification: %v, not trying to sync other states", err) + return + } else if err != nil { + cli.Log.Errorf("Failed to sync app state after notification: %v", err) + } + } +} + +func (cli *Client) handlePictureNotification(node *waBinary.Node) { + ts := node.AttrGetter().UnixTime("t") + for _, child := range node.GetChildren() { + ag := child.AttrGetter() + var evt events.Picture + evt.Timestamp = ts + evt.JID = ag.JID("jid") + evt.Author = ag.OptionalJIDOrEmpty("author") + if child.Tag == "delete" { + evt.Remove = true + } else if child.Tag == "add" { + evt.PictureID = ag.String("id") + } else if child.Tag == "set" { + // TODO sometimes there's a hash and no ID? + evt.PictureID = ag.String("id") + } else { + continue + } + if !ag.OK() { + cli.Log.Debugf("Ignoring picture change notification with unexpected attributes: %v", ag.Error()) + continue + } + cli.dispatchEvent(&evt) + } +} + +func (cli *Client) handleDeviceNotification(node *waBinary.Node) { + cli.userDevicesCacheLock.Lock() + defer cli.userDevicesCacheLock.Unlock() + ag := node.AttrGetter() + from := ag.JID("from") + cached, ok := cli.userDevicesCache[from] + if !ok { + cli.Log.Debugf("No device list cached for %s, ignoring device list notification", from) + return + } + cachedParticipantHash := participantListHashV2(cached) + for _, child := range node.GetChildren() { + if child.Tag != "add" && child.Tag != "remove" { + cli.Log.Debugf("Unknown device list change tag %s", child.Tag) + continue + } + cag := child.AttrGetter() + deviceHash := cag.String("device_hash") + deviceChild, _ := child.GetOptionalChildByTag("device") + changedDeviceJID := deviceChild.AttrGetter().JID("jid") + switch child.Tag { + case "add": + cached = append(cached, changedDeviceJID) + case "remove": + for i, jid := range cached { + if jid == changedDeviceJID { + cached = append(cached[:i], cached[i+1:]...) + } + } + case "update": + // ??? + } + newParticipantHash := participantListHashV2(cached) + if newParticipantHash == deviceHash { + cli.Log.Debugf("%s's device list hash changed from %s to %s (%s). New hash matches", from, cachedParticipantHash, deviceHash, child.Tag) + cli.userDevicesCache[from] = cached + } else { + cli.Log.Warnf("%s's device list hash changed from %s to %s (%s). New hash doesn't match (%s)", from, cachedParticipantHash, deviceHash, child.Tag, newParticipantHash) + delete(cli.userDevicesCache, from) + } + } +} + +func (cli *Client) handleOwnDevicesNotification(node *waBinary.Node) { + cli.userDevicesCacheLock.Lock() + defer cli.userDevicesCacheLock.Unlock() + ownID := cli.getOwnID().ToNonAD() + if ownID.IsEmpty() { + cli.Log.Debugf("Ignoring own device change notification, session was deleted") + return + } + cached, ok := cli.userDevicesCache[ownID] + if !ok { + cli.Log.Debugf("Ignoring own device change notification, device list not cached") + return + } + oldHash := participantListHashV2(cached) + expectedNewHash := node.AttrGetter().String("dhash") + var newDeviceList []types.JID + for _, child := range node.GetChildren() { + jid := child.AttrGetter().JID("jid") + if child.Tag == "device" && !jid.IsEmpty() { + jid.AD = true + newDeviceList = append(newDeviceList, jid) + } + } + newHash := participantListHashV2(newDeviceList) + if newHash != expectedNewHash { + cli.Log.Debugf("Received own device list change notification %s -> %s, but expected hash was %s", oldHash, newHash, expectedNewHash) + delete(cli.userDevicesCache, ownID) + } else { + cli.Log.Debugf("Received own device list change notification %s -> %s", oldHash, newHash) + cli.userDevicesCache[ownID] = newDeviceList + } +} + +func (cli *Client) handleAccountSyncNotification(node *waBinary.Node) { + for _, child := range node.GetChildren() { + switch child.Tag { + case "privacy": + cli.handlePrivacySettingsNotification(&child) + case "devices": + cli.handleOwnDevicesNotification(&child) + default: + cli.Log.Debugf("Unhandled account sync item %s", child.Tag) + } + } +} + +func (cli *Client) handlePrivacyTokenNotification(node *waBinary.Node) { + ownID := cli.getOwnID().ToNonAD() + if ownID.IsEmpty() { + cli.Log.Debugf("Ignoring privacy token notification, session was deleted") + return + } + tokens := node.GetChildByTag("tokens") + if tokens.Tag != "tokens" { + cli.Log.Warnf("privacy_token notification didn't contain <tokens> tag") + return + } + parentAG := node.AttrGetter() + sender := parentAG.JID("from") + if !parentAG.OK() { + cli.Log.Warnf("privacy_token notification didn't have a sender (%v)", parentAG.Error()) + return + } + for _, child := range tokens.GetChildren() { + ag := child.AttrGetter() + if child.Tag != "token" { + cli.Log.Warnf("privacy_token notification contained unexpected <%s> tag", child.Tag) + } else if targetUser := ag.JID("jid"); targetUser != ownID { + cli.Log.Warnf("privacy_token notification contained token for different user %s", targetUser) + } else if tokenType := ag.String("type"); tokenType != "trusted_contact" { + cli.Log.Warnf("privacy_token notification contained unexpected token type %s", tokenType) + } else if token, ok := child.Content.([]byte); !ok { + cli.Log.Warnf("privacy_token notification contained non-binary token") + } else { + timestamp := ag.UnixTime("t") + if !ag.OK() { + cli.Log.Warnf("privacy_token notification is missing some fields: %v", ag.Error()) + } + err := cli.Store.PrivacyTokens.PutPrivacyTokens(store.PrivacyToken{ + User: sender, + Token: token, + Timestamp: timestamp, + }) + if err != nil { + cli.Log.Errorf("Failed to save privacy token from %s: %v", sender, err) + } else { + cli.Log.Debugf("Stored privacy token from %s (ts: %v)", sender, timestamp) + } + } + } +} + +func (cli *Client) handleNotification(node *waBinary.Node) { + ag := node.AttrGetter() + notifType := ag.String("type") + if !ag.OK() { + return + } + go cli.sendAck(node) + switch notifType { + case "encrypt": + go cli.handleEncryptNotification(node) + case "server_sync": + go cli.handleAppStateNotification(node) + case "account_sync": + go cli.handleAccountSyncNotification(node) + case "devices": + go cli.handleDeviceNotification(node) + case "w:gp2": + evt, err := cli.parseGroupNotification(node) + if err != nil { + cli.Log.Errorf("Failed to parse group notification: %v", err) + } else { + go cli.dispatchEvent(evt) + } + case "picture": + go cli.handlePictureNotification(node) + case "mediaretry": + go cli.handleMediaRetryNotification(node) + case "privacy_token": + go cli.handlePrivacyTokenNotification(node) + // Other types: business, disappearing_mode, server, status, pay, psa + default: + cli.Log.Debugf("Unhandled notification with type %s", notifType) + } +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/pair.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/pair.go new file mode 100644 index 0000000..573b038 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/pair.go @@ -0,0 +1,248 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package whatsmeow + +import ( + "bytes" + "crypto/hmac" + "crypto/sha256" + "encoding/base64" + "fmt" + "strings" + + "go.mau.fi/libsignal/ecc" + "google.golang.org/protobuf/proto" + + waBinary "go.mau.fi/whatsmeow/binary" + waProto "go.mau.fi/whatsmeow/binary/proto" + "go.mau.fi/whatsmeow/types" + "go.mau.fi/whatsmeow/types/events" + "go.mau.fi/whatsmeow/util/keys" +) + +func (cli *Client) handleIQ(node *waBinary.Node) { + children := node.GetChildren() + if len(children) != 1 || node.Attrs["from"] != types.ServerJID { + return + } + switch children[0].Tag { + case "pair-device": + cli.handlePairDevice(node) + case "pair-success": + cli.handlePairSuccess(node) + } +} + +func (cli *Client) handlePairDevice(node *waBinary.Node) { + pairDevice := node.GetChildByTag("pair-device") + err := cli.sendNode(waBinary.Node{ + Tag: "iq", + Attrs: waBinary.Attrs{ + "to": node.Attrs["from"], + "id": node.Attrs["id"], + "type": "result", + }, + }) + if err != nil { + cli.Log.Warnf("Failed to send acknowledgement for pair-device request: %v", err) + } + + evt := &events.QR{Codes: make([]string, 0, len(pairDevice.GetChildren()))} + for i, child := range pairDevice.GetChildren() { + if child.Tag != "ref" { + cli.Log.Warnf("pair-device node contains unexpected child tag %s at index %d", child.Tag, i) + continue + } + content, ok := child.Content.([]byte) + if !ok { + cli.Log.Warnf("pair-device node contains unexpected child content type %T at index %d", child, i) + continue + } + evt.Codes = append(evt.Codes, cli.makeQRData(string(content))) + } + + cli.dispatchEvent(evt) +} + +func (cli *Client) makeQRData(ref string) string { + noise := base64.StdEncoding.EncodeToString(cli.Store.NoiseKey.Pub[:]) + identity := base64.StdEncoding.EncodeToString(cli.Store.IdentityKey.Pub[:]) + adv := base64.StdEncoding.EncodeToString(cli.Store.AdvSecretKey) + return strings.Join([]string{ref, noise, identity, adv}, ",") +} + +func (cli *Client) handlePairSuccess(node *waBinary.Node) { + id := node.Attrs["id"].(string) + pairSuccess := node.GetChildByTag("pair-success") + + deviceIdentityBytes, _ := pairSuccess.GetChildByTag("device-identity").Content.([]byte) + businessName, _ := pairSuccess.GetChildByTag("biz").Attrs["name"].(string) + jid, _ := pairSuccess.GetChildByTag("device").Attrs["jid"].(types.JID) + platform, _ := pairSuccess.GetChildByTag("platform").Attrs["name"].(string) + + go func() { + err := cli.handlePair(deviceIdentityBytes, id, businessName, platform, jid) + if err != nil { + cli.Log.Errorf("Failed to pair device: %v", err) + cli.Disconnect() + cli.dispatchEvent(&events.PairError{ID: jid, BusinessName: businessName, Platform: platform, Error: err}) + } else { + cli.Log.Infof("Successfully paired %s", cli.Store.ID) + cli.dispatchEvent(&events.PairSuccess{ID: jid, BusinessName: businessName, Platform: platform}) + } + }() +} + +func (cli *Client) handlePair(deviceIdentityBytes []byte, reqID, businessName, platform string, jid types.JID) error { + var deviceIdentityContainer waProto.ADVSignedDeviceIdentityHMAC + err := proto.Unmarshal(deviceIdentityBytes, &deviceIdentityContainer) + if err != nil { + cli.sendPairError(reqID, 500, "internal-error") + return &PairProtoError{"failed to parse device identity container in pair success message", err} + } + + h := hmac.New(sha256.New, cli.Store.AdvSecretKey) + h.Write(deviceIdentityContainer.Details) + if !bytes.Equal(h.Sum(nil), deviceIdentityContainer.Hmac) { + cli.Log.Warnf("Invalid HMAC from pair success message") + cli.sendPairError(reqID, 401, "not-authorized") + return ErrPairInvalidDeviceIdentityHMAC + } + + var deviceIdentity waProto.ADVSignedDeviceIdentity + err = proto.Unmarshal(deviceIdentityContainer.Details, &deviceIdentity) + if err != nil { + cli.sendPairError(reqID, 500, "internal-error") + return &PairProtoError{"failed to parse signed device identity in pair success message", err} + } + + if !verifyDeviceIdentityAccountSignature(&deviceIdentity, cli.Store.IdentityKey) { + cli.sendPairError(reqID, 401, "not-authorized") + return ErrPairInvalidDeviceSignature + } + + deviceIdentity.DeviceSignature = generateDeviceSignature(&deviceIdentity, cli.Store.IdentityKey)[:] + + var deviceIdentityDetails waProto.ADVDeviceIdentity + err = proto.Unmarshal(deviceIdentity.Details, &deviceIdentityDetails) + if err != nil { + cli.sendPairError(reqID, 500, "internal-error") + return &PairProtoError{"failed to parse device identity details in pair success message", err} + } + + if cli.PrePairCallback != nil && !cli.PrePairCallback(jid, platform, businessName) { + cli.sendPairError(reqID, 500, "internal-error") + return ErrPairRejectedLocally + } + + cli.Store.Account = proto.Clone(&deviceIdentity).(*waProto.ADVSignedDeviceIdentity) + + mainDeviceJID := jid + mainDeviceJID.Device = 0 + mainDeviceIdentity := *(*[32]byte)(deviceIdentity.AccountSignatureKey) + deviceIdentity.AccountSignatureKey = nil + + selfSignedDeviceIdentity, err := proto.Marshal(&deviceIdentity) + if err != nil { + cli.sendPairError(reqID, 500, "internal-error") + return &PairProtoError{"failed to marshal self-signed device identity", err} + } + + cli.Store.ID = &jid + cli.Store.BusinessName = businessName + cli.Store.Platform = platform + err = cli.Store.Save() + if err != nil { + cli.sendPairError(reqID, 500, "internal-error") + return &PairDatabaseError{"failed to save device store", err} + } + err = cli.Store.Identities.PutIdentity(mainDeviceJID.SignalAddress().String(), mainDeviceIdentity) + if err != nil { + _ = cli.Store.Delete() + cli.sendPairError(reqID, 500, "internal-error") + return &PairDatabaseError{"failed to store main device identity", err} + } + + // Expect a disconnect after this and don't dispatch the usual Disconnected event + cli.expectDisconnect() + + err = cli.sendNode(waBinary.Node{ + Tag: "iq", + Attrs: waBinary.Attrs{ + "to": types.ServerJID, + "type": "result", + "id": reqID, + }, + Content: []waBinary.Node{{ + Tag: "pair-device-sign", + Content: []waBinary.Node{{ + Tag: "device-identity", + Attrs: waBinary.Attrs{ + "key-index": deviceIdentityDetails.GetKeyIndex(), + }, + Content: selfSignedDeviceIdentity, + }}, + }}, + }) + if err != nil { + _ = cli.Store.Delete() + return fmt.Errorf("failed to send pairing confirmation: %w", err) + } + return nil +} + +func concatBytes(data ...[]byte) []byte { + length := 0 + for _, item := range data { + length += len(item) + } + output := make([]byte, length) + ptr := 0 + for _, item := range data { + ptr += copy(output[ptr:ptr+len(item)], item) + } + return output +} + +func verifyDeviceIdentityAccountSignature(deviceIdentity *waProto.ADVSignedDeviceIdentity, ikp *keys.KeyPair) bool { + if len(deviceIdentity.AccountSignatureKey) != 32 || len(deviceIdentity.AccountSignature) != 64 { + return false + } + + signatureKey := ecc.NewDjbECPublicKey(*(*[32]byte)(deviceIdentity.AccountSignatureKey)) + signature := *(*[64]byte)(deviceIdentity.AccountSignature) + + message := concatBytes([]byte{6, 0}, deviceIdentity.Details, ikp.Pub[:]) + return ecc.VerifySignature(signatureKey, message, signature) +} + +func generateDeviceSignature(deviceIdentity *waProto.ADVSignedDeviceIdentity, ikp *keys.KeyPair) *[64]byte { + message := concatBytes([]byte{6, 1}, deviceIdentity.Details, ikp.Pub[:], deviceIdentity.AccountSignatureKey) + sig := ecc.CalculateSignature(ecc.NewDjbECPrivateKey(*ikp.Priv), message) + return &sig +} + +func (cli *Client) sendPairError(id string, code int, text string) { + err := cli.sendNode(waBinary.Node{ + Tag: "iq", + Attrs: waBinary.Attrs{ + "to": types.ServerJID, + "type": "error", + "id": id, + }, + Content: []waBinary.Node{{ + Tag: "error", + Attrs: waBinary.Attrs{ + "code": code, + "text": text, + }, + }}, + }) + if err != nil { + cli.Log.Errorf("Failed to send pair error node: %v", err) + } +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/prekeys.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/prekeys.go new file mode 100644 index 0000000..c0ece2e --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/prekeys.go @@ -0,0 +1,237 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package whatsmeow + +import ( + "context" + "encoding/binary" + "fmt" + "time" + + "go.mau.fi/libsignal/ecc" + "go.mau.fi/libsignal/keys/identity" + "go.mau.fi/libsignal/keys/prekey" + "go.mau.fi/libsignal/util/optional" + + waBinary "go.mau.fi/whatsmeow/binary" + "go.mau.fi/whatsmeow/types" + "go.mau.fi/whatsmeow/util/keys" +) + +const ( + // WantedPreKeyCount is the number of prekeys that the client should upload to the WhatsApp servers in a single batch. + WantedPreKeyCount = 50 + // MinPreKeyCount is the number of prekeys when the client will upload a new batch of prekeys to the WhatsApp servers. + MinPreKeyCount = 5 +) + +func (cli *Client) getServerPreKeyCount() (int, error) { + resp, err := cli.sendIQ(infoQuery{ + Namespace: "encrypt", + Type: "get", + To: types.ServerJID, + Content: []waBinary.Node{ + {Tag: "count"}, + }, + }) + if err != nil { + return 0, fmt.Errorf("failed to get prekey count on server: %w", err) + } + count := resp.GetChildByTag("count") + ag := count.AttrGetter() + val := ag.Int("value") + return val, ag.Error() +} + +func (cli *Client) uploadPreKeys() { + cli.uploadPreKeysLock.Lock() + defer cli.uploadPreKeysLock.Unlock() + if cli.lastPreKeyUpload.Add(10 * time.Minute).After(time.Now()) { + sc, _ := cli.getServerPreKeyCount() + if sc >= WantedPreKeyCount { + cli.Log.Debugf("Canceling prekey upload request due to likely race condition") + return + } + } + var registrationIDBytes [4]byte + binary.BigEndian.PutUint32(registrationIDBytes[:], cli.Store.RegistrationID) + preKeys, err := cli.Store.PreKeys.GetOrGenPreKeys(WantedPreKeyCount) + if err != nil { + cli.Log.Errorf("Failed to get prekeys to upload: %v", err) + return + } + cli.Log.Infof("Uploading %d new prekeys to server", len(preKeys)) + _, err = cli.sendIQ(infoQuery{ + Namespace: "encrypt", + Type: "set", + To: types.ServerJID, + Content: []waBinary.Node{ + {Tag: "registration", Content: registrationIDBytes[:]}, + {Tag: "type", Content: []byte{ecc.DjbType}}, + {Tag: "identity", Content: cli.Store.IdentityKey.Pub[:]}, + {Tag: "list", Content: preKeysToNodes(preKeys)}, + preKeyToNode(cli.Store.SignedPreKey), + }, + }) + if err != nil { + cli.Log.Errorf("Failed to send request to upload prekeys: %v", err) + return + } + cli.Log.Debugf("Got response to uploading prekeys") + err = cli.Store.PreKeys.MarkPreKeysAsUploaded(preKeys[len(preKeys)-1].KeyID) + if err != nil { + cli.Log.Warnf("Failed to mark prekeys as uploaded: %v", err) + } + cli.lastPreKeyUpload = time.Now() +} + +type preKeyResp struct { + bundle *prekey.Bundle + err error +} + +func (cli *Client) fetchPreKeys(ctx context.Context, users []types.JID) (map[types.JID]preKeyResp, error) { + requests := make([]waBinary.Node, len(users)) + for i, user := range users { + requests[i].Tag = "user" + requests[i].Attrs = waBinary.Attrs{ + "jid": user, + "reason": "identity", + } + } + resp, err := cli.sendIQ(infoQuery{ + Context: ctx, + Namespace: "encrypt", + Type: "get", + To: types.ServerJID, + Content: []waBinary.Node{{ + Tag: "key", + Content: requests, + }}, + }) + if err != nil { + return nil, fmt.Errorf("failed to send prekey request: %w", err) + } else if len(resp.GetChildren()) == 0 { + return nil, fmt.Errorf("got empty response to prekey request") + } + list := resp.GetChildByTag("list") + respData := make(map[types.JID]preKeyResp) + for _, child := range list.GetChildren() { + if child.Tag != "user" { + continue + } + jid := child.AttrGetter().JID("jid") + jid.AD = true + bundle, err := nodeToPreKeyBundle(uint32(jid.Device), child) + respData[jid] = preKeyResp{bundle, err} + } + return respData, nil +} + +func preKeyToNode(key *keys.PreKey) waBinary.Node { + var keyID [4]byte + binary.BigEndian.PutUint32(keyID[:], key.KeyID) + node := waBinary.Node{ + Tag: "key", + Content: []waBinary.Node{ + {Tag: "id", Content: keyID[1:]}, + {Tag: "value", Content: key.Pub[:]}, + }, + } + if key.Signature != nil { + node.Tag = "skey" + node.Content = append(node.GetChildren(), waBinary.Node{ + Tag: "signature", + Content: key.Signature[:], + }) + } + return node +} + +func nodeToPreKeyBundle(deviceID uint32, node waBinary.Node) (*prekey.Bundle, error) { + errorNode, ok := node.GetOptionalChildByTag("error") + if ok && errorNode.Tag == "error" { + return nil, fmt.Errorf("got error getting prekeys: %s", errorNode.XMLString()) + } + + registrationBytes, ok := node.GetChildByTag("registration").Content.([]byte) + if !ok || len(registrationBytes) != 4 { + return nil, fmt.Errorf("invalid registration ID in prekey response") + } + registrationID := binary.BigEndian.Uint32(registrationBytes) + + keysNode, ok := node.GetOptionalChildByTag("keys") + if !ok { + keysNode = node + } + + identityKeyRaw, ok := keysNode.GetChildByTag("identity").Content.([]byte) + if !ok || len(identityKeyRaw) != 32 { + return nil, fmt.Errorf("invalid identity key in prekey response") + } + identityKeyPub := *(*[32]byte)(identityKeyRaw) + + preKey, err := nodeToPreKey(keysNode.GetChildByTag("key")) + if err != nil { + return nil, fmt.Errorf("invalid prekey in prekey response: %w", err) + } + signedPreKey, err := nodeToPreKey(keysNode.GetChildByTag("skey")) + if err != nil { + return nil, fmt.Errorf("invalid signed prekey in prekey response: %w", err) + } + + return prekey.NewBundle(registrationID, deviceID, + optional.NewOptionalUint32(preKey.KeyID), signedPreKey.KeyID, + ecc.NewDjbECPublicKey(*preKey.Pub), ecc.NewDjbECPublicKey(*signedPreKey.Pub), *signedPreKey.Signature, + identity.NewKey(ecc.NewDjbECPublicKey(identityKeyPub))), nil +} + +func nodeToPreKey(node waBinary.Node) (*keys.PreKey, error) { + key := keys.PreKey{ + KeyPair: keys.KeyPair{}, + KeyID: 0, + Signature: nil, + } + if id := node.GetChildByTag("id"); id.Tag != "id" { + return nil, fmt.Errorf("prekey node doesn't contain ID tag") + } else if idBytes, ok := id.Content.([]byte); !ok { + return nil, fmt.Errorf("prekey ID has unexpected content (%T)", id.Content) + } else if len(idBytes) != 3 { + return nil, fmt.Errorf("prekey ID has unexpected number of bytes (%d, expected 3)", len(idBytes)) + } else { + key.KeyID = binary.BigEndian.Uint32(append([]byte{0}, idBytes...)) + } + if pubkey := node.GetChildByTag("value"); pubkey.Tag != "value" { + return nil, fmt.Errorf("prekey node doesn't contain value tag") + } else if pubkeyBytes, ok := pubkey.Content.([]byte); !ok { + return nil, fmt.Errorf("prekey value has unexpected content (%T)", pubkey.Content) + } else if len(pubkeyBytes) != 32 { + return nil, fmt.Errorf("prekey value has unexpected number of bytes (%d, expected 32)", len(pubkeyBytes)) + } else { + key.KeyPair.Pub = (*[32]byte)(pubkeyBytes) + } + if node.Tag == "skey" { + if sig := node.GetChildByTag("signature"); sig.Tag != "signature" { + return nil, fmt.Errorf("prekey node doesn't contain signature tag") + } else if sigBytes, ok := sig.Content.([]byte); !ok { + return nil, fmt.Errorf("prekey signature has unexpected content (%T)", sig.Content) + } else if len(sigBytes) != 64 { + return nil, fmt.Errorf("prekey signature has unexpected number of bytes (%d, expected 64)", len(sigBytes)) + } else { + key.Signature = (*[64]byte)(sigBytes) + } + } + return &key, nil +} + +func preKeysToNodes(prekeys []*keys.PreKey) []waBinary.Node { + nodes := make([]waBinary.Node, len(prekeys)) + for i, key := range prekeys { + nodes[i] = preKeyToNode(key) + } + return nodes +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/presence.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/presence.go new file mode 100644 index 0000000..0ce94a7 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/presence.go @@ -0,0 +1,139 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package whatsmeow + +import ( + "fmt" + "sync/atomic" + + waBinary "go.mau.fi/whatsmeow/binary" + "go.mau.fi/whatsmeow/types" + "go.mau.fi/whatsmeow/types/events" +) + +func (cli *Client) handleChatState(node *waBinary.Node) { + source, err := cli.parseMessageSource(node, true) + if err != nil { + cli.Log.Warnf("Failed to parse chat state update: %v", err) + } else if len(node.GetChildren()) != 1 { + cli.Log.Warnf("Failed to parse chat state update: unexpected number of children in element (%d)", len(node.GetChildren())) + } else { + child := node.GetChildren()[0] + presence := types.ChatPresence(child.Tag) + if presence != types.ChatPresenceComposing && presence != types.ChatPresencePaused { + cli.Log.Warnf("Unrecognized chat presence state %s", child.Tag) + } + media := types.ChatPresenceMedia(child.AttrGetter().OptionalString("media")) + cli.dispatchEvent(&events.ChatPresence{ + MessageSource: source, + State: presence, + Media: media, + }) + } +} + +func (cli *Client) handlePresence(node *waBinary.Node) { + var evt events.Presence + ag := node.AttrGetter() + evt.From = ag.JID("from") + presenceType := ag.OptionalString("type") + if presenceType == "unavailable" { + evt.Unavailable = true + } else if presenceType != "" { + cli.Log.Debugf("Unrecognized presence type '%s' in presence event from %s", presenceType, evt.From) + } + lastSeen := ag.OptionalString("last") + if lastSeen != "" && lastSeen != "deny" { + evt.LastSeen = ag.UnixTime("last") + } + if !ag.OK() { + cli.Log.Warnf("Error parsing presence event: %+v", ag.Errors) + } else { + cli.dispatchEvent(&evt) + } +} + +// SendPresence updates the user's presence status on WhatsApp. +// +// You should call this at least once after connecting so that the server has your pushname. +// Otherwise, other users will see "-" as the name. +func (cli *Client) SendPresence(state types.Presence) error { + if len(cli.Store.PushName) == 0 { + return ErrNoPushName + } + if state == types.PresenceAvailable { + atomic.CompareAndSwapUint32(&cli.sendActiveReceipts, 0, 1) + } else { + atomic.CompareAndSwapUint32(&cli.sendActiveReceipts, 1, 0) + } + return cli.sendNode(waBinary.Node{ + Tag: "presence", + Attrs: waBinary.Attrs{ + "name": cli.Store.PushName, + "type": string(state), + }, + }) +} + +// SubscribePresence asks the WhatsApp servers to send presence updates of a specific user to this client. +// +// After subscribing to this event, you should start receiving *events.Presence for that user in normal event handlers. +// +// Also, it seems that the WhatsApp servers require you to be online to receive presence status from other users, +// so you should mark yourself as online before trying to use this function: +// +// cli.SendPresence(types.PresenceAvailable) +func (cli *Client) SubscribePresence(jid types.JID) error { + privacyToken, err := cli.Store.PrivacyTokens.GetPrivacyToken(jid) + if err != nil { + return fmt.Errorf("failed to get privacy token: %w", err) + } else if privacyToken == nil { + if cli.ErrorOnSubscribePresenceWithoutToken { + return fmt.Errorf("%w for %v", ErrNoPrivacyToken, jid.ToNonAD()) + } else { + cli.Log.Debugf("Trying to subscribe to presence of %s without privacy token", jid) + } + } + req := waBinary.Node{ + Tag: "presence", + Attrs: waBinary.Attrs{ + "type": "subscribe", + "to": jid, + }, + } + if privacyToken != nil { + req.Content = []waBinary.Node{{ + Tag: "tctoken", + Content: privacyToken.Token, + }} + } + return cli.sendNode(req) +} + +// SendChatPresence updates the user's typing status in a specific chat. +// +// The media parameter can be set to indicate the user is recording media (like a voice message) rather than typing a text message. +func (cli *Client) SendChatPresence(jid types.JID, state types.ChatPresence, media types.ChatPresenceMedia) error { + ownID := cli.getOwnID() + if ownID.IsEmpty() { + return ErrNotLoggedIn + } + content := []waBinary.Node{{Tag: string(state)}} + if state == types.ChatPresenceComposing && len(media) > 0 { + content[0].Attrs = waBinary.Attrs{ + "media": string(media), + } + } + return cli.sendNode(waBinary.Node{ + Tag: "chatstate", + Attrs: waBinary.Attrs{ + "from": ownID, + "to": jid, + }, + Content: content, + }) +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/privacysettings.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/privacysettings.go new file mode 100644 index 0000000..3aca72d --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/privacysettings.go @@ -0,0 +1,93 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package whatsmeow + +import ( + waBinary "go.mau.fi/whatsmeow/binary" + "go.mau.fi/whatsmeow/types" + "go.mau.fi/whatsmeow/types/events" +) + +// TryFetchPrivacySettings will fetch the user's privacy settings, either from the in-memory cache or from the server. +func (cli *Client) TryFetchPrivacySettings(ignoreCache bool) (*types.PrivacySettings, error) { + if val := cli.privacySettingsCache.Load(); val != nil && !ignoreCache { + return val.(*types.PrivacySettings), nil + } + resp, err := cli.sendIQ(infoQuery{ + Namespace: "privacy", + Type: iqGet, + To: types.ServerJID, + Content: []waBinary.Node{{Tag: "privacy"}}, + }) + if err != nil { + return nil, err + } + privacyNode, ok := resp.GetOptionalChildByTag("privacy") + if !ok { + return nil, &ElementMissingError{Tag: "privacy", In: "response to privacy settings query"} + } + var settings types.PrivacySettings + cli.parsePrivacySettings(&privacyNode, &settings) + cli.privacySettingsCache.Store(&settings) + return &settings, nil +} + +// GetPrivacySettings will get the user's privacy settings. If an error occurs while fetching them, the error will be +// logged, but the method will just return an empty struct. +func (cli *Client) GetPrivacySettings() (settings types.PrivacySettings) { + settingsPtr, err := cli.TryFetchPrivacySettings(false) + if err != nil { + cli.Log.Errorf("Failed to fetch privacy settings: %v", err) + } else { + settings = *settingsPtr + } + return +} + +func (cli *Client) parsePrivacySettings(privacyNode *waBinary.Node, settings *types.PrivacySettings) *events.PrivacySettings { + var evt events.PrivacySettings + for _, child := range privacyNode.GetChildren() { + if child.Tag != "category" { + continue + } + ag := child.AttrGetter() + name := ag.String("name") + value := types.PrivacySetting(ag.String("value")) + switch name { + case "groupadd": + settings.GroupAdd = value + evt.GroupAddChanged = true + case "last": + settings.LastSeen = value + evt.LastSeenChanged = true + case "status": + settings.Status = value + evt.StatusChanged = true + case "profile": + settings.Profile = value + evt.ProfileChanged = true + case "readreceipts": + settings.ReadReceipts = value + evt.ReadReceiptsChanged = true + } + } + return &evt +} + +func (cli *Client) handlePrivacySettingsNotification(privacyNode *waBinary.Node) { + cli.Log.Debugf("Parsing privacy settings change notification") + settings, err := cli.TryFetchPrivacySettings(false) + if err != nil { + cli.Log.Errorf("Failed to fetch privacy settings when handling change: %v", err) + } + evt := cli.parsePrivacySettings(privacyNode, settings) + // The data isn't be reliable if the fetch failed, so only cache if it didn't fail + if err == nil { + cli.privacySettingsCache.Store(settings) + } + cli.dispatchEvent(evt) +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/qrchan.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/qrchan.go new file mode 100644 index 0000000..5401ac0 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/qrchan.go @@ -0,0 +1,177 @@ +// Copyright (c) 2022 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package whatsmeow + +import ( + "context" + "sync" + "sync/atomic" + "time" + + "go.mau.fi/whatsmeow/types/events" + waLog "go.mau.fi/whatsmeow/util/log" +) + +type QRChannelItem struct { + // The type of event, "code" for new QR codes (see Code field) and "error" for pairing errors (see Error) field. + // For non-code/error events, you can just compare the whole item to the event variables (like QRChannelSuccess). + Event string + // If the item is a pair error, then this field contains the error message. + Error error + // If the item is a new code, then this field contains the raw data. + Code string + // The timeout after which the next code will be sent down the channel. + Timeout time.Duration +} + +const QRChannelEventCode = "code" +const QRChannelEventError = "error" + +// Possible final items in the QR channel. In addition to these, an `error` event may be emitted, +// in which case the Error field will have the error that occurred during pairing. +var ( + // QRChannelSuccess is emitted from GetQRChannel when the pairing is successful. + QRChannelSuccess = QRChannelItem{Event: "success"} + // QRChannelTimeout is emitted from GetQRChannel if the socket gets disconnected by the server before the pairing is successful. + QRChannelTimeout = QRChannelItem{Event: "timeout"} + // QRChannelErrUnexpectedEvent is emitted from GetQRChannel if an unexpected connection event is received, + // as that likely means that the pairing has already happened before the channel was set up. + QRChannelErrUnexpectedEvent = QRChannelItem{Event: "err-unexpected-state"} + // QRChannelClientOutdated is emitted from GetQRChannel if events.ClientOutdated is received. + QRChannelClientOutdated = QRChannelItem{Event: "err-client-outdated"} + // QRChannelScannedWithoutMultidevice is emitted from GetQRChannel if events.QRScannedWithoutMultidevice is received. + QRChannelScannedWithoutMultidevice = QRChannelItem{Event: "err-scanned-without-multidevice"} +) + +type qrChannel struct { + sync.Mutex + cli *Client + log waLog.Logger + ctx context.Context + handlerID uint32 + closed uint32 + output chan<- QRChannelItem + stopQRs chan struct{} +} + +func (qrc *qrChannel) emitQRs(evt *events.QR) { + var nextCode string + for { + if len(evt.Codes) == 0 { + if atomic.CompareAndSwapUint32(&qrc.closed, 0, 1) { + qrc.log.Debugf("Ran out of QR codes, closing channel with status %s and disconnecting client", QRChannelTimeout) + qrc.output <- QRChannelTimeout + close(qrc.output) + go qrc.cli.RemoveEventHandler(qrc.handlerID) + qrc.cli.Disconnect() + } else { + qrc.log.Debugf("Ran out of QR codes, but channel is already closed") + } + return + } else if atomic.LoadUint32(&qrc.closed) == 1 { + qrc.log.Debugf("QR code channel is closed, exiting QR emitter") + return + } + timeout := 20 * time.Second + if len(evt.Codes) == 6 { + timeout = 60 * time.Second + } + nextCode, evt.Codes = evt.Codes[0], evt.Codes[1:] + qrc.log.Debugf("Emitting QR code %s", nextCode) + select { + case qrc.output <- QRChannelItem{Code: nextCode, Timeout: timeout, Event: QRChannelEventCode}: + default: + qrc.log.Debugf("Output channel didn't accept code, exiting QR emitter") + if atomic.CompareAndSwapUint32(&qrc.closed, 0, 1) { + close(qrc.output) + go qrc.cli.RemoveEventHandler(qrc.handlerID) + qrc.cli.Disconnect() + } + return + } + select { + case <-time.After(timeout): + case <-qrc.stopQRs: + qrc.log.Debugf("Got signal to stop QR emitter") + return + case <-qrc.ctx.Done(): + qrc.log.Debugf("Context is done, stopping QR emitter") + if atomic.CompareAndSwapUint32(&qrc.closed, 0, 1) { + close(qrc.output) + go qrc.cli.RemoveEventHandler(qrc.handlerID) + qrc.cli.Disconnect() + } + } + } +} + +func (qrc *qrChannel) handleEvent(rawEvt interface{}) { + if atomic.LoadUint32(&qrc.closed) == 1 { + qrc.log.Debugf("Dropping event of type %T, channel is closed", rawEvt) + return + } + var outputType QRChannelItem + switch evt := rawEvt.(type) { + case *events.QR: + qrc.log.Debugf("Received QR code event, starting to emit codes to channel") + go qrc.emitQRs(evt) + return + case *events.QRScannedWithoutMultidevice: + qrc.log.Debugf("QR code scanned without multidevice enabled") + qrc.output <- QRChannelScannedWithoutMultidevice + return + case *events.ClientOutdated: + outputType = QRChannelClientOutdated + case *events.PairSuccess: + outputType = QRChannelSuccess + case *events.PairError: + outputType = QRChannelItem{ + Event: QRChannelEventError, + Error: evt.Error, + } + case *events.Disconnected: + outputType = QRChannelTimeout + case *events.Connected, *events.ConnectFailure, *events.LoggedOut, *events.TemporaryBan: + outputType = QRChannelErrUnexpectedEvent + default: + return + } + close(qrc.stopQRs) + if atomic.CompareAndSwapUint32(&qrc.closed, 0, 1) { + qrc.log.Debugf("Closing channel with status %+v", outputType) + qrc.output <- outputType + close(qrc.output) + } else { + qrc.log.Debugf("Got status %+v, but channel is already closed", outputType) + } + // Has to be done in background because otherwise there's a deadlock with eventHandlersLock + go qrc.cli.RemoveEventHandler(qrc.handlerID) +} + +// GetQRChannel returns a channel that automatically outputs a new QR code when the previous one expires. +// +// This must be called *before* Connect(). It will then listen to all the relevant events from the client. +// +// The last value to be emitted will be a special event like "success", "timeout" or another error code +// depending on the result of the pairing. The channel will be closed immediately after one of those. +func (cli *Client) GetQRChannel(ctx context.Context) (<-chan QRChannelItem, error) { + if cli.IsConnected() { + return nil, ErrQRAlreadyConnected + } else if cli.Store.ID != nil { + return nil, ErrQRStoreContainsID + } + ch := make(chan QRChannelItem, 8) + qrc := qrChannel{ + output: ch, + stopQRs: make(chan struct{}), + cli: cli, + log: cli.Log.Sub("QRChannel"), + ctx: ctx, + } + qrc.handlerID = cli.AddEventHandler(qrc.handleEvent) + return ch, nil +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/receipt.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/receipt.go new file mode 100644 index 0000000..7e02c0a --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/receipt.go @@ -0,0 +1,205 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package whatsmeow + +import ( + "fmt" + "sync/atomic" + "time" + + waBinary "go.mau.fi/whatsmeow/binary" + "go.mau.fi/whatsmeow/types" + "go.mau.fi/whatsmeow/types/events" +) + +func (cli *Client) handleReceipt(node *waBinary.Node) { + receipt, err := cli.parseReceipt(node) + if err != nil { + cli.Log.Warnf("Failed to parse receipt: %v", err) + } else if receipt != nil { + if receipt.Type == events.ReceiptTypeRetry { + go func() { + err := cli.handleRetryReceipt(receipt, node) + if err != nil { + cli.Log.Errorf("Failed to handle retry receipt for %s/%s from %s: %v", receipt.Chat, receipt.MessageIDs[0], receipt.Sender, err) + } + }() + } + go cli.dispatchEvent(receipt) + } + go cli.sendAck(node) +} + +func (cli *Client) handleGroupedReceipt(partialReceipt events.Receipt, participants *waBinary.Node) { + pag := participants.AttrGetter() + partialReceipt.MessageIDs = []types.MessageID{pag.String("key")} + for _, child := range participants.GetChildren() { + if child.Tag != "user" { + cli.Log.Warnf("Unexpected node in grouped receipt participants: %s", child.XMLString()) + continue + } + ag := child.AttrGetter() + receipt := partialReceipt + receipt.Timestamp = ag.UnixTime("t") + receipt.MessageSource.Sender = ag.JID("jid") + if !ag.OK() { + cli.Log.Warnf("Failed to parse user node %s in grouped receipt: %v", child.XMLString(), ag.Error()) + continue + } + go cli.dispatchEvent(&receipt) + } +} + +func (cli *Client) parseReceipt(node *waBinary.Node) (*events.Receipt, error) { + ag := node.AttrGetter() + source, err := cli.parseMessageSource(node, false) + if err != nil { + return nil, err + } + receipt := events.Receipt{ + MessageSource: source, + Timestamp: ag.UnixTime("t"), + Type: events.ReceiptType(ag.OptionalString("type")), + } + if source.IsGroup && source.Sender.IsEmpty() { + participantTags := node.GetChildrenByTag("participants") + if len(participantTags) == 0 { + return nil, &ElementMissingError{Tag: "participants", In: "grouped receipt"} + } + for _, pcp := range participantTags { + cli.handleGroupedReceipt(receipt, &pcp) + } + return nil, nil + } + mainMessageID := ag.String("id") + if !ag.OK() { + return nil, fmt.Errorf("failed to parse read receipt attrs: %+v", ag.Errors) + } + + receiptChildren := node.GetChildren() + if len(receiptChildren) == 1 && receiptChildren[0].Tag == "list" { + listChildren := receiptChildren[0].GetChildren() + receipt.MessageIDs = make([]string, 1, len(listChildren)+1) + receipt.MessageIDs[0] = mainMessageID + for _, item := range listChildren { + if id, ok := item.Attrs["id"].(string); ok && item.Tag == "item" { + receipt.MessageIDs = append(receipt.MessageIDs, id) + } + } + } else { + receipt.MessageIDs = []types.MessageID{mainMessageID} + } + return &receipt, nil +} + +func (cli *Client) sendAck(node *waBinary.Node) { + attrs := waBinary.Attrs{ + "class": node.Tag, + "id": node.Attrs["id"], + } + attrs["to"] = node.Attrs["from"] + if participant, ok := node.Attrs["participant"]; ok { + attrs["participant"] = participant + } + if recipient, ok := node.Attrs["recipient"]; ok { + attrs["recipient"] = recipient + } + if receiptType, ok := node.Attrs["type"]; node.Tag != "message" && ok { + attrs["type"] = receiptType + } + err := cli.sendNode(waBinary.Node{ + Tag: "ack", + Attrs: attrs, + }) + if err != nil { + cli.Log.Warnf("Failed to send acknowledgement for %s %s: %v", node.Tag, node.Attrs["id"], err) + } +} + +// MarkRead sends a read receipt for the given message IDs including the given timestamp as the read at time. +// +// The first JID parameter (chat) must always be set to the chat ID (user ID in DMs and group ID in group chats). +// The second JID parameter (sender) must be set in group chats and must be the user ID who sent the message. +func (cli *Client) MarkRead(ids []types.MessageID, timestamp time.Time, chat, sender types.JID) error { + node := waBinary.Node{ + Tag: "receipt", + Attrs: waBinary.Attrs{ + "id": ids[0], + "type": "read", + "to": chat, + "t": timestamp.Unix(), + }, + } + if cli.GetPrivacySettings().ReadReceipts == types.PrivacySettingNone { + node.Attrs["type"] = "read-self" + } + if !sender.IsEmpty() && chat.Server != types.DefaultUserServer { + node.Attrs["participant"] = sender.ToNonAD() + } + if len(ids) > 1 { + children := make([]waBinary.Node, len(ids)-1) + for i := 1; i < len(ids); i++ { + children[i-1].Tag = "item" + children[i-1].Attrs = waBinary.Attrs{"id": ids[i]} + } + node.Content = []waBinary.Node{{ + Tag: "list", + Content: children, + }} + } + return cli.sendNode(node) +} + +// SetForceActiveDeliveryReceipts will force the client to send normal delivery +// receipts (which will show up as the two gray ticks on WhatsApp), even if the +// client isn't marked as online. +// +// By default, clients that haven't been marked as online will send delivery +// receipts with type="inactive", which is transmitted to the sender, but not +// rendered in the official WhatsApp apps. This is consistent with how WhatsApp +// web works when it's not in the foreground. +// +// To mark the client as online, use +// +// cli.SendPresence(types.PresenceAvailable) +// +// Note that if you turn this off (i.e. call SetForceActiveDeliveryReceipts(false)), +// receipts will act like the client is offline until SendPresence is called again. +func (cli *Client) SetForceActiveDeliveryReceipts(active bool) { + if active { + atomic.StoreUint32(&cli.sendActiveReceipts, 2) + } else { + atomic.StoreUint32(&cli.sendActiveReceipts, 0) + } +} + +func (cli *Client) sendMessageReceipt(info *types.MessageInfo) { + attrs := waBinary.Attrs{ + "id": info.ID, + } + if info.IsFromMe { + attrs["type"] = "sender" + } else if atomic.LoadUint32(&cli.sendActiveReceipts) == 0 { + attrs["type"] = "inactive" + } + attrs["to"] = info.Chat + if info.IsGroup { + attrs["participant"] = info.Sender + } else if info.IsFromMe { + attrs["recipient"] = info.Sender + } else { + // Override the to attribute with the JID version with a device number + attrs["to"] = info.Sender + } + err := cli.sendNode(waBinary.Node{ + Tag: "receipt", + Attrs: attrs, + }) + if err != nil { + cli.Log.Warnf("Failed to send receipt for %s: %v", info.ID, err) + } +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/request.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/request.go new file mode 100644 index 0000000..6945fd7 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/request.go @@ -0,0 +1,221 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package whatsmeow + +import ( + "context" + "fmt" + "strconv" + "sync/atomic" + "time" + + waBinary "go.mau.fi/whatsmeow/binary" + "go.mau.fi/whatsmeow/types" +) + +func (cli *Client) generateRequestID() string { + return cli.uniqueID + strconv.FormatUint(uint64(atomic.AddUint32(&cli.idCounter, 1)), 10) +} + +var xmlStreamEndNode = &waBinary.Node{Tag: "xmlstreamend"} + +func isDisconnectNode(node *waBinary.Node) bool { + return node == xmlStreamEndNode || node.Tag == "stream:error" +} + +// isAuthErrorDisconnect checks if the given disconnect node is an error that shouldn't cause retrying. +func isAuthErrorDisconnect(node *waBinary.Node) bool { + if node.Tag != "stream:error" { + return false + } + code, _ := node.Attrs["code"].(string) + conflict, _ := node.GetOptionalChildByTag("conflict") + conflictType := conflict.AttrGetter().OptionalString("type") + if code == "401" || conflictType == "replaced" || conflictType == "device_removed" { + return true + } + return false +} + +func (cli *Client) clearResponseWaiters(node *waBinary.Node) { + cli.responseWaitersLock.Lock() + for _, waiter := range cli.responseWaiters { + select { + case waiter <- node: + default: + close(waiter) + } + } + cli.responseWaiters = make(map[string]chan<- *waBinary.Node) + cli.responseWaitersLock.Unlock() +} + +func (cli *Client) waitResponse(reqID string) chan *waBinary.Node { + ch := make(chan *waBinary.Node, 1) + cli.responseWaitersLock.Lock() + cli.responseWaiters[reqID] = ch + cli.responseWaitersLock.Unlock() + return ch +} + +func (cli *Client) cancelResponse(reqID string, ch chan *waBinary.Node) { + cli.responseWaitersLock.Lock() + close(ch) + delete(cli.responseWaiters, reqID) + cli.responseWaitersLock.Unlock() +} + +func (cli *Client) receiveResponse(data *waBinary.Node) bool { + id, ok := data.Attrs["id"].(string) + if !ok || (data.Tag != "iq" && data.Tag != "ack") { + return false + } + cli.responseWaitersLock.Lock() + waiter, ok := cli.responseWaiters[id] + if !ok { + cli.responseWaitersLock.Unlock() + return false + } + delete(cli.responseWaiters, id) + cli.responseWaitersLock.Unlock() + waiter <- data + return true +} + +type infoQueryType string + +const ( + iqSet infoQueryType = "set" + iqGet infoQueryType = "get" +) + +type infoQuery struct { + Namespace string + Type infoQueryType + To types.JID + Target types.JID + ID string + Content interface{} + + Timeout time.Duration + NoRetry bool + Context context.Context +} + +func (cli *Client) sendIQAsyncAndGetData(query *infoQuery) (<-chan *waBinary.Node, []byte, error) { + if len(query.ID) == 0 { + query.ID = cli.generateRequestID() + } + waiter := cli.waitResponse(query.ID) + attrs := waBinary.Attrs{ + "id": query.ID, + "xmlns": query.Namespace, + "type": string(query.Type), + } + if !query.To.IsEmpty() { + attrs["to"] = query.To + } + if !query.Target.IsEmpty() { + attrs["target"] = query.Target + } + data, err := cli.sendNodeAndGetData(waBinary.Node{ + Tag: "iq", + Attrs: attrs, + Content: query.Content, + }) + if err != nil { + cli.cancelResponse(query.ID, waiter) + return nil, data, err + } + return waiter, data, nil +} + +func (cli *Client) sendIQAsync(query infoQuery) (<-chan *waBinary.Node, error) { + ch, _, err := cli.sendIQAsyncAndGetData(&query) + return ch, err +} + +func (cli *Client) sendIQ(query infoQuery) (*waBinary.Node, error) { + resChan, data, err := cli.sendIQAsyncAndGetData(&query) + if err != nil { + return nil, err + } + if query.Timeout == 0 { + query.Timeout = 75 * time.Second + } + if query.Context == nil { + query.Context = context.Background() + } + select { + case res := <-resChan: + if isDisconnectNode(res) { + if query.NoRetry { + return nil, &DisconnectedError{Action: "info query", Node: res} + } + res, err = cli.retryFrame("info query", query.ID, data, res, query.Context, query.Timeout) + if err != nil { + return nil, err + } + } + resType, _ := res.Attrs["type"].(string) + if res.Tag != "iq" || (resType != "result" && resType != "error") { + return res, &IQError{RawNode: res} + } else if resType == "error" { + return res, parseIQError(res) + } + return res, nil + case <-query.Context.Done(): + return nil, query.Context.Err() + case <-time.After(query.Timeout): + return nil, ErrIQTimedOut + } +} + +func (cli *Client) retryFrame(reqType, id string, data []byte, origResp *waBinary.Node, ctx context.Context, timeout time.Duration) (*waBinary.Node, error) { + if isAuthErrorDisconnect(origResp) { + cli.Log.Debugf("%s (%s) was interrupted by websocket disconnection (%s), not retrying as it looks like an auth error", id, reqType, origResp.XMLString()) + return nil, &DisconnectedError{Action: reqType, Node: origResp} + } + + cli.Log.Debugf("%s (%s) was interrupted by websocket disconnection (%s), waiting for reconnect to retry...", id, reqType, origResp.XMLString()) + if !cli.WaitForConnection(5 * time.Second) { + cli.Log.Debugf("Websocket didn't reconnect within 5 seconds of failed %s (%s)", reqType, id) + return nil, &DisconnectedError{Action: reqType, Node: origResp} + } + + cli.socketLock.RLock() + sock := cli.socket + cli.socketLock.RUnlock() + if sock == nil { + return nil, ErrNotConnected + } + + respChan := cli.waitResponse(id) + err := sock.SendFrame(data) + if err != nil { + cli.cancelResponse(id, respChan) + return nil, err + } + var resp *waBinary.Node + timeoutChan := make(<-chan time.Time, 1) + if timeout > 0 { + timeoutChan = time.After(timeout) + } + select { + case resp = <-respChan: + case <-ctx.Done(): + return nil, ctx.Err() + case <-timeoutChan: + // FIXME this error isn't technically correct (but works for now - the timeout param is only used from sendIQ) + return nil, ErrIQTimedOut + } + if isDisconnectNode(resp) { + cli.Log.Debugf("Retrying %s %s was interrupted by websocket disconnection (%v), not retrying anymore", reqType, id, resp.XMLString()) + return nil, &DisconnectedError{Action: fmt.Sprintf("%s (retry)", reqType), Node: resp} + } + return resp, nil +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/retry.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/retry.go new file mode 100644 index 0000000..95104c8 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/retry.go @@ -0,0 +1,284 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package whatsmeow + +import ( + "context" + "encoding/binary" + "fmt" + "time" + + "go.mau.fi/libsignal/ecc" + "go.mau.fi/libsignal/groups" + "go.mau.fi/libsignal/keys/prekey" + "go.mau.fi/libsignal/protocol" + "google.golang.org/protobuf/proto" + + waBinary "go.mau.fi/whatsmeow/binary" + waProto "go.mau.fi/whatsmeow/binary/proto" + "go.mau.fi/whatsmeow/types" + "go.mau.fi/whatsmeow/types/events" +) + +// Number of sent messages to cache in memory for handling retry receipts. +const recentMessagesSize = 256 + +type recentMessageKey struct { + To types.JID + ID types.MessageID +} + +// RecentMessage contains the info needed to re-send a message when another device fails to decrypt it. +type RecentMessage struct { + Proto *waProto.Message + Timestamp time.Time +} + +func (cli *Client) addRecentMessage(to types.JID, id types.MessageID, message *waProto.Message) { + cli.recentMessagesLock.Lock() + key := recentMessageKey{to, id} + if cli.recentMessagesList[cli.recentMessagesPtr].ID != "" { + delete(cli.recentMessagesMap, cli.recentMessagesList[cli.recentMessagesPtr]) + } + cli.recentMessagesMap[key] = message + cli.recentMessagesList[cli.recentMessagesPtr] = key + cli.recentMessagesPtr++ + if cli.recentMessagesPtr >= len(cli.recentMessagesList) { + cli.recentMessagesPtr = 0 + } + cli.recentMessagesLock.Unlock() +} + +func (cli *Client) getRecentMessage(to types.JID, id types.MessageID) *waProto.Message { + cli.recentMessagesLock.RLock() + msg, _ := cli.recentMessagesMap[recentMessageKey{to, id}] + cli.recentMessagesLock.RUnlock() + return msg +} + +func (cli *Client) getMessageForRetry(receipt *events.Receipt, messageID types.MessageID) (*waProto.Message, error) { + msg := cli.getRecentMessage(receipt.Chat, messageID) + if msg == nil { + msg = cli.GetMessageForRetry(receipt.Sender, receipt.Chat, messageID) + if msg == nil { + return nil, fmt.Errorf("couldn't find message %s", messageID) + } else { + cli.Log.Debugf("Found message in GetMessageForRetry to accept retry receipt for %s/%s from %s", receipt.Chat, messageID, receipt.Sender) + } + } else { + cli.Log.Debugf("Found message in local cache to accept retry receipt for %s/%s from %s", receipt.Chat, messageID, receipt.Sender) + } + return proto.Clone(msg).(*waProto.Message), nil +} + +const recreateSessionTimeout = 1 * time.Hour + +func (cli *Client) shouldRecreateSession(retryCount int, jid types.JID) (reason string, recreate bool) { + cli.sessionRecreateHistoryLock.Lock() + defer cli.sessionRecreateHistoryLock.Unlock() + if !cli.Store.ContainsSession(jid.SignalAddress()) { + cli.sessionRecreateHistory[jid] = time.Now() + return "we don't have a Signal session with them", true + } else if retryCount < 2 { + return "", false + } + prevTime, ok := cli.sessionRecreateHistory[jid] + if !ok || prevTime.Add(recreateSessionTimeout).Before(time.Now()) { + cli.sessionRecreateHistory[jid] = time.Now() + return "retry count > 1 and over an hour since last recreation", true + } + return "", false +} + +// handleRetryReceipt handles an incoming retry receipt for an outgoing message. +func (cli *Client) handleRetryReceipt(receipt *events.Receipt, node *waBinary.Node) error { + retryChild, ok := node.GetOptionalChildByTag("retry") + if !ok { + return &ElementMissingError{Tag: "retry", In: "retry receipt"} + } + ag := retryChild.AttrGetter() + messageID := ag.String("id") + timestamp := ag.UnixTime("t") + retryCount := ag.Int("count") + if !ag.OK() { + return ag.Error() + } + msg, err := cli.getMessageForRetry(receipt, messageID) + if err != nil { + return err + } + ownID := cli.getOwnID() + if ownID.IsEmpty() { + return ErrNotLoggedIn + } + + if receipt.IsGroup { + builder := groups.NewGroupSessionBuilder(cli.Store, pbSerializer) + senderKeyName := protocol.NewSenderKeyName(receipt.Chat.String(), ownID.SignalAddress()) + signalSKDMessage, err := builder.Create(senderKeyName) + if err != nil { + cli.Log.Warnf("Failed to create sender key distribution message to include in retry of %s in %s to %s: %v", messageID, receipt.Chat, receipt.Sender, err) + } else { + msg.SenderKeyDistributionMessage = &waProto.SenderKeyDistributionMessage{ + GroupId: proto.String(receipt.Chat.String()), + AxolotlSenderKeyDistributionMessage: signalSKDMessage.Serialize(), + } + } + } else if receipt.IsFromMe { + msg = &waProto.Message{ + DeviceSentMessage: &waProto.DeviceSentMessage{ + DestinationJid: proto.String(receipt.Chat.String()), + Message: msg, + }, + } + } + + if cli.PreRetryCallback != nil && !cli.PreRetryCallback(receipt, messageID, retryCount, msg) { + cli.Log.Debugf("Cancelled retry receipt in PreRetryCallback") + return nil + } + + plaintext, err := proto.Marshal(msg) + if err != nil { + return fmt.Errorf("failed to marshal message: %w", err) + } + _, hasKeys := node.GetOptionalChildByTag("keys") + var bundle *prekey.Bundle + if hasKeys { + bundle, err = nodeToPreKeyBundle(uint32(receipt.Sender.Device), *node) + if err != nil { + return fmt.Errorf("failed to read prekey bundle in retry receipt: %w", err) + } + } else if reason, recreate := cli.shouldRecreateSession(retryCount, receipt.Sender); recreate { + cli.Log.Debugf("Fetching prekeys for %s for handling retry receipt with no prekey bundle because %s", receipt.Sender, reason) + var keys map[types.JID]preKeyResp + keys, err = cli.fetchPreKeys(context.TODO(), []types.JID{receipt.Sender}) + if err != nil { + return err + } + senderAD := receipt.Sender + senderAD.AD = true + bundle, err = keys[senderAD].bundle, keys[senderAD].err + if err != nil { + return fmt.Errorf("failed to fetch prekeys: %w", err) + } else if bundle == nil { + return fmt.Errorf("didn't get prekey bundle for %s (response size: %d)", senderAD, len(keys)) + } + } + encrypted, includeDeviceIdentity, err := cli.encryptMessageForDevice(plaintext, receipt.Sender, bundle) + if err != nil { + return fmt.Errorf("failed to encrypt message for retry: %w", err) + } + encrypted.Attrs["count"] = retryCount + + attrs := waBinary.Attrs{ + "to": node.Attrs["from"], + "type": getTypeFromMessage(msg), + "id": messageID, + "t": timestamp.Unix(), + } + if !receipt.IsGroup { + attrs["device_fanout"] = false + } + if participant, ok := node.Attrs["participant"]; ok { + attrs["participant"] = participant + } + if recipient, ok := node.Attrs["recipient"]; ok { + attrs["recipient"] = recipient + } + if edit, ok := node.Attrs["edit"]; ok { + attrs["edit"] = edit + } + content := []waBinary.Node{*encrypted} + if includeDeviceIdentity { + content = append(content, cli.makeDeviceIdentityNode()) + } + err = cli.sendNode(waBinary.Node{ + Tag: "message", + Attrs: attrs, + Content: content, + }) + if err != nil { + return fmt.Errorf("failed to send retry message: %w", err) + } + cli.Log.Debugf("Sent retry #%d for %s/%s to %s", retryCount, receipt.Chat, messageID, receipt.Sender) + return nil +} + +// sendRetryReceipt sends a retry receipt for an incoming message. +func (cli *Client) sendRetryReceipt(node *waBinary.Node, forceIncludeIdentity bool) { + id, _ := node.Attrs["id"].(string) + children := node.GetChildren() + var retryCountInMsg int + if len(children) == 1 && children[0].Tag == "enc" { + retryCountInMsg = children[0].AttrGetter().OptionalInt("count") + } + + cli.messageRetriesLock.Lock() + cli.messageRetries[id]++ + retryCount := cli.messageRetries[id] + // In case the message is a retry response, and we restarted in between, find the count from the message + if retryCount == 1 && retryCountInMsg > 0 { + retryCount = retryCountInMsg + 1 + cli.messageRetries[id] = retryCount + } + cli.messageRetriesLock.Unlock() + if retryCount >= 5 { + cli.Log.Warnf("Not sending any more retry receipts for %s", id) + return + } + + var registrationIDBytes [4]byte + binary.BigEndian.PutUint32(registrationIDBytes[:], cli.Store.RegistrationID) + attrs := waBinary.Attrs{ + "id": id, + "type": "retry", + "to": node.Attrs["from"], + } + if recipient, ok := node.Attrs["recipient"]; ok { + attrs["recipient"] = recipient + } + if participant, ok := node.Attrs["participant"]; ok { + attrs["participant"] = participant + } + payload := waBinary.Node{ + Tag: "receipt", + Attrs: attrs, + Content: []waBinary.Node{ + {Tag: "retry", Attrs: waBinary.Attrs{ + "count": retryCount, + "id": id, + "t": node.Attrs["t"], + "v": 1, + }}, + {Tag: "registration", Content: registrationIDBytes[:]}, + }, + } + if retryCount > 1 || forceIncludeIdentity { + if key, err := cli.Store.PreKeys.GenOnePreKey(); err != nil { + cli.Log.Errorf("Failed to get prekey for retry receipt: %v", err) + } else if deviceIdentity, err := proto.Marshal(cli.Store.Account); err != nil { + cli.Log.Errorf("Failed to marshal account info: %v", err) + return + } else { + payload.Content = append(payload.GetChildren(), waBinary.Node{ + Tag: "keys", + Content: []waBinary.Node{ + {Tag: "type", Content: []byte{ecc.DjbType}}, + {Tag: "identity", Content: cli.Store.IdentityKey.Pub[:]}, + preKeyToNode(key), + preKeyToNode(cli.Store.SignedPreKey), + {Tag: "device-identity", Content: deviceIdentity}, + }, + }) + } + } + err := cli.sendNode(payload) + if err != nil { + cli.Log.Errorf("Failed to send retry receipt for %s: %v", id, err) + } +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/send.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/send.go new file mode 100644 index 0000000..96d888b --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/send.go @@ -0,0 +1,724 @@ +// Copyright (c) 2022 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package whatsmeow + +import ( + "context" + "crypto/rand" + "crypto/sha256" + "encoding/base64" + "encoding/hex" + "errors" + "fmt" + "sort" + "strconv" + "strings" + "time" + + "go.mau.fi/libsignal/signalerror" + "google.golang.org/protobuf/proto" + + "go.mau.fi/libsignal/groups" + "go.mau.fi/libsignal/keys/prekey" + "go.mau.fi/libsignal/protocol" + "go.mau.fi/libsignal/session" + + waBinary "go.mau.fi/whatsmeow/binary" + waProto "go.mau.fi/whatsmeow/binary/proto" + "go.mau.fi/whatsmeow/types" +) + +// GenerateMessageID generates a random string that can be used as a message ID on WhatsApp. +// +// msgID := whatsmeow.GenerateMessageID() +// cli.SendMessage(context.Background(), targetJID, &waProto.Message{...}, whatsmeow.SendRequestExtra{ID: msgID}) +func GenerateMessageID() types.MessageID { + id := make([]byte, 8) + _, err := rand.Read(id) + if err != nil { + // Out of entropy + panic(err) + } + return "3EB0" + strings.ToUpper(hex.EncodeToString(id)) +} + +type MessageDebugTimings struct { + Queue time.Duration + + Marshal time.Duration + GetParticipants time.Duration + GetDevices time.Duration + GroupEncrypt time.Duration + PeerEncrypt time.Duration + + Send time.Duration + Resp time.Duration + Retry time.Duration +} + +type SendResponse struct { + // The message timestamp returned by the server + Timestamp time.Time + + // The ID of the sent message + ID types.MessageID + + // Message handling duration, used for debugging + DebugTimings MessageDebugTimings +} + +// SendRequestExtra contains the optional parameters for SendMessage. +// +// By default, optional parameters don't have to be provided at all, e.g. +// +// cli.SendMessage(ctx, to, message) +// +// When providing optional parameters, add a single instance of this struct as the last parameter: +// +// cli.SendMessage(ctx, to, message, whatsmeow.SendRequestExtra{...}) +// +// Trying to add multiple extra parameters will return an error. +type SendRequestExtra struct { + // The message ID to use when sending. If this is not provided, a random message ID will be generated + ID types.MessageID + // Should the message be sent as a peer message (protocol messages to your own devices, e.g. app state key requests) + Peer bool +} + +// SendMessage sends the given message. +// +// This method will wait for the server to acknowledge the message before returning. +// The return value is the timestamp of the message from the server. +// +// Optional parameters like the message ID can be specified with the SendRequestExtra struct. +// Only one extra parameter is allowed, put all necessary parameters in the same struct. +// +// The message itself can contain anything you want (within the protobuf schema). +// e.g. for a simple text message, use the Conversation field: +// +// cli.SendMessage(context.Background(), targetJID, &waProto.Message{ +// Conversation: proto.String("Hello, World!"), +// }) +// +// Things like replies, mentioning users and the "forwarded" flag are stored in ContextInfo, +// which can be put in ExtendedTextMessage and any of the media message types. +// +// For uploading and sending media/attachments, see the Upload method. +// +// For other message types, you'll have to figure it out yourself. Looking at the protobuf schema +// in binary/proto/def.proto may be useful to find out all the allowed fields. Printing the RawMessage +// field in incoming message events to figure out what it contains is also a good way to learn how to +// send the same kind of message. +func (cli *Client) SendMessage(ctx context.Context, to types.JID, message *waProto.Message, extra ...SendRequestExtra) (resp SendResponse, err error) { + var req SendRequestExtra + if len(extra) > 1 { + err = errors.New("only one extra parameter may be provided to SendMessage") + return + } else if len(extra) == 1 { + req = extra[0] + } + if to.AD && !req.Peer { + err = ErrRecipientADJID + return + } + ownID := cli.getOwnID() + if ownID.IsEmpty() { + err = ErrNotLoggedIn + return + } + + if len(req.ID) == 0 { + req.ID = GenerateMessageID() + } + resp.ID = req.ID + + start := time.Now() + // Sending multiple messages at a time can cause weird issues and makes it harder to retry safely + cli.messageSendLock.Lock() + resp.DebugTimings.Queue = time.Since(start) + defer cli.messageSendLock.Unlock() + + respChan := cli.waitResponse(req.ID) + // Peer message retries aren't implemented yet + if !req.Peer { + cli.addRecentMessage(to, req.ID, message) + } + if message.GetMessageContextInfo().GetMessageSecret() != nil { + err = cli.Store.MsgSecrets.PutMessageSecret(to, ownID, req.ID, message.GetMessageContextInfo().GetMessageSecret()) + if err != nil { + cli.Log.Warnf("Failed to store message secret key for outgoing message %s: %v", req.ID, err) + } else { + cli.Log.Debugf("Stored message secret key for outgoing message %s", req.ID) + } + } + var phash string + var data []byte + switch to.Server { + case types.GroupServer, types.BroadcastServer: + phash, data, err = cli.sendGroup(ctx, to, ownID, req.ID, message, &resp.DebugTimings) + case types.DefaultUserServer: + if req.Peer { + data, err = cli.sendPeerMessage(to, req.ID, message, &resp.DebugTimings) + } else { + data, err = cli.sendDM(ctx, to, ownID, req.ID, message, &resp.DebugTimings) + } + default: + err = fmt.Errorf("%w %s", ErrUnknownServer, to.Server) + } + start = time.Now() + if err != nil { + cli.cancelResponse(req.ID, respChan) + return + } + var respNode *waBinary.Node + select { + case respNode = <-respChan: + case <-ctx.Done(): + err = ctx.Err() + return + } + resp.DebugTimings.Resp = time.Since(start) + if isDisconnectNode(respNode) { + start = time.Now() + respNode, err = cli.retryFrame("message send", req.ID, data, respNode, ctx, 0) + resp.DebugTimings.Retry = time.Since(start) + if err != nil { + return + } + } + ag := respNode.AttrGetter() + resp.Timestamp = ag.UnixTime("t") + if errorCode := ag.Int("error"); errorCode != 0 { + err = fmt.Errorf("%w %d", ErrServerReturnedError, errorCode) + } + expectedPHash := ag.OptionalString("phash") + if len(expectedPHash) > 0 && phash != expectedPHash { + cli.Log.Warnf("Server returned different participant list hash when sending to %s. Some devices may not have received the message.", to) + // TODO also invalidate device list caches + cli.groupParticipantsCacheLock.Lock() + delete(cli.groupParticipantsCache, to) + cli.groupParticipantsCacheLock.Unlock() + } + return +} + +// RevokeMessage deletes the given message from everyone in the chat. +// +// This method will wait for the server to acknowledge the revocation message before returning. +// The return value is the timestamp of the message from the server. +// +// Deprecated: This method is deprecated in favor of BuildRevoke +func (cli *Client) RevokeMessage(chat types.JID, id types.MessageID) (SendResponse, error) { + return cli.SendMessage(context.TODO(), chat, cli.BuildRevoke(chat, types.EmptyJID, id)) +} + +// BuildRevoke builds a message revocation message using the given variables. +// The built message can be sent normally using Client.SendMessage. +// +// To revoke your own messages, pass your JID or an empty JID as the second parameter (sender). +// +// resp, err := cli.SendMessage(context.Background(), chat, cli.BuildRevoke(chat, types.EmptyJID, originalMessageID) +// +// To revoke someone else's messages when you are group admin, pass the message sender's JID as the second parameter. +// +// resp, err := cli.SendMessage(context.Background(), chat, cli.BuildRevoke(chat, senderJID, originalMessageID) +func (cli *Client) BuildRevoke(chat, sender types.JID, id types.MessageID) *waProto.Message { + key := &waProto.MessageKey{ + FromMe: proto.Bool(true), + Id: proto.String(id), + RemoteJid: proto.String(chat.String()), + } + if !sender.IsEmpty() && sender.User != cli.getOwnID().User { + key.FromMe = proto.Bool(false) + if chat.Server != types.DefaultUserServer { + key.Participant = proto.String(sender.ToNonAD().String()) + } + } + return &waProto.Message{ + ProtocolMessage: &waProto.ProtocolMessage{ + Type: waProto.ProtocolMessage_REVOKE.Enum(), + Key: key, + }, + } +} + +// BuildEdit builds a message edit message using the given variables. +// The built message can be sent normally using Client.SendMessage. +// +// resp, err := cli.SendMessage(context.Background(), chat, cli.BuildEdit(chat, originalMessageID, &waProto.Message{ +// Conversation: proto.String("edited message"), +// }) +func (cli *Client) BuildEdit(chat types.JID, id types.MessageID, newContent *waProto.Message) *waProto.Message { + return &waProto.Message{ + EditedMessage: &waProto.FutureProofMessage{ + Message: &waProto.Message{ + ProtocolMessage: &waProto.ProtocolMessage{ + Key: &waProto.MessageKey{ + FromMe: proto.Bool(true), + Id: proto.String(id), + RemoteJid: proto.String(chat.String()), + }, + Type: waProto.ProtocolMessage_MESSAGE_EDIT.Enum(), + EditedMessage: newContent, + TimestampMs: proto.Int64(time.Now().UnixMilli()), + }, + }, + }, + } +} + +const ( + DisappearingTimerOff = time.Duration(0) + DisappearingTimer24Hours = 24 * time.Hour + DisappearingTimer7Days = 7 * 24 * time.Hour + DisappearingTimer90Days = 90 * 24 * time.Hour +) + +// ParseDisappearingTimerString parses common human-readable disappearing message timer strings into Duration values. +// If the string doesn't look like one of the allowed values (0, 24h, 7d, 90d), the second return value is false. +func ParseDisappearingTimerString(val string) (time.Duration, bool) { + switch strings.ReplaceAll(strings.ToLower(val), " ", "") { + case "0d", "0h", "0s", "0", "off": + return DisappearingTimerOff, true + case "1day", "day", "1d", "1", "24h", "24", "86400s", "86400": + return DisappearingTimer24Hours, true + case "1week", "week", "7d", "7", "168h", "168", "604800s", "604800": + return DisappearingTimer7Days, true + case "3months", "3m", "3mo", "90d", "90", "2160h", "2160", "7776000s", "7776000": + return DisappearingTimer90Days, true + default: + return 0, false + } +} + +// SetDisappearingTimer sets the disappearing timer in a chat. Both private chats and groups are supported, but they're +// set with different methods. +// +// Note that while this function allows passing non-standard durations, official WhatsApp apps will ignore those, +// and in groups the server will just reject the change. You can use the DisappearingTimer<Duration> constants for convenience. +// +// In groups, the server will echo the change as a notification, so it'll show up as a *events.GroupInfo update. +func (cli *Client) SetDisappearingTimer(chat types.JID, timer time.Duration) (err error) { + switch chat.Server { + case types.DefaultUserServer: + _, err = cli.SendMessage(context.TODO(), chat, &waProto.Message{ + ProtocolMessage: &waProto.ProtocolMessage{ + Type: waProto.ProtocolMessage_EPHEMERAL_SETTING.Enum(), + EphemeralExpiration: proto.Uint32(uint32(timer.Seconds())), + }, + }) + case types.GroupServer: + if timer == 0 { + _, err = cli.sendGroupIQ(context.TODO(), iqSet, chat, waBinary.Node{Tag: "not_ephemeral"}) + } else { + _, err = cli.sendGroupIQ(context.TODO(), iqSet, chat, waBinary.Node{ + Tag: "ephemeral", + Attrs: waBinary.Attrs{ + "expiration": strconv.Itoa(int(timer.Seconds())), + }, + }) + if errors.Is(err, ErrIQBadRequest) { + err = wrapIQError(ErrInvalidDisappearingTimer, err) + } + } + default: + err = fmt.Errorf("can't set disappearing time in a %s chat", chat.Server) + } + return +} + +func participantListHashV2(participants []types.JID) string { + participantsStrings := make([]string, len(participants)) + for i, part := range participants { + participantsStrings[i] = part.String() + } + + sort.Strings(participantsStrings) + hash := sha256.Sum256([]byte(strings.Join(participantsStrings, ""))) + return fmt.Sprintf("2:%s", base64.RawStdEncoding.EncodeToString(hash[:6])) +} + +func (cli *Client) sendGroup(ctx context.Context, to, ownID types.JID, id types.MessageID, message *waProto.Message, timings *MessageDebugTimings) (string, []byte, error) { + var participants []types.JID + var err error + start := time.Now() + if to.Server == types.GroupServer { + participants, err = cli.getGroupMembers(ctx, to) + if err != nil { + return "", nil, fmt.Errorf("failed to get group members: %w", err) + } + } else { + // TODO use context + participants, err = cli.getBroadcastListParticipants(to) + if err != nil { + return "", nil, fmt.Errorf("failed to get broadcast list members: %w", err) + } + } + timings.GetParticipants = time.Since(start) + start = time.Now() + plaintext, _, err := marshalMessage(to, message) + timings.Marshal = time.Since(start) + if err != nil { + return "", nil, err + } + + start = time.Now() + builder := groups.NewGroupSessionBuilder(cli.Store, pbSerializer) + senderKeyName := protocol.NewSenderKeyName(to.String(), ownID.SignalAddress()) + signalSKDMessage, err := builder.Create(senderKeyName) + if err != nil { + return "", nil, fmt.Errorf("failed to create sender key distribution message to send %s to %s: %w", id, to, err) + } + skdMessage := &waProto.Message{ + SenderKeyDistributionMessage: &waProto.SenderKeyDistributionMessage{ + GroupId: proto.String(to.String()), + AxolotlSenderKeyDistributionMessage: signalSKDMessage.Serialize(), + }, + } + skdPlaintext, err := proto.Marshal(skdMessage) + if err != nil { + return "", nil, fmt.Errorf("failed to marshal sender key distribution message to send %s to %s: %w", id, to, err) + } + + cipher := groups.NewGroupCipher(builder, senderKeyName, cli.Store) + encrypted, err := cipher.Encrypt(padMessage(plaintext)) + if err != nil { + return "", nil, fmt.Errorf("failed to encrypt group message to send %s to %s: %w", id, to, err) + } + ciphertext := encrypted.SignedSerialize() + timings.GroupEncrypt = time.Since(start) + + node, allDevices, err := cli.prepareMessageNode(ctx, to, ownID, id, message, participants, skdPlaintext, nil, timings) + if err != nil { + return "", nil, err + } + + phash := participantListHashV2(allDevices) + node.Attrs["phash"] = phash + node.Content = append(node.GetChildren(), waBinary.Node{ + Tag: "enc", + Content: ciphertext, + Attrs: waBinary.Attrs{"v": "2", "type": "skmsg"}, + }) + + start = time.Now() + data, err := cli.sendNodeAndGetData(*node) + timings.Send = time.Since(start) + if err != nil { + return "", nil, fmt.Errorf("failed to send message node: %w", err) + } + return phash, data, nil +} + +func (cli *Client) sendPeerMessage(to types.JID, id types.MessageID, message *waProto.Message, timings *MessageDebugTimings) ([]byte, error) { + node, err := cli.preparePeerMessageNode(to, id, message, timings) + if err != nil { + return nil, err + } + start := time.Now() + data, err := cli.sendNodeAndGetData(*node) + timings.Send = time.Since(start) + if err != nil { + return nil, fmt.Errorf("failed to send message node: %w", err) + } + return data, nil +} + +func (cli *Client) sendDM(ctx context.Context, to, ownID types.JID, id types.MessageID, message *waProto.Message, timings *MessageDebugTimings) ([]byte, error) { + start := time.Now() + messagePlaintext, deviceSentMessagePlaintext, err := marshalMessage(to, message) + timings.Marshal = time.Since(start) + if err != nil { + return nil, err + } + + node, _, err := cli.prepareMessageNode(ctx, to, ownID, id, message, []types.JID{to, ownID.ToNonAD()}, messagePlaintext, deviceSentMessagePlaintext, timings) + if err != nil { + return nil, err + } + start = time.Now() + data, err := cli.sendNodeAndGetData(*node) + timings.Send = time.Since(start) + if err != nil { + return nil, fmt.Errorf("failed to send message node: %w", err) + } + return data, nil +} + +func getTypeFromMessage(msg *waProto.Message) string { + switch { + case msg.ViewOnceMessage != nil: + return getTypeFromMessage(msg.ViewOnceMessage.Message) + case msg.ViewOnceMessageV2 != nil: + return getTypeFromMessage(msg.ViewOnceMessageV2.Message) + case msg.EphemeralMessage != nil: + return getTypeFromMessage(msg.EphemeralMessage.Message) + case msg.DocumentWithCaptionMessage != nil: + return getTypeFromMessage(msg.DocumentWithCaptionMessage.Message) + case msg.ReactionMessage != nil: + return "reaction" + case msg.PollCreationMessage != nil, msg.PollUpdateMessage != nil: + return "poll" + case msg.Conversation != nil, msg.ExtendedTextMessage != nil, msg.ProtocolMessage != nil: + return "text" + //TODO this requires setting mediatype in the enc nodes + //case msg.ImageMessage != nil, msg.DocumentMessage != nil, msg.AudioMessage != nil, msg.VideoMessage != nil: + // return "media" + default: + return "text" + } +} + +const ( + EditAttributeEmpty = "" + EditAttributeMessageEdit = "1" + EditAttributeSenderRevoke = "7" + EditAttributeAdminRevoke = "8" +) + +const RemoveReactionText = "" + +func getEditAttribute(msg *waProto.Message) string { + switch { + case msg.ProtocolMessage != nil && msg.ProtocolMessage.GetKey() != nil: + switch msg.ProtocolMessage.GetType() { + case waProto.ProtocolMessage_REVOKE: + if msg.ProtocolMessage.GetKey().GetFromMe() { + return EditAttributeSenderRevoke + } else { + return EditAttributeAdminRevoke + } + case waProto.ProtocolMessage_MESSAGE_EDIT: + if msg.EditedMessage != nil { + return EditAttributeMessageEdit + } + } + case msg.ReactionMessage != nil && msg.ReactionMessage.GetText() == RemoveReactionText: + return EditAttributeSenderRevoke + case msg.KeepInChatMessage != nil && msg.KeepInChatMessage.GetKey().GetFromMe() && msg.KeepInChatMessage.GetKeepType() == waProto.KeepType_UNDO_KEEP_FOR_ALL: + return EditAttributeSenderRevoke + } + return EditAttributeEmpty +} + +func (cli *Client) preparePeerMessageNode(to types.JID, id types.MessageID, message *waProto.Message, timings *MessageDebugTimings) (*waBinary.Node, error) { + attrs := waBinary.Attrs{ + "id": id, + "type": "text", + "category": "peer", + "to": to, + } + if message.GetProtocolMessage().GetType() == waProto.ProtocolMessage_APP_STATE_SYNC_KEY_REQUEST { + attrs["push_priority"] = "high" + } + start := time.Now() + plaintext, err := proto.Marshal(message) + timings.Marshal = time.Since(start) + if err != nil { + err = fmt.Errorf("failed to marshal message: %w", err) + return nil, err + } + start = time.Now() + encrypted, isPreKey, err := cli.encryptMessageForDevice(plaintext, to, nil) + timings.PeerEncrypt = time.Since(start) + if err != nil { + return nil, fmt.Errorf("failed to encrypt peer message for %s: %v", to, err) + } + content := []waBinary.Node{*encrypted} + if isPreKey { + content = append(content, cli.makeDeviceIdentityNode()) + } + return &waBinary.Node{ + Tag: "message", + Attrs: attrs, + Content: content, + }, nil +} + +func (cli *Client) prepareMessageNode(ctx context.Context, to, ownID types.JID, id types.MessageID, message *waProto.Message, participants []types.JID, plaintext, dsmPlaintext []byte, timings *MessageDebugTimings) (*waBinary.Node, []types.JID, error) { + start := time.Now() + allDevices, err := cli.GetUserDevicesContext(ctx, participants) + timings.GetDevices = time.Since(start) + if err != nil { + return nil, nil, fmt.Errorf("failed to get device list: %w", err) + } + + attrs := waBinary.Attrs{ + "id": id, + "type": getTypeFromMessage(message), + "to": to, + } + if editAttr := getEditAttribute(message); editAttr != "" { + attrs["edit"] = editAttr + } + + start = time.Now() + participantNodes, includeIdentity := cli.encryptMessageForDevices(ctx, allDevices, ownID, id, plaintext, dsmPlaintext) + timings.PeerEncrypt = time.Since(start) + content := []waBinary.Node{{ + Tag: "participants", + Content: participantNodes, + }} + if includeIdentity { + content = append(content, cli.makeDeviceIdentityNode()) + } + if attrs["type"] == "poll" { + pollType := "creation" + if message.PollUpdateMessage != nil { + pollType = "vote" + } + content = append(content, waBinary.Node{ + Tag: "meta", + Attrs: waBinary.Attrs{ + "polltype": pollType, + }, + }) + } + return &waBinary.Node{ + Tag: "message", + Attrs: attrs, + Content: content, + }, allDevices, nil +} + +func marshalMessage(to types.JID, message *waProto.Message) (plaintext, dsmPlaintext []byte, err error) { + plaintext, err = proto.Marshal(message) + if err != nil { + err = fmt.Errorf("failed to marshal message: %w", err) + return + } + + if to.Server != types.GroupServer { + dsmPlaintext, err = proto.Marshal(&waProto.Message{ + DeviceSentMessage: &waProto.DeviceSentMessage{ + DestinationJid: proto.String(to.String()), + Message: message, + }, + }) + if err != nil { + err = fmt.Errorf("failed to marshal message (for own devices): %w", err) + return + } + } + + return +} + +func (cli *Client) makeDeviceIdentityNode() waBinary.Node { + deviceIdentity, err := proto.Marshal(cli.Store.Account) + if err != nil { + panic(fmt.Errorf("failed to marshal device identity: %w", err)) + } + return waBinary.Node{ + Tag: "device-identity", + Content: deviceIdentity, + } +} + +func (cli *Client) encryptMessageForDevices(ctx context.Context, allDevices []types.JID, ownID types.JID, id string, msgPlaintext, dsmPlaintext []byte) ([]waBinary.Node, bool) { + includeIdentity := false + participantNodes := make([]waBinary.Node, 0, len(allDevices)) + var retryDevices []types.JID + for _, jid := range allDevices { + plaintext := msgPlaintext + if jid.User == ownID.User && dsmPlaintext != nil { + if jid == ownID { + continue + } + plaintext = dsmPlaintext + } + encrypted, isPreKey, err := cli.encryptMessageForDeviceAndWrap(plaintext, jid, nil) + if errors.Is(err, ErrNoSession) { + retryDevices = append(retryDevices, jid) + continue + } else if err != nil { + cli.Log.Warnf("Failed to encrypt %s for %s: %v", id, jid, err) + continue + } + participantNodes = append(participantNodes, *encrypted) + if isPreKey { + includeIdentity = true + } + } + if len(retryDevices) > 0 { + bundles, err := cli.fetchPreKeys(ctx, retryDevices) + if err != nil { + cli.Log.Warnf("Failed to fetch prekeys for %v to retry encryption: %v", retryDevices, err) + } else { + for _, jid := range retryDevices { + resp := bundles[jid] + if resp.err != nil { + cli.Log.Warnf("Failed to fetch prekey for %s: %v", jid, resp.err) + continue + } + plaintext := msgPlaintext + if jid.User == ownID.User && dsmPlaintext != nil { + plaintext = dsmPlaintext + } + encrypted, isPreKey, err := cli.encryptMessageForDeviceAndWrap(plaintext, jid, resp.bundle) + if err != nil { + cli.Log.Warnf("Failed to encrypt %s for %s (retry): %v", id, jid, err) + continue + } + participantNodes = append(participantNodes, *encrypted) + if isPreKey { + includeIdentity = true + } + } + } + } + return participantNodes, includeIdentity +} + +func (cli *Client) encryptMessageForDeviceAndWrap(plaintext []byte, to types.JID, bundle *prekey.Bundle) (*waBinary.Node, bool, error) { + node, includeDeviceIdentity, err := cli.encryptMessageForDevice(plaintext, to, bundle) + if err != nil { + return nil, false, err + } + return &waBinary.Node{ + Tag: "to", + Attrs: waBinary.Attrs{"jid": to}, + Content: []waBinary.Node{*node}, + }, includeDeviceIdentity, nil +} + +func (cli *Client) encryptMessageForDevice(plaintext []byte, to types.JID, bundle *prekey.Bundle) (*waBinary.Node, bool, error) { + builder := session.NewBuilderFromSignal(cli.Store, to.SignalAddress(), pbSerializer) + if bundle != nil { + cli.Log.Debugf("Processing prekey bundle for %s", to) + err := builder.ProcessBundle(bundle) + if cli.AutoTrustIdentity && errors.Is(err, signalerror.ErrUntrustedIdentity) { + cli.Log.Warnf("Got %v error while trying to process prekey bundle for %s, clearing stored identity and retrying", err, to) + cli.clearUntrustedIdentity(to) + err = builder.ProcessBundle(bundle) + } + if err != nil { + return nil, false, fmt.Errorf("failed to process prekey bundle: %w", err) + } + } else if !cli.Store.ContainsSession(to.SignalAddress()) { + return nil, false, ErrNoSession + } + cipher := session.NewCipher(builder, to.SignalAddress()) + ciphertext, err := cipher.Encrypt(padMessage(plaintext)) + if err != nil { + return nil, false, fmt.Errorf("cipher encryption failed: %w", err) + } + + encType := "msg" + if ciphertext.Type() == protocol.PREKEY_TYPE { + encType = "pkmsg" + } + + return &waBinary.Node{ + Tag: "enc", + Attrs: waBinary.Attrs{ + "v": "2", + "type": encType, + }, + Content: ciphertext.Serialize(), + }, encType == "pkmsg", nil +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/socket/constants.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/socket/constants.go new file mode 100644 index 0000000..8b8b690 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/socket/constants.go @@ -0,0 +1,43 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +// Package socket implements a subset of the Noise protocol framework on top of websockets as used by WhatsApp. +// +// There shouldn't be any need to manually interact with this package. +// The Client struct in the top-level whatsmeow package handles everything. +package socket + +import ( + "errors" + + "go.mau.fi/whatsmeow/binary/token" +) + +const ( + // Origin is the Origin header for all WhatsApp websocket connections + Origin = "https://web.whatsapp.com" + // URL is the websocket URL for the new multidevice protocol + URL = "wss://web.whatsapp.com/ws/chat" +) + +const ( + NoiseStartPattern = "Noise_XX_25519_AESGCM_SHA256\x00\x00\x00\x00" + + WAMagicValue = 5 +) + +var WAConnHeader = []byte{'W', 'A', WAMagicValue, token.DictVersion} + +const ( + FrameMaxSize = 2 << 23 + FrameLengthSize = 3 +) + +var ( + ErrFrameTooLarge = errors.New("frame too large") + ErrSocketClosed = errors.New("frame socket is closed") + ErrSocketAlreadyOpen = errors.New("frame socket is already open") +) diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/socket/framesocket.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/socket/framesocket.go new file mode 100644 index 0000000..2d7e4ad --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/socket/framesocket.go @@ -0,0 +1,236 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package socket + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "sync" + "time" + + "github.com/gorilla/websocket" + + waLog "go.mau.fi/whatsmeow/util/log" +) + +type Proxy = func(*http.Request) (*url.URL, error) + +type FrameSocket struct { + conn *websocket.Conn + ctx context.Context + cancel func() + log waLog.Logger + lock sync.Mutex + + Frames chan []byte + OnDisconnect func(remote bool) + WriteTimeout time.Duration + + Header []byte + Proxy Proxy + + incomingLength int + receivedLength int + incoming []byte + partialHeader []byte +} + +func NewFrameSocket(log waLog.Logger, header []byte, proxy Proxy) *FrameSocket { + return &FrameSocket{ + conn: nil, + log: log, + Header: header, + Frames: make(chan []byte), + + Proxy: proxy, + } +} + +func (fs *FrameSocket) IsConnected() bool { + return fs.conn != nil +} + +func (fs *FrameSocket) Context() context.Context { + return fs.ctx +} + +func (fs *FrameSocket) Close(code int) { + fs.lock.Lock() + defer fs.lock.Unlock() + + if fs.conn == nil { + return + } + + if code > 0 { + message := websocket.FormatCloseMessage(code, "") + err := fs.conn.WriteControl(websocket.CloseMessage, message, time.Now().Add(time.Second)) + if err != nil { + fs.log.Warnf("Error sending close message: %v", err) + } + } + + fs.cancel() + err := fs.conn.Close() + if err != nil { + fs.log.Errorf("Error closing websocket: %v", err) + } + fs.conn = nil + fs.ctx = nil + fs.cancel = nil + if fs.OnDisconnect != nil { + go fs.OnDisconnect(code == 0) + } +} + +func (fs *FrameSocket) Connect() error { + fs.lock.Lock() + defer fs.lock.Unlock() + + if fs.conn != nil { + return ErrSocketAlreadyOpen + } + ctx, cancel := context.WithCancel(context.Background()) + dialer := websocket.Dialer{ + Proxy: fs.Proxy, + } + + headers := http.Header{"Origin": []string{Origin}} + fs.log.Debugf("Dialing %s", URL) + conn, _, err := dialer.Dial(URL, headers) + if err != nil { + cancel() + return fmt.Errorf("couldn't dial whatsapp web websocket: %w", err) + } + + fs.ctx, fs.cancel = ctx, cancel + fs.conn = conn + conn.SetCloseHandler(func(code int, text string) error { + fs.log.Debugf("Server closed websocket with status %d/%s", code, text) + cancel() + // from default CloseHandler + message := websocket.FormatCloseMessage(code, "") + _ = conn.WriteControl(websocket.CloseMessage, message, time.Now().Add(time.Second)) + return nil + }) + + go fs.readPump(conn, ctx) + return nil +} + +func (fs *FrameSocket) SendFrame(data []byte) error { + conn := fs.conn + if conn == nil { + return ErrSocketClosed + } + dataLength := len(data) + if dataLength >= FrameMaxSize { + return fmt.Errorf("%w (got %d bytes, max %d bytes)", ErrFrameTooLarge, len(data), FrameMaxSize) + } + + headerLength := len(fs.Header) + // Whole frame is header + 3 bytes for length + data + wholeFrame := make([]byte, headerLength+FrameLengthSize+dataLength) + + // Copy the header if it's there + if fs.Header != nil { + copy(wholeFrame[:headerLength], fs.Header) + // We only want to send the header once + fs.Header = nil + } + + // Encode length of frame + wholeFrame[headerLength] = byte(dataLength >> 16) + wholeFrame[headerLength+1] = byte(dataLength >> 8) + wholeFrame[headerLength+2] = byte(dataLength) + + // Copy actual frame data + copy(wholeFrame[headerLength+FrameLengthSize:], data) + + if fs.WriteTimeout > 0 { + err := conn.SetWriteDeadline(time.Now().Add(fs.WriteTimeout)) + if err != nil { + fs.log.Warnf("Failed to set write deadline: %v", err) + } + } + return conn.WriteMessage(websocket.BinaryMessage, wholeFrame) +} + +func (fs *FrameSocket) frameComplete() { + data := fs.incoming + fs.incoming = nil + fs.partialHeader = nil + fs.incomingLength = 0 + fs.receivedLength = 0 + fs.Frames <- data +} + +func (fs *FrameSocket) processData(msg []byte) { + for len(msg) > 0 { + // This probably doesn't happen a lot (if at all), so the code is unoptimized + if fs.partialHeader != nil { + msg = append(fs.partialHeader, msg...) + fs.partialHeader = nil + } + if fs.incoming == nil { + if len(msg) >= FrameLengthSize { + length := (int(msg[0]) << 16) + (int(msg[1]) << 8) + int(msg[2]) + fs.incomingLength = length + fs.receivedLength = len(msg) + msg = msg[FrameLengthSize:] + if len(msg) >= length { + fs.incoming = msg[:length] + msg = msg[length:] + fs.frameComplete() + } else { + fs.incoming = make([]byte, length) + copy(fs.incoming, msg) + msg = nil + } + } else { + fs.log.Warnf("Received partial header (report if this happens often)") + fs.partialHeader = msg + msg = nil + } + } else { + if len(fs.incoming)+len(msg) >= fs.incomingLength { + copy(fs.incoming[fs.receivedLength:], msg[:fs.incomingLength-fs.receivedLength]) + msg = msg[fs.incomingLength-fs.receivedLength:] + fs.frameComplete() + } else { + copy(fs.incoming[fs.receivedLength:], msg) + fs.receivedLength += len(msg) + msg = nil + } + } + } +} + +func (fs *FrameSocket) readPump(conn *websocket.Conn, ctx context.Context) { + fs.log.Debugf("Frame websocket read pump starting %p", fs) + defer func() { + fs.log.Debugf("Frame websocket read pump exiting %p", fs) + go fs.Close(0) + }() + for { + msgType, data, err := conn.ReadMessage() + if err != nil { + // Ignore the error if the context has been closed + if !errors.Is(ctx.Err(), context.Canceled) { + fs.log.Errorf("Error reading from websocket: %v", err) + } + return + } else if msgType != websocket.BinaryMessage { + fs.log.Warnf("Got unexpected websocket message type %d", msgType) + continue + } + fs.processData(data) + } +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/socket/noisehandshake.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/socket/noisehandshake.go new file mode 100644 index 0000000..3add470 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/socket/noisehandshake.go @@ -0,0 +1,124 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package socket + +import ( + "crypto/cipher" + "crypto/sha256" + "fmt" + "io" + "sync/atomic" + + "golang.org/x/crypto/curve25519" + "golang.org/x/crypto/hkdf" + + "go.mau.fi/whatsmeow/util/gcmutil" +) + +type NoiseHandshake struct { + hash []byte + salt []byte + key cipher.AEAD + counter uint32 +} + +func NewNoiseHandshake() *NoiseHandshake { + return &NoiseHandshake{} +} + +func sha256Slice(data []byte) []byte { + hash := sha256.Sum256(data) + return hash[:] +} + +func (nh *NoiseHandshake) Start(pattern string, header []byte) { + data := []byte(pattern) + if len(data) == 32 { + nh.hash = data + } else { + nh.hash = sha256Slice(data) + } + nh.salt = nh.hash + var err error + nh.key, err = gcmutil.Prepare(nh.hash) + if err != nil { + panic(err) + } + nh.Authenticate(header) +} + +func (nh *NoiseHandshake) Authenticate(data []byte) { + nh.hash = sha256Slice(append(nh.hash, data...)) +} + +func (nh *NoiseHandshake) postIncrementCounter() uint32 { + count := atomic.AddUint32(&nh.counter, 1) + return count - 1 +} + +func (nh *NoiseHandshake) Encrypt(plaintext []byte) []byte { + ciphertext := nh.key.Seal(nil, generateIV(nh.postIncrementCounter()), plaintext, nh.hash) + nh.Authenticate(ciphertext) + return ciphertext +} + +func (nh *NoiseHandshake) Decrypt(ciphertext []byte) (plaintext []byte, err error) { + plaintext, err = nh.key.Open(nil, generateIV(nh.postIncrementCounter()), ciphertext, nh.hash) + if err == nil { + nh.Authenticate(ciphertext) + } + return +} + +func (nh *NoiseHandshake) Finish(fs *FrameSocket, frameHandler FrameHandler, disconnectHandler DisconnectHandler) (*NoiseSocket, error) { + if write, read, err := nh.extractAndExpand(nh.salt, nil); err != nil { + return nil, fmt.Errorf("failed to extract final keys: %w", err) + } else if writeKey, err := gcmutil.Prepare(write); err != nil { + return nil, fmt.Errorf("failed to create final write cipher: %w", err) + } else if readKey, err := gcmutil.Prepare(read); err != nil { + return nil, fmt.Errorf("failed to create final read cipher: %w", err) + } else if ns, err := newNoiseSocket(fs, writeKey, readKey, frameHandler, disconnectHandler); err != nil { + return nil, fmt.Errorf("failed to create noise socket: %w", err) + } else { + return ns, nil + } +} + +func (nh *NoiseHandshake) MixSharedSecretIntoKey(priv, pub [32]byte) error { + secret, err := curve25519.X25519(priv[:], pub[:]) + if err != nil { + return fmt.Errorf("failed to do x25519 scalar multiplication: %w", err) + } + return nh.MixIntoKey(secret) +} + +func (nh *NoiseHandshake) MixIntoKey(data []byte) error { + nh.counter = 0 + write, read, err := nh.extractAndExpand(nh.salt, data) + if err != nil { + return fmt.Errorf("failed to extract keys for mixing: %w", err) + } + nh.salt = write + nh.key, err = gcmutil.Prepare(read) + if err != nil { + return fmt.Errorf("failed to create new cipher while mixing keys: %w", err) + } + return nil +} + +func (nh *NoiseHandshake) extractAndExpand(salt, data []byte) (write []byte, read []byte, err error) { + h := hkdf.New(sha256.New, data, salt, nil) + write = make([]byte, 32) + read = make([]byte, 32) + + if _, err = io.ReadFull(h, write); err != nil { + err = fmt.Errorf("failed to read write key: %w", err) + } else if _, err = io.ReadFull(h, read); err != nil { + err = fmt.Errorf("failed to read read key: %w", err) + } + return +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/socket/noisesocket.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/socket/noisesocket.go new file mode 100644 index 0000000..85973d7 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/socket/noisesocket.go @@ -0,0 +1,108 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package socket + +import ( + "context" + "crypto/cipher" + "encoding/binary" + "sync" + "sync/atomic" + + "github.com/gorilla/websocket" +) + +type NoiseSocket struct { + fs *FrameSocket + onFrame FrameHandler + writeKey cipher.AEAD + readKey cipher.AEAD + writeCounter uint32 + readCounter uint32 + writeLock sync.Mutex + destroyed uint32 + stopConsumer chan struct{} +} + +type DisconnectHandler func(socket *NoiseSocket, remote bool) +type FrameHandler func([]byte) + +func newNoiseSocket(fs *FrameSocket, writeKey, readKey cipher.AEAD, frameHandler FrameHandler, disconnectHandler DisconnectHandler) (*NoiseSocket, error) { + ns := &NoiseSocket{ + fs: fs, + writeKey: writeKey, + readKey: readKey, + onFrame: frameHandler, + stopConsumer: make(chan struct{}), + } + fs.OnDisconnect = func(remote bool) { + disconnectHandler(ns, remote) + } + go ns.consumeFrames(fs.ctx, fs.Frames) + return ns, nil +} + +func (ns *NoiseSocket) consumeFrames(ctx context.Context, frames <-chan []byte) { + if ctx == nil { + // ctx being nil implies the connection already closed somehow + return + } + ctxDone := ctx.Done() + for { + select { + case frame := <-frames: + ns.receiveEncryptedFrame(frame) + case <-ctxDone: + return + case <-ns.stopConsumer: + return + } + } +} + +func generateIV(count uint32) []byte { + iv := make([]byte, 12) + binary.BigEndian.PutUint32(iv[8:], count) + return iv +} + +func (ns *NoiseSocket) Context() context.Context { + return ns.fs.Context() +} + +func (ns *NoiseSocket) Stop(disconnect bool) { + if atomic.CompareAndSwapUint32(&ns.destroyed, 0, 1) { + close(ns.stopConsumer) + ns.fs.OnDisconnect = nil + if disconnect { + ns.fs.Close(websocket.CloseNormalClosure) + } + } +} + +func (ns *NoiseSocket) SendFrame(plaintext []byte) error { + ns.writeLock.Lock() + ciphertext := ns.writeKey.Seal(nil, generateIV(ns.writeCounter), plaintext, nil) + ns.writeCounter++ + err := ns.fs.SendFrame(ciphertext) + ns.writeLock.Unlock() + return err +} + +func (ns *NoiseSocket) receiveEncryptedFrame(ciphertext []byte) { + count := atomic.AddUint32(&ns.readCounter, 1) - 1 + plaintext, err := ns.readKey.Open(nil, generateIV(count), ciphertext, nil) + if err != nil { + ns.fs.log.Warnf("Failed to decrypt frame: %v", err) + return + } + ns.onFrame(plaintext) +} + +func (ns *NoiseSocket) IsConnected() bool { + return ns.fs.IsConnected() +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/store/clientpayload.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/store/clientpayload.go new file mode 100644 index 0000000..08a3d28 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/store/clientpayload.go @@ -0,0 +1,180 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package store + +import ( + "crypto/md5" + "encoding/binary" + "fmt" + "strconv" + "strings" + + "google.golang.org/protobuf/proto" + + "go.mau.fi/libsignal/ecc" + + waProto "go.mau.fi/whatsmeow/binary/proto" +) + +// WAVersionContainer is a container for a WhatsApp web version number. +type WAVersionContainer [3]uint32 + +// ParseVersion parses a version string (three dot-separated numbers) into a WAVersionContainer. +func ParseVersion(version string) (parsed WAVersionContainer, err error) { + var part1, part2, part3 int + if parts := strings.Split(version, "."); len(parts) != 3 { + err = fmt.Errorf("'%s' doesn't contain three dot-separated parts", version) + } else if part1, err = strconv.Atoi(parts[0]); err != nil { + err = fmt.Errorf("first part of '%s' is not a number: %w", version, err) + } else if part2, err = strconv.Atoi(parts[1]); err != nil { + err = fmt.Errorf("second part of '%s' is not a number: %w", version, err) + } else if part3, err = strconv.Atoi(parts[2]); err != nil { + err = fmt.Errorf("third part of '%s' is not a number: %w", version, err) + } else { + parsed = WAVersionContainer{uint32(part1), uint32(part2), uint32(part3)} + } + return +} + +func (vc WAVersionContainer) LessThan(other WAVersionContainer) bool { + return vc[0] < other[0] || + (vc[0] == other[0] && vc[1] < other[1]) || + (vc[0] == other[0] && vc[1] == other[1] && vc[2] < other[2]) +} + +// IsZero returns true if the version is zero. +func (vc WAVersionContainer) IsZero() bool { + return vc == [3]uint32{0, 0, 0} +} + +// String returns the version number as a dot-separated string. +func (vc WAVersionContainer) String() string { + parts := make([]string, len(vc)) + for i, part := range vc { + parts[i] = strconv.Itoa(int(part)) + } + return strings.Join(parts, ".") +} + +// Hash returns the md5 hash of the String representation of this version. +func (vc WAVersionContainer) Hash() [16]byte { + return md5.Sum([]byte(vc.String())) +} + +func (vc WAVersionContainer) ProtoAppVersion() *waProto.ClientPayload_UserAgent_AppVersion { + return &waProto.ClientPayload_UserAgent_AppVersion{ + Primary: &vc[0], + Secondary: &vc[1], + Tertiary: &vc[2], + } +} + +// waVersion is the WhatsApp web client version +var waVersion = WAVersionContainer{2, 2301, 6} + +// waVersionHash is the md5 hash of a dot-separated waVersion +var waVersionHash [16]byte + +func init() { + waVersionHash = waVersion.Hash() +} + +// GetWAVersion gets the current WhatsApp web client version. +func GetWAVersion() WAVersionContainer { + return waVersion +} + +// SetWAVersion sets the current WhatsApp web client version. +// +// In general, you should keep the library up-to-date instead of using this, +// as there may be code changes that are necessary too (like protobuf schema changes). +func SetWAVersion(version WAVersionContainer) { + if version.IsZero() { + return + } + waVersion = version + waVersionHash = version.Hash() +} + +var BaseClientPayload = &waProto.ClientPayload{ + UserAgent: &waProto.ClientPayload_UserAgent{ + Platform: waProto.ClientPayload_UserAgent_WEB.Enum(), + ReleaseChannel: waProto.ClientPayload_UserAgent_RELEASE.Enum(), + AppVersion: waVersion.ProtoAppVersion(), + Mcc: proto.String("000"), + Mnc: proto.String("000"), + OsVersion: proto.String("0.1.0"), + Manufacturer: proto.String(""), + Device: proto.String("Desktop"), + OsBuildNumber: proto.String("0.1.0"), + + LocaleLanguageIso6391: proto.String("en"), + LocaleCountryIso31661Alpha2: proto.String("en"), + }, + WebInfo: &waProto.ClientPayload_WebInfo{ + WebSubPlatform: waProto.ClientPayload_WebInfo_WEB_BROWSER.Enum(), + }, + ConnectType: waProto.ClientPayload_WIFI_UNKNOWN.Enum(), + ConnectReason: waProto.ClientPayload_USER_ACTIVATED.Enum(), +} + +var DeviceProps = &waProto.DeviceProps{ + Os: proto.String("whatsmeow"), + Version: &waProto.DeviceProps_AppVersion{ + Primary: proto.Uint32(0), + Secondary: proto.Uint32(1), + Tertiary: proto.Uint32(0), + }, + PlatformType: waProto.DeviceProps_UNKNOWN.Enum(), + RequireFullSync: proto.Bool(false), +} + +func SetOSInfo(name string, version [3]uint32) { + DeviceProps.Os = &name + DeviceProps.Version.Primary = &version[0] + DeviceProps.Version.Secondary = &version[1] + DeviceProps.Version.Tertiary = &version[2] + BaseClientPayload.UserAgent.OsVersion = proto.String(fmt.Sprintf("%d.%d.%d", version[0], version[1], version[2])) + BaseClientPayload.UserAgent.OsBuildNumber = BaseClientPayload.UserAgent.OsVersion +} + +func (device *Device) getRegistrationPayload() *waProto.ClientPayload { + payload := proto.Clone(BaseClientPayload).(*waProto.ClientPayload) + regID := make([]byte, 4) + binary.BigEndian.PutUint32(regID, device.RegistrationID) + preKeyID := make([]byte, 4) + binary.BigEndian.PutUint32(preKeyID, device.SignedPreKey.KeyID) + deviceProps, _ := proto.Marshal(DeviceProps) + payload.DevicePairingData = &waProto.ClientPayload_DevicePairingRegistrationData{ + ERegid: regID, + EKeytype: []byte{ecc.DjbType}, + EIdent: device.IdentityKey.Pub[:], + ESkeyId: preKeyID[1:], + ESkeyVal: device.SignedPreKey.Pub[:], + ESkeySig: device.SignedPreKey.Signature[:], + BuildHash: waVersionHash[:], + DeviceProps: deviceProps, + } + payload.Passive = proto.Bool(false) + return payload +} + +func (device *Device) getLoginPayload() *waProto.ClientPayload { + payload := proto.Clone(BaseClientPayload).(*waProto.ClientPayload) + payload.Username = proto.Uint64(device.ID.UserInt()) + payload.Device = proto.Uint32(uint32(device.ID.Device)) + payload.Passive = proto.Bool(true) + return payload +} + +func (device *Device) GetClientPayload() *waProto.ClientPayload { + if device.ID != nil { + return device.getLoginPayload() + } else { + return device.getRegistrationPayload() + } +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/store/signal.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/store/signal.go new file mode 100644 index 0000000..4c06ed4 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/store/signal.go @@ -0,0 +1,192 @@ +// Copyright (c) 2022 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package store + +import ( + "go.mau.fi/libsignal/ecc" + groupRecord "go.mau.fi/libsignal/groups/state/record" + "go.mau.fi/libsignal/keys/identity" + "go.mau.fi/libsignal/protocol" + "go.mau.fi/libsignal/serialize" + "go.mau.fi/libsignal/state/record" + "go.mau.fi/libsignal/state/store" + + "go.mau.fi/whatsmeow/util/keys" +) + +var SignalProtobufSerializer = serialize.NewProtoBufSerializer() + +var _ store.SignalProtocol = (*Device)(nil) + +func (device *Device) GetIdentityKeyPair() *identity.KeyPair { + return identity.NewKeyPair( + identity.NewKey(ecc.NewDjbECPublicKey(*device.IdentityKey.Pub)), + ecc.NewDjbECPrivateKey(*device.IdentityKey.Priv), + ) +} + +func (device *Device) GetLocalRegistrationId() uint32 { + return device.RegistrationID +} + +func (device *Device) SaveIdentity(address *protocol.SignalAddress, identityKey *identity.Key) { + for i := 0; ; i++ { + err := device.Identities.PutIdentity(address.String(), identityKey.PublicKey().PublicKey()) + if err == nil || !device.handleDatabaseError(i, err, "save identity of %s", address.String()) { + break + } + } +} + +func (device *Device) IsTrustedIdentity(address *protocol.SignalAddress, identityKey *identity.Key) bool { + for i := 0; ; i++ { + isTrusted, err := device.Identities.IsTrustedIdentity(address.String(), identityKey.PublicKey().PublicKey()) + if err == nil || !device.handleDatabaseError(i, err, "check if %s's identity is trusted", address.String()) { + return isTrusted + } + } +} + +func (device *Device) LoadPreKey(id uint32) *record.PreKey { + var preKey *keys.PreKey + for i := 0; ; i++ { + var err error + preKey, err = device.PreKeys.GetPreKey(id) + if err == nil || !device.handleDatabaseError(i, err, "load prekey %d", id) { + break + } + } + if preKey == nil { + return nil + } + return record.NewPreKey(preKey.KeyID, ecc.NewECKeyPair( + ecc.NewDjbECPublicKey(*preKey.Pub), + ecc.NewDjbECPrivateKey(*preKey.Priv), + ), nil) +} + +func (device *Device) RemovePreKey(id uint32) { + for i := 0; ; i++ { + err := device.PreKeys.RemovePreKey(id) + if err == nil || !device.handleDatabaseError(i, err, "remove prekey %d", id) { + break + } + } +} + +func (device *Device) StorePreKey(preKeyID uint32, preKeyRecord *record.PreKey) { + panic("not implemented") +} + +func (device *Device) ContainsPreKey(preKeyID uint32) bool { + panic("not implemented") +} + +func (device *Device) LoadSession(address *protocol.SignalAddress) *record.Session { + var rawSess []byte + for i := 0; ; i++ { + var err error + rawSess, err = device.Sessions.GetSession(address.String()) + if err == nil || !device.handleDatabaseError(i, err, "load session with %s", address.String()) { + break + } + } + if rawSess == nil { + return record.NewSession(SignalProtobufSerializer.Session, SignalProtobufSerializer.State) + } + sess, err := record.NewSessionFromBytes(rawSess, SignalProtobufSerializer.Session, SignalProtobufSerializer.State) + if err != nil { + device.Log.Errorf("Failed to deserialize session with %s: %v", address.String(), err) + return record.NewSession(SignalProtobufSerializer.Session, SignalProtobufSerializer.State) + } + return sess +} + +func (device *Device) GetSubDeviceSessions(name string) []uint32 { + panic("not implemented") +} + +func (device *Device) StoreSession(address *protocol.SignalAddress, record *record.Session) { + for i := 0; ; i++ { + err := device.Sessions.PutSession(address.String(), record.Serialize()) + if err == nil || !device.handleDatabaseError(i, err, "store session with %s", address.String()) { + return + } + } +} + +func (device *Device) ContainsSession(remoteAddress *protocol.SignalAddress) bool { + for i := 0; ; i++ { + hasSession, err := device.Sessions.HasSession(remoteAddress.String()) + if err == nil || !device.handleDatabaseError(i, err, "store has session for %s", remoteAddress.String()) { + return hasSession + } + } +} + +func (device *Device) DeleteSession(remoteAddress *protocol.SignalAddress) { + panic("not implemented") +} + +func (device *Device) DeleteAllSessions() { + panic("not implemented") +} + +func (device *Device) LoadSignedPreKey(signedPreKeyID uint32) *record.SignedPreKey { + if signedPreKeyID == device.SignedPreKey.KeyID { + return record.NewSignedPreKey(signedPreKeyID, 0, ecc.NewECKeyPair( + ecc.NewDjbECPublicKey(*device.SignedPreKey.Pub), + ecc.NewDjbECPrivateKey(*device.SignedPreKey.Priv), + ), *device.SignedPreKey.Signature, nil) + } + return nil +} + +func (device *Device) LoadSignedPreKeys() []*record.SignedPreKey { + panic("not implemented") +} + +func (device *Device) StoreSignedPreKey(signedPreKeyID uint32, record *record.SignedPreKey) { + panic("not implemented") +} + +func (device *Device) ContainsSignedPreKey(signedPreKeyID uint32) bool { + panic("not implemented") +} + +func (device *Device) RemoveSignedPreKey(signedPreKeyID uint32) { + panic("not implemented") +} + +func (device *Device) StoreSenderKey(senderKeyName *protocol.SenderKeyName, keyRecord *groupRecord.SenderKey) { + for i := 0; ; i++ { + err := device.SenderKeys.PutSenderKey(senderKeyName.GroupID(), senderKeyName.Sender().String(), keyRecord.Serialize()) + if err == nil || !device.handleDatabaseError(i, err, "store sender key from %s", senderKeyName.Sender().String()) { + return + } + } +} + +func (device *Device) LoadSenderKey(senderKeyName *protocol.SenderKeyName) *groupRecord.SenderKey { + var rawKey []byte + for i := 0; ; i++ { + var err error + rawKey, err = device.SenderKeys.GetSenderKey(senderKeyName.GroupID(), senderKeyName.Sender().String()) + if err == nil || !device.handleDatabaseError(i, err, "load sender key from %s for %s", senderKeyName.Sender().String(), senderKeyName.GroupID()) { + break + } + } + if rawKey == nil { + return groupRecord.NewSenderKey(SignalProtobufSerializer.SenderKeyRecord, SignalProtobufSerializer.SenderKeyState) + } + key, err := groupRecord.NewSenderKeyFromBytes(rawKey, SignalProtobufSerializer.SenderKeyRecord, SignalProtobufSerializer.SenderKeyState) + if err != nil { + device.Log.Errorf("Failed to deserialize sender key from %s for %s: %v", senderKeyName.Sender().String(), senderKeyName.GroupID(), err) + return groupRecord.NewSenderKey(SignalProtobufSerializer.SenderKeyRecord, SignalProtobufSerializer.SenderKeyState) + } + return key +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/store/sqlstore/container.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/store/sqlstore/container.go new file mode 100644 index 0000000..7f8c6c8 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/store/sqlstore/container.go @@ -0,0 +1,257 @@ +// Copyright (c) 2022 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package sqlstore + +import ( + "crypto/rand" + "database/sql" + "errors" + "fmt" + mathRand "math/rand" + + waProto "go.mau.fi/whatsmeow/binary/proto" + "go.mau.fi/whatsmeow/store" + "go.mau.fi/whatsmeow/types" + "go.mau.fi/whatsmeow/util/keys" + waLog "go.mau.fi/whatsmeow/util/log" +) + +// Container is a wrapper for a SQL database that can contain multiple whatsmeow sessions. +type Container struct { + db *sql.DB + dialect string + log waLog.Logger + + DatabaseErrorHandler func(device *store.Device, action string, attemptIndex int, err error) (retry bool) +} + +var _ store.DeviceContainer = (*Container)(nil) + +// New connects to the given SQL database and wraps it in a Container. +// +// Only SQLite and Postgres are currently fully supported. +// +// The logger can be nil and will default to a no-op logger. +// +// When using SQLite, it's strongly recommended to enable foreign keys by adding `?_foreign_keys=true`: +// +// container, err := sqlstore.New("sqlite3", "file:yoursqlitefile.db?_foreign_keys=on", nil) +func New(dialect, address string, log waLog.Logger) (*Container, error) { + db, err := sql.Open(dialect, address) + if err != nil { + return nil, fmt.Errorf("failed to open database: %w", err) + } + container := NewWithDB(db, dialect, log) + err = container.Upgrade() + if err != nil { + return nil, fmt.Errorf("failed to upgrade database: %w", err) + } + return container, nil +} + +// NewWithDB wraps an existing SQL connection in a Container. +// +// Only SQLite and Postgres are currently fully supported. +// +// The logger can be nil and will default to a no-op logger. +// +// When using SQLite, it's strongly recommended to enable foreign keys by adding `?_foreign_keys=true`: +// +// db, err := sql.Open("sqlite3", "file:yoursqlitefile.db?_foreign_keys=on") +// if err != nil { +// panic(err) +// } +// container, err := sqlstore.NewWithDB(db, "sqlite3", nil) +func NewWithDB(db *sql.DB, dialect string, log waLog.Logger) *Container { + if log == nil { + log = waLog.Noop + } + return &Container{ + db: db, + dialect: dialect, + log: log, + } +} + +const getAllDevicesQuery = ` +SELECT jid, registration_id, noise_key, identity_key, + signed_pre_key, signed_pre_key_id, signed_pre_key_sig, + adv_key, adv_details, adv_account_sig, adv_account_sig_key, adv_device_sig, + platform, business_name, push_name +FROM whatsmeow_device +` + +const getDeviceQuery = getAllDevicesQuery + " WHERE jid=$1" + +type scannable interface { + Scan(dest ...interface{}) error +} + +func (c *Container) scanDevice(row scannable) (*store.Device, error) { + var device store.Device + device.DatabaseErrorHandler = c.DatabaseErrorHandler + device.Log = c.log + device.SignedPreKey = &keys.PreKey{} + var noisePriv, identityPriv, preKeyPriv, preKeySig []byte + var account waProto.ADVSignedDeviceIdentity + + err := row.Scan( + &device.ID, &device.RegistrationID, &noisePriv, &identityPriv, + &preKeyPriv, &device.SignedPreKey.KeyID, &preKeySig, + &device.AdvSecretKey, &account.Details, &account.AccountSignature, &account.AccountSignatureKey, &account.DeviceSignature, + &device.Platform, &device.BusinessName, &device.PushName) + if err != nil { + return nil, fmt.Errorf("failed to scan session: %w", err) + } else if len(noisePriv) != 32 || len(identityPriv) != 32 || len(preKeyPriv) != 32 || len(preKeySig) != 64 { + return nil, ErrInvalidLength + } + + device.NoiseKey = keys.NewKeyPairFromPrivateKey(*(*[32]byte)(noisePriv)) + device.IdentityKey = keys.NewKeyPairFromPrivateKey(*(*[32]byte)(identityPriv)) + device.SignedPreKey.KeyPair = *keys.NewKeyPairFromPrivateKey(*(*[32]byte)(preKeyPriv)) + device.SignedPreKey.Signature = (*[64]byte)(preKeySig) + device.Account = &account + + innerStore := NewSQLStore(c, *device.ID) + device.Identities = innerStore + device.Sessions = innerStore + device.PreKeys = innerStore + device.SenderKeys = innerStore + device.AppStateKeys = innerStore + device.AppState = innerStore + device.Contacts = innerStore + device.ChatSettings = innerStore + device.MsgSecrets = innerStore + device.PrivacyTokens = innerStore + device.Container = c + device.Initialized = true + + return &device, nil +} + +// GetAllDevices finds all the devices in the database. +func (c *Container) GetAllDevices() ([]*store.Device, error) { + res, err := c.db.Query(getAllDevicesQuery) + if err != nil { + return nil, fmt.Errorf("failed to query sessions: %w", err) + } + sessions := make([]*store.Device, 0) + for res.Next() { + sess, scanErr := c.scanDevice(res) + if scanErr != nil { + return sessions, scanErr + } + sessions = append(sessions, sess) + } + return sessions, nil +} + +// GetFirstDevice is a convenience method for getting the first device in the store. If there are +// no devices, then a new device will be created. You should only use this if you don't want to +// have multiple sessions simultaneously. +func (c *Container) GetFirstDevice() (*store.Device, error) { + devices, err := c.GetAllDevices() + if err != nil { + return nil, err + } + if len(devices) == 0 { + return c.NewDevice(), nil + } else { + return devices[0], nil + } +} + +// GetDevice finds the device with the specified JID in the database. +// +// If the device is not found, nil is returned instead. +// +// Note that the parameter usually must be an AD-JID. +func (c *Container) GetDevice(jid types.JID) (*store.Device, error) { + sess, err := c.scanDevice(c.db.QueryRow(getDeviceQuery, jid)) + if errors.Is(err, sql.ErrNoRows) { + return nil, nil + } + return sess, err +} + +const ( + insertDeviceQuery = ` + INSERT INTO whatsmeow_device (jid, registration_id, noise_key, identity_key, + signed_pre_key, signed_pre_key_id, signed_pre_key_sig, + adv_key, adv_details, adv_account_sig, adv_account_sig_key, adv_device_sig, + platform, business_name, push_name) + VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15) + ON CONFLICT (jid) DO UPDATE + SET platform=excluded.platform, business_name=excluded.business_name, push_name=excluded.push_name + ` + deleteDeviceQuery = `DELETE FROM whatsmeow_device WHERE jid=$1` +) + +// NewDevice creates a new device in this database. +// +// No data is actually stored before Save is called. However, the pairing process will automatically +// call Save after a successful pairing, so you most likely don't need to call it yourself. +func (c *Container) NewDevice() *store.Device { + device := &store.Device{ + Log: c.log, + Container: c, + + DatabaseErrorHandler: c.DatabaseErrorHandler, + + NoiseKey: keys.NewKeyPair(), + IdentityKey: keys.NewKeyPair(), + RegistrationID: mathRand.Uint32(), + AdvSecretKey: make([]byte, 32), + } + _, err := rand.Read(device.AdvSecretKey) + if err != nil { + panic(err) + } + device.SignedPreKey = device.IdentityKey.CreateSignedPreKey(1) + return device +} + +// ErrDeviceIDMustBeSet is the error returned by PutDevice if you try to save a device before knowing its JID. +var ErrDeviceIDMustBeSet = errors.New("device JID must be known before accessing database") + +// PutDevice stores the given device in this database. This should be called through Device.Save() +// (which usually doesn't need to be called manually, as the library does that automatically when relevant). +func (c *Container) PutDevice(device *store.Device) error { + if device.ID == nil { + return ErrDeviceIDMustBeSet + } + _, err := c.db.Exec(insertDeviceQuery, + device.ID.String(), device.RegistrationID, device.NoiseKey.Priv[:], device.IdentityKey.Priv[:], + device.SignedPreKey.Priv[:], device.SignedPreKey.KeyID, device.SignedPreKey.Signature[:], + device.AdvSecretKey, device.Account.Details, device.Account.AccountSignature, device.Account.AccountSignatureKey, device.Account.DeviceSignature, + device.Platform, device.BusinessName, device.PushName) + + if !device.Initialized { + innerStore := NewSQLStore(c, *device.ID) + device.Identities = innerStore + device.Sessions = innerStore + device.PreKeys = innerStore + device.SenderKeys = innerStore + device.AppStateKeys = innerStore + device.AppState = innerStore + device.Contacts = innerStore + device.ChatSettings = innerStore + device.MsgSecrets = innerStore + device.PrivacyTokens = innerStore + device.Initialized = true + } + return err +} + +// DeleteDevice deletes the given device from this database. This should be called through Device.Delete() +func (c *Container) DeleteDevice(store *store.Device) error { + if store.ID == nil { + return ErrDeviceIDMustBeSet + } + _, err := c.db.Exec(deleteDeviceQuery, store.ID.String()) + return err +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/store/sqlstore/store.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/store/sqlstore/store.go new file mode 100644 index 0000000..8221a4a --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/store/sqlstore/store.go @@ -0,0 +1,768 @@ +// Copyright (c) 2022 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +// Package sqlstore contains an SQL-backed implementation of the interfaces in the store package. +package sqlstore + +import ( + "database/sql" + "database/sql/driver" + "errors" + "fmt" + "strings" + "sync" + "time" + + "go.mau.fi/whatsmeow/store" + "go.mau.fi/whatsmeow/types" + "go.mau.fi/whatsmeow/util/keys" +) + +// ErrInvalidLength is returned by some database getters if the database returned a byte array with an unexpected length. +// This should be impossible, as the database schema contains CHECK()s for all the relevant columns. +var ErrInvalidLength = errors.New("database returned byte array with illegal length") + +// PostgresArrayWrapper is a function to wrap array values before passing them to the sql package. +// +// When using github.com/lib/pq, you should set +// +// whatsmeow.PostgresArrayWrapper = pq.Array +var PostgresArrayWrapper func(interface{}) interface { + driver.Valuer + sql.Scanner +} + +type SQLStore struct { + *Container + JID string + + preKeyLock sync.Mutex + + contactCache map[types.JID]*types.ContactInfo + contactCacheLock sync.Mutex +} + +// NewSQLStore creates a new SQLStore with the given database container and user JID. +// It contains implementations of all the different stores in the store package. +// +// In general, you should use Container.NewDevice or Container.GetDevice instead of this. +func NewSQLStore(c *Container, jid types.JID) *SQLStore { + return &SQLStore{ + Container: c, + JID: jid.String(), + contactCache: make(map[types.JID]*types.ContactInfo), + } +} + +var _ store.IdentityStore = (*SQLStore)(nil) +var _ store.SessionStore = (*SQLStore)(nil) +var _ store.PreKeyStore = (*SQLStore)(nil) +var _ store.SenderKeyStore = (*SQLStore)(nil) +var _ store.AppStateSyncKeyStore = (*SQLStore)(nil) +var _ store.AppStateStore = (*SQLStore)(nil) +var _ store.ContactStore = (*SQLStore)(nil) + +const ( + putIdentityQuery = ` + INSERT INTO whatsmeow_identity_keys (our_jid, their_id, identity) VALUES ($1, $2, $3) + ON CONFLICT (our_jid, their_id) DO UPDATE SET identity=excluded.identity + ` + deleteAllIdentitiesQuery = `DELETE FROM whatsmeow_identity_keys WHERE our_jid=$1 AND their_id LIKE $2` + deleteIdentityQuery = `DELETE FROM whatsmeow_identity_keys WHERE our_jid=$1 AND their_id=$2` + getIdentityQuery = `SELECT identity FROM whatsmeow_identity_keys WHERE our_jid=$1 AND their_id=$2` +) + +func (s *SQLStore) PutIdentity(address string, key [32]byte) error { + _, err := s.db.Exec(putIdentityQuery, s.JID, address, key[:]) + return err +} + +func (s *SQLStore) DeleteAllIdentities(phone string) error { + _, err := s.db.Exec(deleteAllIdentitiesQuery, s.JID, phone+":%") + return err +} + +func (s *SQLStore) DeleteIdentity(address string) error { + _, err := s.db.Exec(deleteAllIdentitiesQuery, s.JID, address) + return err +} + +func (s *SQLStore) IsTrustedIdentity(address string, key [32]byte) (bool, error) { + var existingIdentity []byte + err := s.db.QueryRow(getIdentityQuery, s.JID, address).Scan(&existingIdentity) + if errors.Is(err, sql.ErrNoRows) { + // Trust if not known, it'll be saved automatically later + return true, nil + } else if err != nil { + return false, err + } else if len(existingIdentity) != 32 { + return false, ErrInvalidLength + } + return *(*[32]byte)(existingIdentity) == key, nil +} + +const ( + getSessionQuery = `SELECT session FROM whatsmeow_sessions WHERE our_jid=$1 AND their_id=$2` + hasSessionQuery = `SELECT true FROM whatsmeow_sessions WHERE our_jid=$1 AND their_id=$2` + putSessionQuery = ` + INSERT INTO whatsmeow_sessions (our_jid, their_id, session) VALUES ($1, $2, $3) + ON CONFLICT (our_jid, their_id) DO UPDATE SET session=excluded.session + ` + deleteAllSessionsQuery = `DELETE FROM whatsmeow_sessions WHERE our_jid=$1 AND their_id LIKE $2` + deleteSessionQuery = `DELETE FROM whatsmeow_sessions WHERE our_jid=$1 AND their_id=$2` +) + +func (s *SQLStore) GetSession(address string) (session []byte, err error) { + err = s.db.QueryRow(getSessionQuery, s.JID, address).Scan(&session) + if errors.Is(err, sql.ErrNoRows) { + err = nil + } + return +} + +func (s *SQLStore) HasSession(address string) (has bool, err error) { + err = s.db.QueryRow(hasSessionQuery, s.JID, address).Scan(&has) + if errors.Is(err, sql.ErrNoRows) { + err = nil + } + return +} + +func (s *SQLStore) PutSession(address string, session []byte) error { + _, err := s.db.Exec(putSessionQuery, s.JID, address, session) + return err +} + +func (s *SQLStore) DeleteAllSessions(phone string) error { + _, err := s.db.Exec(deleteAllSessionsQuery, s.JID, phone+":%") + return err +} + +func (s *SQLStore) DeleteSession(address string) error { + _, err := s.db.Exec(deleteSessionQuery, s.JID, address) + return err +} + +const ( + getLastPreKeyIDQuery = `SELECT MAX(key_id) FROM whatsmeow_pre_keys WHERE jid=$1` + insertPreKeyQuery = `INSERT INTO whatsmeow_pre_keys (jid, key_id, key, uploaded) VALUES ($1, $2, $3, $4)` + getUnuploadedPreKeysQuery = `SELECT key_id, key FROM whatsmeow_pre_keys WHERE jid=$1 AND uploaded=false ORDER BY key_id LIMIT $2` + getPreKeyQuery = `SELECT key_id, key FROM whatsmeow_pre_keys WHERE jid=$1 AND key_id=$2` + deletePreKeyQuery = `DELETE FROM whatsmeow_pre_keys WHERE jid=$1 AND key_id=$2` + markPreKeysAsUploadedQuery = `UPDATE whatsmeow_pre_keys SET uploaded=true WHERE jid=$1 AND key_id<=$2` + getUploadedPreKeyCountQuery = `SELECT COUNT(*) FROM whatsmeow_pre_keys WHERE jid=$1 AND uploaded=true` +) + +func (s *SQLStore) genOnePreKey(id uint32, markUploaded bool) (*keys.PreKey, error) { + key := keys.NewPreKey(id) + _, err := s.db.Exec(insertPreKeyQuery, s.JID, key.KeyID, key.Priv[:], markUploaded) + return key, err +} + +func (s *SQLStore) getNextPreKeyID() (uint32, error) { + var lastKeyID sql.NullInt32 + err := s.db.QueryRow(getLastPreKeyIDQuery, s.JID).Scan(&lastKeyID) + if err != nil { + return 0, fmt.Errorf("failed to query next prekey ID: %w", err) + } + return uint32(lastKeyID.Int32) + 1, nil +} + +func (s *SQLStore) GenOnePreKey() (*keys.PreKey, error) { + s.preKeyLock.Lock() + defer s.preKeyLock.Unlock() + nextKeyID, err := s.getNextPreKeyID() + if err != nil { + return nil, err + } + return s.genOnePreKey(nextKeyID, true) +} + +func (s *SQLStore) GetOrGenPreKeys(count uint32) ([]*keys.PreKey, error) { + s.preKeyLock.Lock() + defer s.preKeyLock.Unlock() + + res, err := s.db.Query(getUnuploadedPreKeysQuery, s.JID, count) + if err != nil { + return nil, fmt.Errorf("failed to query existing prekeys: %w", err) + } + newKeys := make([]*keys.PreKey, count) + var existingCount uint32 + for res.Next() { + var key *keys.PreKey + key, err = scanPreKey(res) + if err != nil { + return nil, err + } else if key != nil { + newKeys[existingCount] = key + existingCount++ + } + } + + if existingCount < uint32(len(newKeys)) { + var nextKeyID uint32 + nextKeyID, err = s.getNextPreKeyID() + if err != nil { + return nil, err + } + for i := existingCount; i < count; i++ { + newKeys[i], err = s.genOnePreKey(nextKeyID, false) + if err != nil { + return nil, fmt.Errorf("failed to generate prekey: %w", err) + } + nextKeyID++ + } + } + + return newKeys, nil +} + +func scanPreKey(row scannable) (*keys.PreKey, error) { + var priv []byte + var id uint32 + err := row.Scan(&id, &priv) + if errors.Is(err, sql.ErrNoRows) { + return nil, nil + } else if err != nil { + return nil, err + } else if len(priv) != 32 { + return nil, ErrInvalidLength + } + return &keys.PreKey{ + KeyPair: *keys.NewKeyPairFromPrivateKey(*(*[32]byte)(priv)), + KeyID: id, + }, nil +} + +func (s *SQLStore) GetPreKey(id uint32) (*keys.PreKey, error) { + return scanPreKey(s.db.QueryRow(getPreKeyQuery, s.JID, id)) +} + +func (s *SQLStore) RemovePreKey(id uint32) error { + _, err := s.db.Exec(deletePreKeyQuery, s.JID, id) + return err +} + +func (s *SQLStore) MarkPreKeysAsUploaded(upToID uint32) error { + _, err := s.db.Exec(markPreKeysAsUploadedQuery, s.JID, upToID) + return err +} + +func (s *SQLStore) UploadedPreKeyCount() (count int, err error) { + err = s.db.QueryRow(getUploadedPreKeyCountQuery, s.JID).Scan(&count) + return +} + +const ( + getSenderKeyQuery = `SELECT sender_key FROM whatsmeow_sender_keys WHERE our_jid=$1 AND chat_id=$2 AND sender_id=$3` + putSenderKeyQuery = ` + INSERT INTO whatsmeow_sender_keys (our_jid, chat_id, sender_id, sender_key) VALUES ($1, $2, $3, $4) + ON CONFLICT (our_jid, chat_id, sender_id) DO UPDATE SET sender_key=excluded.sender_key + ` +) + +func (s *SQLStore) PutSenderKey(group, user string, session []byte) error { + _, err := s.db.Exec(putSenderKeyQuery, s.JID, group, user, session) + return err +} + +func (s *SQLStore) GetSenderKey(group, user string) (key []byte, err error) { + err = s.db.QueryRow(getSenderKeyQuery, s.JID, group, user).Scan(&key) + if errors.Is(err, sql.ErrNoRows) { + err = nil + } + return +} + +const ( + putAppStateSyncKeyQuery = ` + INSERT INTO whatsmeow_app_state_sync_keys (jid, key_id, key_data, timestamp, fingerprint) VALUES ($1, $2, $3, $4, $5) + ON CONFLICT (jid, key_id) DO UPDATE + SET key_data=excluded.key_data, timestamp=excluded.timestamp, fingerprint=excluded.fingerprint + ` + getAppStateSyncKeyQuery = `SELECT key_data, timestamp, fingerprint FROM whatsmeow_app_state_sync_keys WHERE jid=$1 AND key_id=$2` +) + +func (s *SQLStore) PutAppStateSyncKey(id []byte, key store.AppStateSyncKey) error { + _, err := s.db.Exec(putAppStateSyncKeyQuery, s.JID, id, key.Data, key.Timestamp, key.Fingerprint) + return err +} + +func (s *SQLStore) GetAppStateSyncKey(id []byte) (*store.AppStateSyncKey, error) { + var key store.AppStateSyncKey + err := s.db.QueryRow(getAppStateSyncKeyQuery, s.JID, id).Scan(&key.Data, &key.Timestamp, &key.Fingerprint) + if errors.Is(err, sql.ErrNoRows) { + return nil, nil + } + return &key, err +} + +const ( + putAppStateVersionQuery = ` + INSERT INTO whatsmeow_app_state_version (jid, name, version, hash) VALUES ($1, $2, $3, $4) + ON CONFLICT (jid, name) DO UPDATE SET version=excluded.version, hash=excluded.hash + ` + getAppStateVersionQuery = `SELECT version, hash FROM whatsmeow_app_state_version WHERE jid=$1 AND name=$2` + deleteAppStateVersionQuery = `DELETE FROM whatsmeow_app_state_version WHERE jid=$1 AND name=$2` + putAppStateMutationMACsQuery = `INSERT INTO whatsmeow_app_state_mutation_macs (jid, name, version, index_mac, value_mac) VALUES ` + deleteAppStateMutationMACsQueryPostgres = `DELETE FROM whatsmeow_app_state_mutation_macs WHERE jid=$1 AND name=$2 AND index_mac=ANY($3::bytea[])` + deleteAppStateMutationMACsQueryGeneric = `DELETE FROM whatsmeow_app_state_mutation_macs WHERE jid=$1 AND name=$2 AND index_mac IN ` + getAppStateMutationMACQuery = `SELECT value_mac FROM whatsmeow_app_state_mutation_macs WHERE jid=$1 AND name=$2 AND index_mac=$3 ORDER BY version DESC LIMIT 1` +) + +func (s *SQLStore) PutAppStateVersion(name string, version uint64, hash [128]byte) error { + _, err := s.db.Exec(putAppStateVersionQuery, s.JID, name, version, hash[:]) + return err +} + +func (s *SQLStore) GetAppStateVersion(name string) (version uint64, hash [128]byte, err error) { + var uncheckedHash []byte + err = s.db.QueryRow(getAppStateVersionQuery, s.JID, name).Scan(&version, &uncheckedHash) + if errors.Is(err, sql.ErrNoRows) { + // version will be 0 and hash will be an empty array, which is the correct initial state + err = nil + } else if err != nil { + // There's an error, just return it + } else if len(uncheckedHash) != 128 { + // This shouldn't happen + err = ErrInvalidLength + } else { + // No errors, convert hash slice to array + hash = *(*[128]byte)(uncheckedHash) + } + return +} + +func (s *SQLStore) DeleteAppStateVersion(name string) error { + _, err := s.db.Exec(deleteAppStateVersionQuery, s.JID, name) + return err +} + +type execable interface { + Exec(query string, args ...interface{}) (sql.Result, error) +} + +func (s *SQLStore) putAppStateMutationMACs(tx execable, name string, version uint64, mutations []store.AppStateMutationMAC) error { + values := make([]interface{}, 3+len(mutations)*2) + queryParts := make([]string, len(mutations)) + values[0] = s.JID + values[1] = name + values[2] = version + placeholderSyntax := "($1, $2, $3, $%d, $%d)" + if s.dialect == "sqlite3" { + placeholderSyntax = "(?1, ?2, ?3, ?%d, ?%d)" + } + for i, mutation := range mutations { + baseIndex := 3 + i*2 + values[baseIndex] = mutation.IndexMAC + values[baseIndex+1] = mutation.ValueMAC + queryParts[i] = fmt.Sprintf(placeholderSyntax, baseIndex+1, baseIndex+2) + } + _, err := tx.Exec(putAppStateMutationMACsQuery+strings.Join(queryParts, ","), values...) + return err +} + +const mutationBatchSize = 400 + +func (s *SQLStore) PutAppStateMutationMACs(name string, version uint64, mutations []store.AppStateMutationMAC) error { + if len(mutations) > mutationBatchSize { + tx, err := s.db.Begin() + if err != nil { + return fmt.Errorf("failed to start transaction: %w", err) + } + for i := 0; i < len(mutations); i += mutationBatchSize { + var mutationSlice []store.AppStateMutationMAC + if len(mutations) > i+mutationBatchSize { + mutationSlice = mutations[i : i+mutationBatchSize] + } else { + mutationSlice = mutations[i:] + } + err = s.putAppStateMutationMACs(tx, name, version, mutationSlice) + if err != nil { + _ = tx.Rollback() + return err + } + } + err = tx.Commit() + if err != nil { + return fmt.Errorf("failed to commit transaction: %w", err) + } + return nil + } else if len(mutations) > 0 { + return s.putAppStateMutationMACs(s.db, name, version, mutations) + } + return nil +} + +func (s *SQLStore) DeleteAppStateMutationMACs(name string, indexMACs [][]byte) (err error) { + if len(indexMACs) == 0 { + return + } + if s.dialect == "postgres" && PostgresArrayWrapper != nil { + _, err = s.db.Exec(deleteAppStateMutationMACsQueryPostgres, s.JID, name, PostgresArrayWrapper(indexMACs)) + } else { + args := make([]interface{}, 2+len(indexMACs)) + args[0] = s.JID + args[1] = name + queryParts := make([]string, len(indexMACs)) + for i, item := range indexMACs { + args[2+i] = item + queryParts[i] = fmt.Sprintf("$%d", i+3) + } + _, err = s.db.Exec(deleteAppStateMutationMACsQueryGeneric+"("+strings.Join(queryParts, ",")+")", args...) + } + return +} + +func (s *SQLStore) GetAppStateMutationMAC(name string, indexMAC []byte) (valueMAC []byte, err error) { + err = s.db.QueryRow(getAppStateMutationMACQuery, s.JID, name, indexMAC).Scan(&valueMAC) + if errors.Is(err, sql.ErrNoRows) { + err = nil + } + return +} + +const ( + putContactNameQuery = ` + INSERT INTO whatsmeow_contacts (our_jid, their_jid, first_name, full_name) VALUES ($1, $2, $3, $4) + ON CONFLICT (our_jid, their_jid) DO UPDATE SET first_name=excluded.first_name, full_name=excluded.full_name + ` + putManyContactNamesQuery = ` + INSERT INTO whatsmeow_contacts (our_jid, their_jid, first_name, full_name) + VALUES %s + ON CONFLICT (our_jid, their_jid) DO UPDATE SET first_name=excluded.first_name, full_name=excluded.full_name + ` + putPushNameQuery = ` + INSERT INTO whatsmeow_contacts (our_jid, their_jid, push_name) VALUES ($1, $2, $3) + ON CONFLICT (our_jid, their_jid) DO UPDATE SET push_name=excluded.push_name + ` + putBusinessNameQuery = ` + INSERT INTO whatsmeow_contacts (our_jid, their_jid, business_name) VALUES ($1, $2, $3) + ON CONFLICT (our_jid, their_jid) DO UPDATE SET business_name=excluded.business_name + ` + getContactQuery = ` + SELECT first_name, full_name, push_name, business_name FROM whatsmeow_contacts WHERE our_jid=$1 AND their_jid=$2 + ` + getAllContactsQuery = ` + SELECT their_jid, first_name, full_name, push_name, business_name FROM whatsmeow_contacts WHERE our_jid=$1 + ` +) + +func (s *SQLStore) PutPushName(user types.JID, pushName string) (bool, string, error) { + s.contactCacheLock.Lock() + defer s.contactCacheLock.Unlock() + + cached, err := s.getContact(user) + if err != nil { + return false, "", err + } + if cached.PushName != pushName { + _, err = s.db.Exec(putPushNameQuery, s.JID, user, pushName) + if err != nil { + return false, "", err + } + previousName := cached.PushName + cached.PushName = pushName + cached.Found = true + return true, previousName, nil + } + return false, "", nil +} + +func (s *SQLStore) PutBusinessName(user types.JID, businessName string) (bool, string, error) { + s.contactCacheLock.Lock() + defer s.contactCacheLock.Unlock() + + cached, err := s.getContact(user) + if err != nil { + return false, "", err + } + if cached.BusinessName != businessName { + _, err = s.db.Exec(putBusinessNameQuery, s.JID, user, businessName) + if err != nil { + return false, "", err + } + previousName := cached.BusinessName + cached.BusinessName = businessName + cached.Found = true + return true, previousName, nil + } + return false, "", nil +} + +func (s *SQLStore) PutContactName(user types.JID, firstName, fullName string) error { + s.contactCacheLock.Lock() + defer s.contactCacheLock.Unlock() + + cached, err := s.getContact(user) + if err != nil { + return err + } + if cached.FirstName != firstName || cached.FullName != fullName { + _, err = s.db.Exec(putContactNameQuery, s.JID, user, firstName, fullName) + if err != nil { + return err + } + cached.FirstName = firstName + cached.FullName = fullName + cached.Found = true + } + return nil +} + +const contactBatchSize = 300 + +func (s *SQLStore) putContactNamesBatch(tx execable, contacts []store.ContactEntry) error { + values := make([]interface{}, 1, 1+len(contacts)*3) + queryParts := make([]string, 0, len(contacts)) + values[0] = s.JID + placeholderSyntax := "($1, $%d, $%d, $%d)" + if s.dialect == "sqlite3" { + placeholderSyntax = "(?1, ?%d, ?%d, ?%d)" + } + i := 0 + handledContacts := make(map[types.JID]struct{}, len(contacts)) + for _, contact := range contacts { + if contact.JID.IsEmpty() { + s.log.Warnf("Empty contact info in mass insert: %+v", contact) + continue + } + // The whole query will break if there are duplicates, so make sure there aren't any duplicates + _, alreadyHandled := handledContacts[contact.JID] + if alreadyHandled { + s.log.Warnf("Duplicate contact info for %s in mass insert", contact.JID) + continue + } + handledContacts[contact.JID] = struct{}{} + baseIndex := i*3 + 1 + values = append(values, contact.JID.String(), contact.FirstName, contact.FullName) + queryParts = append(queryParts, fmt.Sprintf(placeholderSyntax, baseIndex+1, baseIndex+2, baseIndex+3)) + i++ + } + _, err := tx.Exec(fmt.Sprintf(putManyContactNamesQuery, strings.Join(queryParts, ",")), values...) + return err +} + +func (s *SQLStore) PutAllContactNames(contacts []store.ContactEntry) error { + if len(contacts) > contactBatchSize { + tx, err := s.db.Begin() + if err != nil { + return fmt.Errorf("failed to start transaction: %w", err) + } + for i := 0; i < len(contacts); i += contactBatchSize { + var contactSlice []store.ContactEntry + if len(contacts) > i+contactBatchSize { + contactSlice = contacts[i : i+contactBatchSize] + } else { + contactSlice = contacts[i:] + } + err = s.putContactNamesBatch(tx, contactSlice) + if err != nil { + _ = tx.Rollback() + return err + } + } + err = tx.Commit() + if err != nil { + return fmt.Errorf("failed to commit transaction: %w", err) + } + } else if len(contacts) > 0 { + err := s.putContactNamesBatch(s.db, contacts) + if err != nil { + return err + } + } else { + return nil + } + s.contactCacheLock.Lock() + // Just clear the cache, fetching pushnames and business names would be too much effort + s.contactCache = make(map[types.JID]*types.ContactInfo) + s.contactCacheLock.Unlock() + return nil +} + +func (s *SQLStore) getContact(user types.JID) (*types.ContactInfo, error) { + cached, ok := s.contactCache[user] + if ok { + return cached, nil + } + + var first, full, push, business sql.NullString + err := s.db.QueryRow(getContactQuery, s.JID, user).Scan(&first, &full, &push, &business) + if err != nil && !errors.Is(err, sql.ErrNoRows) { + return nil, err + } + info := &types.ContactInfo{ + Found: err == nil, + FirstName: first.String, + FullName: full.String, + PushName: push.String, + BusinessName: business.String, + } + s.contactCache[user] = info + return info, nil +} + +func (s *SQLStore) GetContact(user types.JID) (types.ContactInfo, error) { + s.contactCacheLock.Lock() + info, err := s.getContact(user) + s.contactCacheLock.Unlock() + if err != nil { + return types.ContactInfo{}, err + } + return *info, nil +} + +func (s *SQLStore) GetAllContacts() (map[types.JID]types.ContactInfo, error) { + s.contactCacheLock.Lock() + defer s.contactCacheLock.Unlock() + rows, err := s.db.Query(getAllContactsQuery, s.JID) + if err != nil { + return nil, err + } + output := make(map[types.JID]types.ContactInfo, len(s.contactCache)) + for rows.Next() { + var jid types.JID + var first, full, push, business sql.NullString + err = rows.Scan(&jid, &first, &full, &push, &business) + if err != nil { + return nil, fmt.Errorf("error scanning row: %w", err) + } + info := types.ContactInfo{ + Found: true, + FirstName: first.String, + FullName: full.String, + PushName: push.String, + BusinessName: business.String, + } + output[jid] = info + s.contactCache[jid] = &info + } + return output, nil +} + +const ( + putChatSettingQuery = ` + INSERT INTO whatsmeow_chat_settings (our_jid, chat_jid, %[1]s) VALUES ($1, $2, $3) + ON CONFLICT (our_jid, chat_jid) DO UPDATE SET %[1]s=excluded.%[1]s + ` + getChatSettingsQuery = ` + SELECT muted_until, pinned, archived FROM whatsmeow_chat_settings WHERE our_jid=$1 AND chat_jid=$2 + ` +) + +func (s *SQLStore) PutMutedUntil(chat types.JID, mutedUntil time.Time) error { + var val int64 + if !mutedUntil.IsZero() { + val = mutedUntil.Unix() + } + _, err := s.db.Exec(fmt.Sprintf(putChatSettingQuery, "muted_until"), s.JID, chat, val) + return err +} + +func (s *SQLStore) PutPinned(chat types.JID, pinned bool) error { + _, err := s.db.Exec(fmt.Sprintf(putChatSettingQuery, "pinned"), s.JID, chat, pinned) + return err +} + +func (s *SQLStore) PutArchived(chat types.JID, archived bool) error { + _, err := s.db.Exec(fmt.Sprintf(putChatSettingQuery, "archived"), s.JID, chat, archived) + return err +} + +func (s *SQLStore) GetChatSettings(chat types.JID) (settings types.LocalChatSettings, err error) { + var mutedUntil int64 + err = s.db.QueryRow(getChatSettingsQuery, s.JID, chat).Scan(&mutedUntil, &settings.Pinned, &settings.Archived) + if errors.Is(err, sql.ErrNoRows) { + err = nil + } else if err != nil { + return + } else { + settings.Found = true + } + if mutedUntil != 0 { + settings.MutedUntil = time.Unix(mutedUntil, 0) + } + return +} + +const ( + putMsgSecret = ` + INSERT INTO whatsmeow_message_secrets (our_jid, chat_jid, sender_jid, message_id, key) + VALUES ($1, $2, $3, $4, $5) + ON CONFLICT (our_jid, chat_jid, sender_jid, message_id) DO NOTHING + ` + getMsgSecret = ` + SELECT key FROM whatsmeow_message_secrets WHERE our_jid=$1 AND chat_jid=$2 AND sender_jid=$3 AND message_id=$4 + ` +) + +func (s *SQLStore) PutMessageSecrets(inserts []store.MessageSecretInsert) (err error) { + tx, err := s.db.Begin() + if err != nil { + return fmt.Errorf("failed to begin transaction: %w", err) + } + for _, insert := range inserts { + _, err = tx.Exec(putMsgSecret, s.JID, insert.Chat.ToNonAD(), insert.Sender.ToNonAD(), insert.ID, insert.Secret) + } + err = tx.Commit() + if err != nil { + return fmt.Errorf("failed to commit transaction: %w", err) + } + return +} + +func (s *SQLStore) PutMessageSecret(chat, sender types.JID, id types.MessageID, secret []byte) (err error) { + _, err = s.db.Exec(putMsgSecret, s.JID, chat.ToNonAD(), sender.ToNonAD(), id, secret) + return +} + +func (s *SQLStore) GetMessageSecret(chat, sender types.JID, id types.MessageID) (secret []byte, err error) { + err = s.db.QueryRow(getMsgSecret, s.JID, chat.ToNonAD(), sender.ToNonAD(), id).Scan(&secret) + if errors.Is(err, sql.ErrNoRows) { + err = nil + } + return +} + +const ( + putPrivacyTokens = ` + INSERT INTO whatsmeow_privacy_tokens (our_jid, their_jid, token, timestamp) + VALUES ($1, $2, $3, $4) + ON CONFLICT (our_jid, their_jid) DO UPDATE SET token=EXCLUDED.token, timestamp=EXCLUDED.timestamp + ` + getPrivacyToken = `SELECT token, timestamp FROM whatsmeow_privacy_tokens WHERE our_jid=$1 AND their_jid=$2` +) + +func (s *SQLStore) PutPrivacyTokens(tokens ...store.PrivacyToken) error { + args := make([]any, 1+len(tokens)*3) + placeholders := make([]string, len(tokens)) + args[0] = s.JID + for i, token := range tokens { + args[i*3+1] = token.User.ToNonAD().String() + args[i*3+2] = token.Token + args[i*3+3] = token.Timestamp.Unix() + placeholders[i] = fmt.Sprintf("($1, $%d, $%d, $%d)", i*3+2, i*3+3, i*3+4) + } + query := strings.ReplaceAll(putPrivacyTokens, "($1, $2, $3, $4)", strings.Join(placeholders, ",")) + _, err := s.db.Exec(query, args...) + return err +} + +func (s *SQLStore) GetPrivacyToken(user types.JID) (*store.PrivacyToken, error) { + var token store.PrivacyToken + token.User = user.ToNonAD() + var ts int64 + err := s.db.QueryRow(getPrivacyToken, s.JID, token.User).Scan(&token.Token, &ts) + if errors.Is(err, sql.ErrNoRows) { + return nil, nil + } else if err != nil { + return nil, err + } else { + token.Timestamp = time.Unix(ts, 0) + return &token, nil + } +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrade.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrade.go new file mode 100644 index 0000000..0919ca8 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrade.go @@ -0,0 +1,273 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package sqlstore + +import ( + "database/sql" +) + +type upgradeFunc func(*sql.Tx, *Container) error + +// Upgrades is a list of functions that will upgrade a database to the latest version. +// +// This may be of use if you want to manage the database fully manually, but in most cases you +// should just call Container.Upgrade to let the library handle everything. +var Upgrades = [...]upgradeFunc{upgradeV1, upgradeV2, upgradeV3, upgradeV4} + +func (c *Container) getVersion() (int, error) { + _, err := c.db.Exec("CREATE TABLE IF NOT EXISTS whatsmeow_version (version INTEGER)") + if err != nil { + return -1, err + } + + version := 0 + row := c.db.QueryRow("SELECT version FROM whatsmeow_version LIMIT 1") + if row != nil { + _ = row.Scan(&version) + } + return version, nil +} + +func (c *Container) setVersion(tx *sql.Tx, version int) error { + _, err := tx.Exec("DELETE FROM whatsmeow_version") + if err != nil { + return err + } + _, err = tx.Exec("INSERT INTO whatsmeow_version (version) VALUES ($1)", version) + return err +} + +// Upgrade upgrades the database from the current to the latest version available. +func (c *Container) Upgrade() error { + version, err := c.getVersion() + if err != nil { + return err + } + + for ; version < len(Upgrades); version++ { + var tx *sql.Tx + tx, err = c.db.Begin() + if err != nil { + return err + } + + migrateFunc := Upgrades[version] + c.log.Infof("Upgrading database to v%d", version+1) + err = migrateFunc(tx, c) + if err != nil { + _ = tx.Rollback() + return err + } + + if err = c.setVersion(tx, version+1); err != nil { + return err + } + + if err = tx.Commit(); err != nil { + return err + } + } + + return nil +} + +func upgradeV1(tx *sql.Tx, _ *Container) error { + _, err := tx.Exec(`CREATE TABLE whatsmeow_device ( + jid TEXT PRIMARY KEY, + + registration_id BIGINT NOT NULL CHECK ( registration_id >= 0 AND registration_id < 4294967296 ), + + noise_key bytea NOT NULL CHECK ( length(noise_key) = 32 ), + identity_key bytea NOT NULL CHECK ( length(identity_key) = 32 ), + + signed_pre_key bytea NOT NULL CHECK ( length(signed_pre_key) = 32 ), + signed_pre_key_id INTEGER NOT NULL CHECK ( signed_pre_key_id >= 0 AND signed_pre_key_id < 16777216 ), + signed_pre_key_sig bytea NOT NULL CHECK ( length(signed_pre_key_sig) = 64 ), + + adv_key bytea NOT NULL, + adv_details bytea NOT NULL, + adv_account_sig bytea NOT NULL CHECK ( length(adv_account_sig) = 64 ), + adv_device_sig bytea NOT NULL CHECK ( length(adv_device_sig) = 64 ), + + platform TEXT NOT NULL DEFAULT '', + business_name TEXT NOT NULL DEFAULT '', + push_name TEXT NOT NULL DEFAULT '' + )`) + if err != nil { + return err + } + _, err = tx.Exec(`CREATE TABLE whatsmeow_identity_keys ( + our_jid TEXT, + their_id TEXT, + identity bytea NOT NULL CHECK ( length(identity) = 32 ), + + PRIMARY KEY (our_jid, their_id), + FOREIGN KEY (our_jid) REFERENCES whatsmeow_device(jid) ON DELETE CASCADE ON UPDATE CASCADE + )`) + if err != nil { + return err + } + _, err = tx.Exec(`CREATE TABLE whatsmeow_pre_keys ( + jid TEXT, + key_id INTEGER CHECK ( key_id >= 0 AND key_id < 16777216 ), + key bytea NOT NULL CHECK ( length(key) = 32 ), + uploaded BOOLEAN NOT NULL, + + PRIMARY KEY (jid, key_id), + FOREIGN KEY (jid) REFERENCES whatsmeow_device(jid) ON DELETE CASCADE ON UPDATE CASCADE + )`) + if err != nil { + return err + } + _, err = tx.Exec(`CREATE TABLE whatsmeow_sessions ( + our_jid TEXT, + their_id TEXT, + session bytea, + + PRIMARY KEY (our_jid, their_id), + FOREIGN KEY (our_jid) REFERENCES whatsmeow_device(jid) ON DELETE CASCADE ON UPDATE CASCADE + )`) + if err != nil { + return err + } + _, err = tx.Exec(`CREATE TABLE whatsmeow_sender_keys ( + our_jid TEXT, + chat_id TEXT, + sender_id TEXT, + sender_key bytea NOT NULL, + + PRIMARY KEY (our_jid, chat_id, sender_id), + FOREIGN KEY (our_jid) REFERENCES whatsmeow_device(jid) ON DELETE CASCADE ON UPDATE CASCADE + )`) + if err != nil { + return err + } + _, err = tx.Exec(`CREATE TABLE whatsmeow_app_state_sync_keys ( + jid TEXT, + key_id bytea, + key_data bytea NOT NULL, + timestamp BIGINT NOT NULL, + fingerprint bytea NOT NULL, + + PRIMARY KEY (jid, key_id), + FOREIGN KEY (jid) REFERENCES whatsmeow_device(jid) ON DELETE CASCADE ON UPDATE CASCADE + )`) + if err != nil { + return err + } + _, err = tx.Exec(`CREATE TABLE whatsmeow_app_state_version ( + jid TEXT, + name TEXT, + version BIGINT NOT NULL, + hash bytea NOT NULL CHECK ( length(hash) = 128 ), + + PRIMARY KEY (jid, name), + FOREIGN KEY (jid) REFERENCES whatsmeow_device(jid) ON DELETE CASCADE ON UPDATE CASCADE + )`) + if err != nil { + return err + } + _, err = tx.Exec(`CREATE TABLE whatsmeow_app_state_mutation_macs ( + jid TEXT, + name TEXT, + version BIGINT, + index_mac bytea CHECK ( length(index_mac) = 32 ), + value_mac bytea NOT NULL CHECK ( length(value_mac) = 32 ), + + PRIMARY KEY (jid, name, version, index_mac), + FOREIGN KEY (jid, name) REFERENCES whatsmeow_app_state_version(jid, name) ON DELETE CASCADE ON UPDATE CASCADE + )`) + if err != nil { + return err + } + _, err = tx.Exec(`CREATE TABLE whatsmeow_contacts ( + our_jid TEXT, + their_jid TEXT, + first_name TEXT, + full_name TEXT, + push_name TEXT, + business_name TEXT, + + PRIMARY KEY (our_jid, their_jid), + FOREIGN KEY (our_jid) REFERENCES whatsmeow_device(jid) ON DELETE CASCADE ON UPDATE CASCADE + )`) + if err != nil { + return err + } + _, err = tx.Exec(`CREATE TABLE whatsmeow_chat_settings ( + our_jid TEXT, + chat_jid TEXT, + muted_until BIGINT NOT NULL DEFAULT 0, + pinned BOOLEAN NOT NULL DEFAULT false, + archived BOOLEAN NOT NULL DEFAULT false, + + PRIMARY KEY (our_jid, chat_jid), + FOREIGN KEY (our_jid) REFERENCES whatsmeow_device(jid) ON DELETE CASCADE ON UPDATE CASCADE + )`) + if err != nil { + return err + } + return nil +} + +const fillSigKeyPostgres = ` +UPDATE whatsmeow_device SET adv_account_sig_key=( + SELECT identity + FROM whatsmeow_identity_keys + WHERE our_jid=whatsmeow_device.jid + AND their_id=concat(split_part(whatsmeow_device.jid, '.', 1), ':0') +); +DELETE FROM whatsmeow_device WHERE adv_account_sig_key IS NULL; +ALTER TABLE whatsmeow_device ALTER COLUMN adv_account_sig_key SET NOT NULL; +` + +const fillSigKeySQLite = ` +UPDATE whatsmeow_device SET adv_account_sig_key=( + SELECT identity + FROM whatsmeow_identity_keys + WHERE our_jid=whatsmeow_device.jid + AND their_id=substr(whatsmeow_device.jid, 0, instr(whatsmeow_device.jid, '.')) || ':0' +) +` + +func upgradeV2(tx *sql.Tx, container *Container) error { + _, err := tx.Exec("ALTER TABLE whatsmeow_device ADD COLUMN adv_account_sig_key bytea CHECK ( length(adv_account_sig_key) = 32 )") + if err != nil { + return err + } + if container.dialect == "postgres" || container.dialect == "pgx" { + _, err = tx.Exec(fillSigKeyPostgres) + } else { + _, err = tx.Exec(fillSigKeySQLite) + } + return err +} + +func upgradeV3(tx *sql.Tx, container *Container) error { + _, err := tx.Exec(`CREATE TABLE whatsmeow_message_secrets ( + our_jid TEXT, + chat_jid TEXT, + sender_jid TEXT, + message_id TEXT, + key bytea NOT NULL, + + PRIMARY KEY (our_jid, chat_jid, sender_jid, message_id), + FOREIGN KEY (our_jid) REFERENCES whatsmeow_device(jid) ON DELETE CASCADE ON UPDATE CASCADE + )`) + return err +} + +func upgradeV4(tx *sql.Tx, container *Container) error { + _, err := tx.Exec(`CREATE TABLE whatsmeow_privacy_tokens ( + our_jid TEXT, + their_jid TEXT, + token bytea NOT NULL, + timestamp BIGINT NOT NULL, + PRIMARY KEY (our_jid, their_jid) + )`) + return err +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/store/store.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/store/store.go new file mode 100644 index 0000000..36a6dce --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/store/store.go @@ -0,0 +1,176 @@ +// Copyright (c) 2022 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +// Package store contains interfaces for storing data needed for WhatsApp multidevice. +package store + +import ( + "fmt" + "time" + + waProto "go.mau.fi/whatsmeow/binary/proto" + "go.mau.fi/whatsmeow/types" + "go.mau.fi/whatsmeow/util/keys" + waLog "go.mau.fi/whatsmeow/util/log" +) + +type IdentityStore interface { + PutIdentity(address string, key [32]byte) error + DeleteAllIdentities(phone string) error + DeleteIdentity(address string) error + IsTrustedIdentity(address string, key [32]byte) (bool, error) +} + +type SessionStore interface { + GetSession(address string) ([]byte, error) + HasSession(address string) (bool, error) + PutSession(address string, session []byte) error + DeleteAllSessions(phone string) error + DeleteSession(address string) error +} + +type PreKeyStore interface { + GetOrGenPreKeys(count uint32) ([]*keys.PreKey, error) + GenOnePreKey() (*keys.PreKey, error) + GetPreKey(id uint32) (*keys.PreKey, error) + RemovePreKey(id uint32) error + MarkPreKeysAsUploaded(upToID uint32) error + UploadedPreKeyCount() (int, error) +} + +type SenderKeyStore interface { + PutSenderKey(group, user string, session []byte) error + GetSenderKey(group, user string) ([]byte, error) +} + +type AppStateSyncKey struct { + Data []byte + Fingerprint []byte + Timestamp int64 +} + +type AppStateSyncKeyStore interface { + PutAppStateSyncKey(id []byte, key AppStateSyncKey) error + GetAppStateSyncKey(id []byte) (*AppStateSyncKey, error) +} + +type AppStateMutationMAC struct { + IndexMAC []byte + ValueMAC []byte +} + +type AppStateStore interface { + PutAppStateVersion(name string, version uint64, hash [128]byte) error + GetAppStateVersion(name string) (uint64, [128]byte, error) + DeleteAppStateVersion(name string) error + + PutAppStateMutationMACs(name string, version uint64, mutations []AppStateMutationMAC) error + DeleteAppStateMutationMACs(name string, indexMACs [][]byte) error + GetAppStateMutationMAC(name string, indexMAC []byte) (valueMAC []byte, err error) +} + +type ContactEntry struct { + JID types.JID + FirstName string + FullName string +} + +type ContactStore interface { + PutPushName(user types.JID, pushName string) (bool, string, error) + PutBusinessName(user types.JID, businessName string) (bool, string, error) + PutContactName(user types.JID, fullName, firstName string) error + PutAllContactNames(contacts []ContactEntry) error + GetContact(user types.JID) (types.ContactInfo, error) + GetAllContacts() (map[types.JID]types.ContactInfo, error) +} + +type ChatSettingsStore interface { + PutMutedUntil(chat types.JID, mutedUntil time.Time) error + PutPinned(chat types.JID, pinned bool) error + PutArchived(chat types.JID, archived bool) error + GetChatSettings(chat types.JID) (types.LocalChatSettings, error) +} + +type DeviceContainer interface { + PutDevice(store *Device) error + DeleteDevice(store *Device) error +} + +type MessageSecretInsert struct { + Chat types.JID + Sender types.JID + ID types.MessageID + Secret []byte +} + +type MsgSecretStore interface { + PutMessageSecrets([]MessageSecretInsert) error + PutMessageSecret(chat, sender types.JID, id types.MessageID, secret []byte) error + GetMessageSecret(chat, sender types.JID, id types.MessageID) ([]byte, error) +} + +type PrivacyToken struct { + User types.JID + Token []byte + Timestamp time.Time +} + +type PrivacyTokenStore interface { + PutPrivacyTokens(tokens ...PrivacyToken) error + GetPrivacyToken(user types.JID) (*PrivacyToken, error) +} + +type Device struct { + Log waLog.Logger + + NoiseKey *keys.KeyPair + IdentityKey *keys.KeyPair + SignedPreKey *keys.PreKey + RegistrationID uint32 + AdvSecretKey []byte + + ID *types.JID + Account *waProto.ADVSignedDeviceIdentity + Platform string + BusinessName string + PushName string + + Initialized bool + Identities IdentityStore + Sessions SessionStore + PreKeys PreKeyStore + SenderKeys SenderKeyStore + AppStateKeys AppStateSyncKeyStore + AppState AppStateStore + Contacts ContactStore + ChatSettings ChatSettingsStore + MsgSecrets MsgSecretStore + PrivacyTokens PrivacyTokenStore + Container DeviceContainer + + DatabaseErrorHandler func(device *Device, action string, attemptIndex int, err error) (retry bool) +} + +func (device *Device) handleDatabaseError(attemptIndex int, err error, action string, args ...interface{}) bool { + if device.DatabaseErrorHandler != nil { + return device.DatabaseErrorHandler(device, fmt.Sprintf(action, args...), attemptIndex, err) + } + device.Log.Errorf("Failed to %s: %v", fmt.Sprintf(action, args...), err) + return false +} + +func (device *Device) Save() error { + return device.Container.PutDevice(device) +} + +func (device *Device) Delete() error { + err := device.Container.DeleteDevice(device) + if err != nil { + return err + } + device.ID = nil + return nil +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/types/call.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/types/call.go new file mode 100644 index 0000000..cd69f24 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/types/call.go @@ -0,0 +1,21 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package types + +import "time" + +type BasicCallMeta struct { + From JID + Timestamp time.Time + CallCreator JID + CallID string +} + +type CallRemoteMeta struct { + RemotePlatform string // The platform of the caller's WhatsApp client + RemoteVersion string // Version of the caller's WhatsApp client +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/types/events/appstate.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/types/events/appstate.go new file mode 100644 index 0000000..d462d6f --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/types/events/appstate.go @@ -0,0 +1,127 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package events + +import ( + "time" + + "go.mau.fi/whatsmeow/appstate" + waProto "go.mau.fi/whatsmeow/binary/proto" + "go.mau.fi/whatsmeow/types" +) + +// Contact is emitted when an entry in the user's contact list is modified from another device. +type Contact struct { + JID types.JID // The contact who was modified. + Timestamp time.Time // The time when the modification happened.' + + Action *waProto.ContactAction // The new contact info. +} + +// PushName is emitted when a message is received with a different push name than the previous value cached for the same user. +type PushName struct { + JID types.JID // The user whose push name changed. + Message *types.MessageInfo // The message where this change was first noticed. + OldPushName string // The previous push name from the local cache. + NewPushName string // The new push name that was included in the message. +} + +// BusinessName is emitted when a message is received with a different verified business name than the previous value cached for the same user. +type BusinessName struct { + JID types.JID + Message *types.MessageInfo // This is only present if the change was detected in a message. + OldBusinessName string + NewBusinessName string +} + +// Pin is emitted when a chat is pinned or unpinned from another device. +type Pin struct { + JID types.JID // The chat which was pinned or unpinned. + Timestamp time.Time // The time when the (un)pinning happened. + + Action *waProto.PinAction // Whether the chat is now pinned or not. +} + +// Star is emitted when a message is starred or unstarred from another device. +type Star struct { + ChatJID types.JID // The chat where the message was pinned. + SenderJID types.JID // In group chats, the user who sent the message (except if the message was sent by the user). + IsFromMe bool // Whether the message was sent by the user. + MessageID string // The message which was starred or unstarred. + Timestamp time.Time // The time when the (un)starring happened. + + Action *waProto.StarAction // Whether the message is now starred or not. +} + +// DeleteForMe is emitted when a message is deleted (for the current user only) from another device. +type DeleteForMe struct { + ChatJID types.JID // The chat where the message was deleted. + SenderJID types.JID // In group chats, the user who sent the message (except if the message was sent by the user). + IsFromMe bool // Whether the message was sent by the user. + MessageID string // The message which was deleted. + Timestamp time.Time // The time when the deletion happened. + + Action *waProto.DeleteMessageForMeAction // Additional information for the deletion. +} + +// Mute is emitted when a chat is muted or unmuted from another device. +type Mute struct { + JID types.JID // The chat which was muted or unmuted. + Timestamp time.Time // The time when the (un)muting happened. + + Action *waProto.MuteAction // The current mute status of the chat. +} + +// Archive is emitted when a chat is archived or unarchived from another device. +type Archive struct { + JID types.JID // The chat which was archived or unarchived. + Timestamp time.Time // The time when the (un)archiving happened. + + Action *waProto.ArchiveChatAction // The current archival status of the chat. +} + +// MarkChatAsRead is emitted when a whole chat is marked as read or unread from another device. +type MarkChatAsRead struct { + JID types.JID // The chat which was marked as read or unread. + Timestamp time.Time // The time when the marking happened. + + Action *waProto.MarkChatAsReadAction // Whether the chat was marked as read or unread, and info about the most recent messages. +} + +// DeleteChat is emitted when a chat is deleted on another device. +type DeleteChat struct { + JID types.JID // The chat which was deleted. + Timestamp time.Time // The time when the deletion happened. + + Action *waProto.DeleteChatAction // Information about the deletion. +} + +// PushNameSetting is emitted when the user's push name is changed from another device. +type PushNameSetting struct { + Timestamp time.Time // The time when the push name was changed. + + Action *waProto.PushNameSetting // The new push name for the user. +} + +// UnarchiveChatsSetting is emitted when the user changes the "Keep chats archived" setting from another device. +type UnarchiveChatsSetting struct { + Timestamp time.Time // The time when the setting was changed. + + Action *waProto.UnarchiveChatsSetting // The new settings. +} + +// AppState is emitted directly for new data received from app state syncing. +// You should generally use the higher-level events like events.Contact and events.Mute. +type AppState struct { + Index []string + *waProto.SyncActionValue +} + +// AppStateSyncComplete is emitted when app state is resynced. +type AppStateSyncComplete struct { + Name appstate.WAPatchName +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/types/events/call.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/types/events/call.go new file mode 100644 index 0000000..3622cb5 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/types/events/call.go @@ -0,0 +1,57 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package events + +import ( + waBinary "go.mau.fi/whatsmeow/binary" + "go.mau.fi/whatsmeow/types" +) + +// CallOffer is emitted when the user receives a call on WhatsApp. +type CallOffer struct { + types.BasicCallMeta + types.CallRemoteMeta + + Data *waBinary.Node // The call offer data +} + +// CallAccept is emitted when a call is accepted on WhatsApp. +type CallAccept struct { + types.BasicCallMeta + types.CallRemoteMeta + + Data *waBinary.Node +} + +// CallOfferNotice is emitted when the user receives a notice of a call on WhatsApp. +// This seems to be primarily for group calls (whereas CallOffer is for 1:1 calls). +type CallOfferNotice struct { + types.BasicCallMeta + + Media string // "audio" or "video" depending on call type + Type string // "group" when it's a group call + + Data *waBinary.Node +} + +// CallRelayLatency is emitted slightly after the user receives a call on WhatsApp. +type CallRelayLatency struct { + types.BasicCallMeta + Data *waBinary.Node +} + +// CallTerminate is emitted when the other party terminates a call on WhatsApp. +type CallTerminate struct { + types.BasicCallMeta + Reason string + Data *waBinary.Node +} + +// UnknownCallEvent is emitted when a call element with unknown content is received. +type UnknownCallEvent struct { + Node *waBinary.Node +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/types/events/events.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/types/events/events.go new file mode 100644 index 0000000..dc8e0ad --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/types/events/events.go @@ -0,0 +1,440 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +// Package events contains all the events that whatsmeow.Client emits to functions registered with AddEventHandler. +package events + +import ( + "fmt" + "time" + + waBinary "go.mau.fi/whatsmeow/binary" + waProto "go.mau.fi/whatsmeow/binary/proto" + "go.mau.fi/whatsmeow/types" +) + +// QR is emitted after connecting when there's no session data in the device store. +// +// The QR codes are available in the Codes slice. You should render the strings as QR codes one by +// one, switching to the next one whenever enough time has passed. WhatsApp web seems to show the +// first code for 60 seconds and all other codes for 20 seconds. +// +// When the QR code has been scanned and pairing is complete, PairSuccess will be emitted. If you +// run out of codes before scanning, the server will close the websocket, and you will have to +// reconnect to get more codes. +type QR struct { + Codes []string +} + +// PairSuccess is emitted after the QR code has been scanned with the phone and the handshake has +// been completed. Note that this is generally followed by a websocket reconnection, so you should +// wait for the Connected before trying to send anything. +type PairSuccess struct { + ID types.JID + BusinessName string + Platform string +} + +// PairError is emitted when a pair-success event is received from the server, but finishing the pairing locally fails. +type PairError struct { + ID types.JID + BusinessName string + Platform string + Error error +} + +// QRScannedWithoutMultidevice is emitted when the pairing QR code is scanned, but the phone didn't have multidevice enabled. +// The same QR code can still be scanned after this event, which means the user can just be told to enable multidevice and re-scan the code. +type QRScannedWithoutMultidevice struct{} + +// Connected is emitted when the client has successfully connected to the WhatsApp servers +// and is authenticated. The user who the client is authenticated as will be in the device store +// at this point, which is why this event doesn't contain any data. +type Connected struct{} + +// KeepAliveTimeout is emitted when the keepalive ping request to WhatsApp web servers times out. +// +// Currently, there's no automatic handling for these, but it's expected that the TCP connection will +// either start working again or notice it's dead on its own eventually. Clients may use this event to +// decide to force a disconnect+reconnect faster. +type KeepAliveTimeout struct { + ErrorCount int + LastSuccess time.Time +} + +// KeepAliveRestored is emitted if the keepalive pings start working again after some KeepAliveTimeout events. +// Note that if the websocket disconnects before the pings start working, this event will not be emitted. +type KeepAliveRestored struct{} + +// LoggedOut is emitted when the client has been unpaired from the phone. +// +// This can happen while connected (stream:error messages) or right after connecting (connect failure messages). +// +// This will not be emitted when the logout is initiated by this client (using Client.LogOut()). +type LoggedOut struct { + // OnConnect is true if the event was triggered by a connect failure message. + // If it's false, the event was triggered by a stream:error message. + OnConnect bool + // If OnConnect is true, then this field contains the reason code. + Reason ConnectFailureReason +} + +// StreamReplaced is emitted when the client is disconnected by another client connecting with the same keys. +// +// This can happen if you accidentally start another process with the same session +// or otherwise try to connect twice with the same session. +type StreamReplaced struct{} + +// TempBanReason is an error code included in temp ban error events. +type TempBanReason int + +const ( + TempBanSentToTooManyPeople TempBanReason = 101 + TempBanBlockedByUsers TempBanReason = 102 + TempBanCreatedTooManyGroups TempBanReason = 103 + TempBanSentTooManySameMessage TempBanReason = 104 + TempBanBroadcastList TempBanReason = 106 +) + +var tempBanReasonMessage = map[TempBanReason]string{ + TempBanSentToTooManyPeople: "you sent too many messages to people who don't have you in their address books", + TempBanBlockedByUsers: "too many people blocked you", + TempBanCreatedTooManyGroups: "you created too many groups with people who don't have you in their address books", + TempBanSentTooManySameMessage: "you sent the same message to too many people", + TempBanBroadcastList: "you sent too many messages to a broadcast list", +} + +// String returns the reason code and a human-readable description of the ban reason. +func (tbr TempBanReason) String() string { + msg, ok := tempBanReasonMessage[tbr] + if !ok { + msg = "you may have violated the terms of service (unknown error)" + } + return fmt.Sprintf("%d: %s", int(tbr), msg) +} + +// TemporaryBan is emitted when there's a connection failure with the ConnectFailureTempBanned reason code. +type TemporaryBan struct { + Code TempBanReason + Expire time.Duration +} + +func (tb *TemporaryBan) String() string { + if tb.Expire == 0 { + return fmt.Sprintf("You've been temporarily banned: %v", tb.Code) + } + return fmt.Sprintf("You've been temporarily banned: %v. The ban expires in %v", tb.Code, tb.Expire) +} + +// ConnectFailureReason is an error code included in connection failure events. +type ConnectFailureReason int + +const ( + ConnectFailureLoggedOut ConnectFailureReason = 401 + ConnectFailureTempBanned ConnectFailureReason = 402 + ConnectFailureMainDeviceGone ConnectFailureReason = 403 + ConnectFailureUnknownLogout ConnectFailureReason = 406 + + ConnectFailureClientOutdated ConnectFailureReason = 405 + ConnectFailureBadUserAgent ConnectFailureReason = 409 + + // 400, 500 and 501 are also existing codes, but the meaning is unknown +) + +var connectFailureReasonMessage = map[ConnectFailureReason]string{ + ConnectFailureLoggedOut: "logged out from another device", + ConnectFailureTempBanned: "account temporarily banned", + ConnectFailureMainDeviceGone: "primary device was logged out", // seems to happen for both bans and switching phones + ConnectFailureUnknownLogout: "logged out for unknown reason", + ConnectFailureClientOutdated: "client is out of date", + ConnectFailureBadUserAgent: "client user agent was rejected", +} + +// IsLoggedOut returns true if the client should delete session data due to this connect failure. +func (cfr ConnectFailureReason) IsLoggedOut() bool { + return cfr == ConnectFailureLoggedOut || cfr == ConnectFailureMainDeviceGone || cfr == ConnectFailureUnknownLogout +} + +// String returns the reason code and a short human-readable description of the error. +func (cfr ConnectFailureReason) String() string { + msg, ok := connectFailureReasonMessage[cfr] + if !ok { + msg = "unknown error" + } + return fmt.Sprintf("%d: %s", int(cfr), msg) +} + +// ConnectFailure is emitted when the WhatsApp server sends a <failure> node with an unknown reason. +// +// Known reasons are handled internally and emitted as different events (e.g. LoggedOut and TemporaryBan). +type ConnectFailure struct { + Reason ConnectFailureReason + Raw *waBinary.Node +} + +// ClientOutdated is emitted when the WhatsApp server rejects the connection with the ConnectFailureClientOutdated code. +type ClientOutdated struct{} + +// StreamError is emitted when the WhatsApp server sends a <stream:error> node with an unknown code. +// +// Known codes are handled internally and emitted as different events (e.g. LoggedOut). +type StreamError struct { + Code string + Raw *waBinary.Node +} + +// Disconnected is emitted when the websocket is closed by the server. +type Disconnected struct{} + +// HistorySync is emitted when the phone has sent a blob of historical messages. +type HistorySync struct { + Data *waProto.HistorySync +} + +// UndecryptableMessage is emitted when receiving a new message that failed to decrypt. +// +// The library will automatically ask the sender to retry. If the sender resends the message, +// and it's decryptable, then it will be emitted as a normal Message event. +// +// The UndecryptableMessage event may also be repeated if the resent message is also undecryptable. +type UndecryptableMessage struct { + Info types.MessageInfo + + // IsUnavailable is true if the recipient device didn't send a ciphertext to this device at all + // (as opposed to sending a ciphertext, but the ciphertext not being decryptable). + IsUnavailable bool +} + +// Message is emitted when receiving a new message. +type Message struct { + Info types.MessageInfo // Information about the message like the chat and sender IDs + Message *waProto.Message // The actual message struct + + IsEphemeral bool // True if the message was unwrapped from an EphemeralMessage + IsViewOnce bool // True if the message was unwrapped from a ViewOnceMessage or ViewOnceMessageV2 + IsViewOnceV2 bool // True if the message was unwrapped from a ViewOnceMessage + IsDocumentWithCaption bool // True if the message was unwrapped from a DocumentWithCaptionMessage + IsEdit bool // True if the message was unwrapped from an EditedMessage + + // The raw message struct. This is the raw unmodified data, which means the actual message might + // be wrapped in DeviceSentMessage, EphemeralMessage or ViewOnceMessage. + RawMessage *waProto.Message +} + +// UnwrapRaw fills the Message, IsEphemeral and IsViewOnce fields based on the raw message in the RawMessage field. +func (evt *Message) UnwrapRaw() *Message { + evt.Message = evt.RawMessage + if evt.Message.GetDeviceSentMessage().GetMessage() != nil { + evt.Info.DeviceSentMeta = &types.DeviceSentMeta{ + DestinationJID: evt.Message.GetDeviceSentMessage().GetDestinationJid(), + Phash: evt.Message.GetDeviceSentMessage().GetPhash(), + } + evt.Message = evt.Message.GetDeviceSentMessage().GetMessage() + } + if evt.Message.GetEphemeralMessage().GetMessage() != nil { + evt.Message = evt.Message.GetEphemeralMessage().GetMessage() + evt.IsEphemeral = true + } + if evt.Message.GetViewOnceMessage().GetMessage() != nil { + evt.Message = evt.Message.GetViewOnceMessage().GetMessage() + evt.IsViewOnce = true + } + if evt.Message.GetViewOnceMessageV2().GetMessage() != nil { + evt.Message = evt.Message.GetViewOnceMessageV2().GetMessage() + evt.IsViewOnce = true + evt.IsViewOnceV2 = true + } + if evt.Message.GetDocumentWithCaptionMessage().GetMessage() != nil { + evt.Message = evt.Message.GetDocumentWithCaptionMessage().GetMessage() + evt.IsDocumentWithCaption = true + } + if evt.Message.GetEditedMessage().GetMessage() != nil { + evt.Message = evt.Message.GetEditedMessage().GetMessage() + evt.IsEdit = true + } + return evt +} + +// ReceiptType represents the type of a Receipt event. +type ReceiptType string + +const ( + // ReceiptTypeDelivered means the message was delivered to the device (but the user might not have noticed). + ReceiptTypeDelivered ReceiptType = "" + // ReceiptTypeSender is sent by your other devices when a message you sent is delivered to them. + ReceiptTypeSender ReceiptType = "sender" + // ReceiptTypeRetry means the message was delivered to the device, but decrypting the message failed. + ReceiptTypeRetry ReceiptType = "retry" + // ReceiptTypeRead means the user opened the chat and saw the message. + ReceiptTypeRead ReceiptType = "read" + // ReceiptTypeReadSelf means the current user read a message from a different device, and has read receipts disabled in privacy settings. + ReceiptTypeReadSelf ReceiptType = "read-self" + // ReceiptTypePlayed means the user opened a view-once media message. + // + // This is dispatched for both incoming and outgoing messages when played. If the current user opened the media, + // it means the media should be removed from all devices. If a recipient opened the media, it's just a notification + // for the sender that the media was viewed. + ReceiptTypePlayed ReceiptType = "played" +) + +// GoString returns the name of the Go constant for the ReceiptType value. +func (rt ReceiptType) GoString() string { + switch rt { + case ReceiptTypeRead: + return "events.ReceiptTypeRead" + case ReceiptTypeReadSelf: + return "events.ReceiptTypeReadSelf" + case ReceiptTypeDelivered: + return "events.ReceiptTypeDelivered" + case ReceiptTypePlayed: + return "events.ReceiptTypePlayed" + default: + return fmt.Sprintf("events.ReceiptType(%#v)", string(rt)) + } +} + +// Receipt is emitted when an outgoing message is delivered to or read by another user, or when another device reads an incoming message. +// +// N.B. WhatsApp on Android sends message IDs from newest message to oldest, but WhatsApp on iOS sends them in the opposite order (oldest first). +type Receipt struct { + types.MessageSource + MessageIDs []types.MessageID + Timestamp time.Time + Type ReceiptType +} + +// ChatPresence is emitted when a chat state update (also known as typing notification) is received. +// +// Note that WhatsApp won't send you these updates unless you mark yourself as online: +// +// client.SendPresence(types.PresenceAvailable) +type ChatPresence struct { + types.MessageSource + State types.ChatPresence // The current state, either composing or paused + Media types.ChatPresenceMedia // When composing, the type of message +} + +// Presence is emitted when a presence update is received. +// +// Note that WhatsApp only sends you presence updates for individual users after you subscribe to them: +// +// client.SubscribePresence(user JID) +type Presence struct { + // The user whose presence event this is + From types.JID + // True if the user is now offline + Unavailable bool + // The time when the user was last online. This may be the zero value if the user has hid their last seen time. + LastSeen time.Time +} + +// JoinedGroup is emitted when you join or are added to a group. +type JoinedGroup struct { + Reason string // If the event was triggered by you using an invite link, this will be "invite". + Type string // "new" if it's a newly created group. + CreateKey types.MessageID // If you created the group, this is the same message ID you passed to CreateGroup. + types.GroupInfo +} + +// GroupInfo is emitted when the metadata of a group changes. +type GroupInfo struct { + JID types.JID // The group ID in question + Notify string // Seems like a top-level type for the invite + Sender *types.JID // The user who made the change. Doesn't seem to be present when notify=invite + Timestamp time.Time // The time when the change occurred + + Name *types.GroupName // Group name change + Topic *types.GroupTopic // Group topic (description) change + Locked *types.GroupLocked // Group locked status change (can only admins edit group info?) + Announce *types.GroupAnnounce // Group announce status change (can only admins send messages?) + Ephemeral *types.GroupEphemeral // Disappearing messages change + + Delete *types.GroupDelete + + Link *types.GroupLinkChange + Unlink *types.GroupLinkChange + + NewInviteLink *string // Group invite link change + + PrevParticipantVersionID string + ParticipantVersionID string + + JoinReason string // This will be "invite" if the user joined via invite link + + Join []types.JID // Users who joined or were added the group + Leave []types.JID // Users who left or were removed from the group + + Promote []types.JID // Users who were promoted to admins + Demote []types.JID // Users who were demoted to normal users + + UnknownChanges []*waBinary.Node +} + +// Picture is emitted when a user's profile picture or group's photo is changed. +// +// You can use Client.GetProfilePictureInfo to get the actual image URL after this event. +type Picture struct { + JID types.JID // The user or group ID where the picture was changed. + Author types.JID // The user who changed the picture. + Timestamp time.Time // The timestamp when the picture was changed. + Remove bool // True if the picture was removed. + PictureID string // The new picture ID if it was not removed. +} + +// IdentityChange is emitted when another user changes their primary device. +type IdentityChange struct { + JID types.JID + Timestamp time.Time + + // Implicit will be set to true if the event was triggered by an untrusted identity error, + // rather than an identity change notification from the server. + Implicit bool +} + +// PrivacySettings is emitted when the user changes their privacy settings. +type PrivacySettings struct { + NewSettings types.PrivacySettings + GroupAddChanged bool + LastSeenChanged bool + StatusChanged bool + ProfileChanged bool + ReadReceiptsChanged bool +} + +// OfflineSyncPreview is emitted right after connecting if the server is going to send events that the client missed during downtime. +type OfflineSyncPreview struct { + Total int + + AppDataChanges int + Messages int + Notifications int + Receipts int +} + +// OfflineSyncCompleted is emitted after the server has finished sending missed events. +type OfflineSyncCompleted struct { + Count int +} + +type MediaRetryError struct { + Code int +} + +// MediaRetry is emitted when the phone sends a response to a media retry request. +type MediaRetry struct { + Ciphertext []byte + IV []byte + + // Sometimes there's an unencrypted media retry error. In these cases, Ciphertext and IV will be nil. + Error *MediaRetryError + + Timestamp time.Time // The time of the response. + + MessageID types.MessageID // The ID of the message. + ChatID types.JID // The chat ID where the message was sent. + SenderID types.JID // The user who sent the message. Only present in groups. + FromMe bool // Whether the message was sent by the current user or someone else. +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/types/group.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/types/group.go new file mode 100644 index 0000000..eaf21ce --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/types/group.go @@ -0,0 +1,135 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package types + +import ( + "time" +) + +type GroupMemberAddMode string + +const ( + GroupMemberAddModeAdmin GroupMemberAddMode = "admin_add" +) + +// GroupInfo contains basic information about a group chat on WhatsApp. +type GroupInfo struct { + JID JID + OwnerJID JID + + GroupName + GroupTopic + GroupLocked + GroupAnnounce + GroupEphemeral + + GroupParent + GroupLinkedParent + GroupIsDefaultSub + + GroupCreated time.Time + + ParticipantVersionID string + Participants []GroupParticipant + + MemberAddMode GroupMemberAddMode +} + +type GroupParent struct { + IsParent bool + DefaultMembershipApprovalMode string // request_required +} + +type GroupLinkedParent struct { + LinkedParentJID JID +} + +type GroupIsDefaultSub struct { + IsDefaultSubGroup bool +} + +// GroupName contains the name of a group along with metadata of who set it and when. +type GroupName struct { + Name string + NameSetAt time.Time + NameSetBy JID +} + +// GroupTopic contains the topic (description) of a group along with metadata of who set it and when. +type GroupTopic struct { + Topic string + TopicID string + TopicSetAt time.Time + TopicSetBy JID + TopicDeleted bool +} + +// GroupLocked specifies whether the group info can only be edited by admins. +type GroupLocked struct { + IsLocked bool +} + +// GroupAnnounce specifies whether only admins can send messages in the group. +type GroupAnnounce struct { + IsAnnounce bool + AnnounceVersionID string +} + +// GroupParticipant contains info about a participant of a WhatsApp group chat. +type GroupParticipant struct { + JID JID + IsAdmin bool + IsSuperAdmin bool + + // When creating groups, adding some participants may fail. + // In such cases, the error code will be here. + Error int + AddRequest *GroupParticipantAddRequest +} + +type GroupParticipantAddRequest struct { + Code string + Expiration time.Time +} + +// GroupEphemeral contains the group's disappearing messages settings. +type GroupEphemeral struct { + IsEphemeral bool + DisappearingTimer uint32 +} + +type GroupDelete struct { + Deleted bool + DeleteReason string +} + +type GroupLinkChangeType string + +const ( + GroupLinkChangeTypeParent GroupLinkChangeType = "parent_group" + GroupLinkChangeTypeSub GroupLinkChangeType = "sub_group" + GroupLinkChangeTypeSibling GroupLinkChangeType = "sibling_group" +) + +type GroupUnlinkReason string + +const ( + GroupUnlinkReasonDefault GroupUnlinkReason = "unlink_group" + GroupUnlinkReasonDelete GroupUnlinkReason = "delete_parent" +) + +type GroupLinkTarget struct { + JID JID + GroupName + GroupIsDefaultSub +} + +type GroupLinkChange struct { + Type GroupLinkChangeType + UnlinkReason GroupUnlinkReason + Group GroupLinkTarget +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/types/jid.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/types/jid.go new file mode 100644 index 0000000..4f54f03 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/types/jid.go @@ -0,0 +1,208 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +// Package types contains various structs and other types used by whatsmeow. +package types + +import ( + "database/sql" + "database/sql/driver" + "fmt" + "strconv" + "strings" + + signalProtocol "go.mau.fi/libsignal/protocol" +) + +// Known JID servers on WhatsApp +const ( + DefaultUserServer = "s.whatsapp.net" + GroupServer = "g.us" + LegacyUserServer = "c.us" + BroadcastServer = "broadcast" +) + +// Some JIDs that are contacted often. +var ( + EmptyJID = JID{} + GroupServerJID = NewJID("", GroupServer) + ServerJID = NewJID("", DefaultUserServer) + BroadcastServerJID = NewJID("", BroadcastServer) + StatusBroadcastJID = NewJID("status", BroadcastServer) + PSAJID = NewJID("0", LegacyUserServer) + OfficialBusinessJID = NewJID("16505361212", LegacyUserServer) +) + +// MessageID is the internal ID of a WhatsApp message. +type MessageID = string + +// JID represents a WhatsApp user ID. +// +// There are two types of JIDs: regular JID pairs (user and server) and AD-JIDs (user, agent and device). +// AD JIDs are only used to refer to specific devices of users, so the server is always s.whatsapp.net (DefaultUserServer). +// Regular JIDs can be used for entities on any servers (users, groups, broadcasts). +type JID struct { + User string + Agent uint8 + Device uint8 + Server string + AD bool +} + +// UserInt returns the user as an integer. This is only safe to run on normal users, not on groups or broadcast lists. +func (jid JID) UserInt() uint64 { + number, _ := strconv.ParseUint(jid.User, 10, 64) + return number +} + +// ToNonAD returns a version of the JID struct that doesn't have the agent and device set. +func (jid JID) ToNonAD() JID { + if jid.AD { + return JID{ + User: jid.User, + Server: DefaultUserServer, + } + } else { + return jid + } +} + +// SignalAddress returns the Signal protocol address for the user. +func (jid JID) SignalAddress() *signalProtocol.SignalAddress { + user := jid.User + if jid.Agent != 0 { + user = fmt.Sprintf("%s_%d", jid.User, jid.Agent) + } + return signalProtocol.NewSignalAddress(user, uint32(jid.Device)) +} + +// IsBroadcastList returns true if the JID is a broadcast list, but not the status broadcast. +func (jid JID) IsBroadcastList() bool { + return jid.Server == BroadcastServer && jid.User != StatusBroadcastJID.User +} + +// NewADJID creates a new AD JID. +func NewADJID(user string, agent, device uint8) JID { + return JID{ + User: user, + Agent: agent, + Device: device, + Server: DefaultUserServer, + AD: true, + } +} + +func parseADJID(user string) (JID, error) { + var fullJID JID + fullJID.AD = true + fullJID.Server = DefaultUserServer + + dotIndex := strings.IndexRune(user, '.') + colonIndex := strings.IndexRune(user, ':') + if dotIndex < 0 || colonIndex < 0 || colonIndex+1 <= dotIndex { + return fullJID, fmt.Errorf("failed to parse ADJID: missing separators") + } + + fullJID.User = user[:dotIndex] + agent, err := strconv.Atoi(user[dotIndex+1 : colonIndex]) + if err != nil { + return fullJID, fmt.Errorf("failed to parse agent from JID: %w", err) + } else if agent < 0 || agent > 255 { + return fullJID, fmt.Errorf("failed to parse agent from JID: invalid value (%d)", agent) + } + device, err := strconv.Atoi(user[colonIndex+1:]) + if err != nil { + return fullJID, fmt.Errorf("failed to parse device from JID: %w", err) + } else if device < 0 || device > 255 { + return fullJID, fmt.Errorf("failed to parse device from JID: invalid value (%d)", device) + } + fullJID.Agent = uint8(agent) + fullJID.Device = uint8(device) + return fullJID, nil +} + +// ParseJID parses a JID out of the given string. It supports both regular and AD JIDs. +func ParseJID(jid string) (JID, error) { + parts := strings.Split(jid, "@") + if len(parts) == 1 { + return NewJID("", parts[0]), nil + } else if strings.ContainsRune(parts[0], ':') && strings.ContainsRune(parts[0], '.') && parts[1] == DefaultUserServer { + return parseADJID(parts[0]) + } + return NewJID(parts[0], parts[1]), nil +} + +// NewJID creates a new regular JID. +func NewJID(user, server string) JID { + return JID{ + User: user, + Server: server, + } +} + +// String converts the JID to a string representation. +// The output string can be parsed with ParseJID, except for JIDs with no User part specified. +func (jid JID) String() string { + if jid.AD { + return fmt.Sprintf("%s.%d:%d@%s", jid.User, jid.Agent, jid.Device, jid.Server) + } else if len(jid.User) > 0 { + return fmt.Sprintf("%s@%s", jid.User, jid.Server) + } else { + return jid.Server + } +} + +// MarshalText implements encoding.TextMarshaler for JID +func (jid JID) MarshalText() ([]byte, error) { + return []byte(jid.String()), nil +} + +// UnmarshalText implements encoding.TextUnmarshaler for JID +func (jid *JID) UnmarshalText(val []byte) error { + out, err := ParseJID(string(val)) + if err != nil { + return err + } + *jid = out + return nil +} + +// IsEmpty returns true if the JID has no server (which is required for all JIDs). +func (jid JID) IsEmpty() bool { + return len(jid.Server) == 0 +} + +var _ sql.Scanner = (*JID)(nil) + +// Scan scans the given SQL value into this JID. +func (jid *JID) Scan(src interface{}) error { + if src == nil { + return nil + } + var out JID + var err error + switch val := src.(type) { + case string: + out, err = ParseJID(val) + case []byte: + out, err = ParseJID(string(val)) + default: + err = fmt.Errorf("unsupported type %T for scanning JID", val) + } + if err != nil { + return err + } + *jid = out + return nil +} + +// Value returns the string representation of the JID as a value that the SQL package can use. +func (jid JID) Value() (driver.Value, error) { + if len(jid.Server) == 0 { + return nil, nil + } + return jid.String(), nil +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/types/message.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/types/message.go new file mode 100644 index 0000000..0681268 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/types/message.go @@ -0,0 +1,61 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package types + +import ( + "fmt" + "time" +) + +// MessageSource contains basic sender and chat information about a message. +type MessageSource struct { + Chat JID // The chat where the message was sent. + Sender JID // The user who sent the message. + IsFromMe bool // Whether the message was sent by the current user instead of someone else. + IsGroup bool // Whether the chat is a group chat or broadcast list. + + // When sending a read receipt to a broadcast list message, the Chat is the broadcast list + // and Sender is you, so this field contains the recipient of the read receipt. + BroadcastListOwner JID +} + +// IsIncomingBroadcast returns true if the message was sent to a broadcast list instead of directly to the user. +// +// If this is true, it means the message shows up in the direct chat with the Sender. +func (ms *MessageSource) IsIncomingBroadcast() bool { + return (!ms.IsFromMe || !ms.BroadcastListOwner.IsEmpty()) && ms.Chat.IsBroadcastList() +} + +// DeviceSentMeta contains metadata from messages sent by another one of the user's own devices. +type DeviceSentMeta struct { + DestinationJID string // The destination user. This should match the MessageInfo.Recipient field. + Phash string +} + +// MessageInfo contains metadata about an incoming message. +type MessageInfo struct { + MessageSource + ID string + Type string + PushName string + Timestamp time.Time + Category string + Multicast bool + MediaType string + + VerifiedName *VerifiedName + DeviceSentMeta *DeviceSentMeta // Metadata for direct messages sent from another one of the user's own devices. +} + +// SourceString returns a log-friendly representation of who sent the message and where. +func (ms *MessageSource) SourceString() string { + if ms.Sender != ms.Chat { + return fmt.Sprintf("%s in %s", ms.Sender, ms.Chat) + } else { + return ms.Chat.String() + } +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/types/presence.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/types/presence.go new file mode 100644 index 0000000..a59f742 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/types/presence.go @@ -0,0 +1,28 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package types + +type Presence string + +const ( + PresenceAvailable Presence = "available" + PresenceUnavailable Presence = "unavailable" +) + +type ChatPresence string + +const ( + ChatPresenceComposing ChatPresence = "composing" + ChatPresencePaused ChatPresence = "paused" +) + +type ChatPresenceMedia string + +const ( + ChatPresenceMediaText ChatPresenceMedia = "" + ChatPresenceMediaAudio ChatPresenceMedia = "audio" +) diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/types/user.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/types/user.go new file mode 100644 index 0000000..6daa06b --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/types/user.go @@ -0,0 +1,123 @@ +// Copyright (c) 2022 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package types + +import ( + "time" + + waProto "go.mau.fi/whatsmeow/binary/proto" +) + +// VerifiedName contains verified WhatsApp business details. +type VerifiedName struct { + Certificate *waProto.VerifiedNameCertificate + Details *waProto.VerifiedNameCertificate_Details +} + +// UserInfo contains info about a WhatsApp user. +type UserInfo struct { + VerifiedName *VerifiedName + Status string + PictureID string + Devices []JID +} + +// ProfilePictureInfo contains the ID and URL for a WhatsApp user's profile picture or group's photo. +type ProfilePictureInfo struct { + URL string // The full URL for the image, can be downloaded with a simple HTTP request. + ID string // The ID of the image. This is the same as UserInfo.PictureID. + Type string // The type of image. Known types include "image" (full res) and "preview" (thumbnail). + + DirectPath string // The path to the image, probably not very useful +} + +// ContactInfo contains the cached names of a WhatsApp user. +type ContactInfo struct { + Found bool + + FirstName string + FullName string + PushName string + BusinessName string +} + +// LocalChatSettings contains the cached local settings for a chat. +type LocalChatSettings struct { + Found bool + + MutedUntil time.Time + Pinned bool + Archived bool +} + +// IsOnWhatsAppResponse contains information received in response to checking if a phone number is on WhatsApp. +type IsOnWhatsAppResponse struct { + Query string // The query string used + JID JID // The canonical user ID + IsIn bool // Whether the phone is registered or not. + + VerifiedName *VerifiedName // If the phone is a business, the verified business details. +} + +// BusinessMessageLinkTarget contains the info that is found using a business message link (see Client.ResolveBusinessMessageLink) +type BusinessMessageLinkTarget struct { + JID JID // The JID of the business. + + PushName string // The notify / push name of the business. + VerifiedName string // The verified business name. + IsSigned bool // Some boolean, seems to be true? + VerifiedLevel string // I guess the level of verification, starting from "unknown". + + Message string // The message that WhatsApp clients will pre-fill in the input box when clicking the link. +} + +// ContactQRLinkTarget contains the info that is found using a contact QR link (see Client.ResolveContactQRLink) +type ContactQRLinkTarget struct { + JID JID // The JID of the user. + Type string // Might always be "contact". + PushName string // The notify / push name of the user. +} + +// PrivacySetting is an individual setting value in the user's privacy settings. +type PrivacySetting string + +// Possible privacy setting values. +const ( + PrivacySettingUndefined PrivacySetting = "" + PrivacySettingAll PrivacySetting = "all" + PrivacySettingContacts PrivacySetting = "contacts" + PrivacySettingNone PrivacySetting = "none" +) + +// PrivacySettings contains the user's privacy settings. +type PrivacySettings struct { + GroupAdd PrivacySetting + LastSeen PrivacySetting + Status PrivacySetting + Profile PrivacySetting + ReadReceipts PrivacySetting +} + +// StatusPrivacyType is the type of list in StatusPrivacy. +type StatusPrivacyType string + +const ( + // StatusPrivacyTypeContacts means statuses are sent to all contacts. + StatusPrivacyTypeContacts StatusPrivacyType = "contacts" + // StatusPrivacyTypeBlacklist means statuses are sent to all contacts, except the ones on the list. + StatusPrivacyTypeBlacklist StatusPrivacyType = "blacklist" + // StatusPrivacyTypeWhitelist means statuses are only sent to users on the list. + StatusPrivacyTypeWhitelist StatusPrivacyType = "whitelist" +) + +// StatusPrivacy contains the settings for who to send status messages to by default. +type StatusPrivacy struct { + Type StatusPrivacyType + List []JID + + IsDefault bool +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/update.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/update.go new file mode 100644 index 0000000..00e35bf --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/update.go @@ -0,0 +1,81 @@ +// Copyright (c) 2022 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package whatsmeow + +import ( + "encoding/json" + "fmt" + "io" + "net/http" + "net/url" + + "go.mau.fi/whatsmeow/socket" + "go.mau.fi/whatsmeow/store" +) + +// CheckUpdateResponse is the data returned by CheckUpdate. +type CheckUpdateResponse struct { + IsBroken bool + IsBelowSoft bool + IsBelowHard bool + CurrentVersion string + + ParsedVersion store.WAVersionContainer `json:"-"` +} + +// CheckUpdateURL is the base URL to check for WhatsApp web updates. +const CheckUpdateURL = "https://web.whatsapp.com/check-update" + +// CheckUpdate asks the WhatsApp servers if there is an update available +// (using the HTTP client and proxy settings of this whatsmeow Client instance). +func (cli *Client) CheckUpdate() (respData CheckUpdateResponse, err error) { + return CheckUpdate(cli.http) +} + +// CheckUpdate asks the WhatsApp servers if there is an update available. +func CheckUpdate(httpClient *http.Client) (respData CheckUpdateResponse, err error) { + var reqURL *url.URL + reqURL, err = url.Parse(CheckUpdateURL) + if err != nil { + err = fmt.Errorf("failed to parse check update URL: %w", err) + return + } + q := reqURL.Query() + q.Set("version", store.GetWAVersion().String()) + q.Set("platform", "web") + reqURL.RawQuery = q.Encode() + var req *http.Request + req, err = http.NewRequest(http.MethodGet, reqURL.String(), nil) + if err != nil { + err = fmt.Errorf("failed to prepare request: %w", err) + return + } + req.Header.Set("Origin", socket.Origin) + req.Header.Set("Referer", socket.Origin+"/") + var resp *http.Response + resp, err = httpClient.Do(req) + if err != nil { + err = fmt.Errorf("failed to send request: %w", err) + return + } + defer resp.Body.Close() + if resp.StatusCode != 200 { + body, _ := io.ReadAll(resp.Body) + err = fmt.Errorf("unexpected response with status %d: %s", resp.StatusCode, body) + return + } + err = json.NewDecoder(resp.Body).Decode(&respData) + if err != nil { + err = fmt.Errorf("failed to decode response body (status %d): %w", resp.StatusCode, err) + return + } + respData.ParsedVersion, err = store.ParseVersion(respData.CurrentVersion) + if err != nil { + err = fmt.Errorf("failed to parse version string: %w", err) + } + return +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/upload.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/upload.go new file mode 100644 index 0000000..c72025f --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/upload.go @@ -0,0 +1,134 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package whatsmeow + +import ( + "bytes" + "context" + "crypto/hmac" + "crypto/rand" + "crypto/sha256" + "encoding/base64" + "encoding/json" + "fmt" + "net/http" + "net/url" + + "go.mau.fi/whatsmeow/socket" + "go.mau.fi/whatsmeow/util/cbcutil" +) + +// UploadResponse contains the data from the attachment upload, which can be put into a message to send the attachment. +type UploadResponse struct { + URL string `json:"url"` + DirectPath string `json:"direct_path"` + + MediaKey []byte `json:"-"` + FileEncSHA256 []byte `json:"-"` + FileSHA256 []byte `json:"-"` + FileLength uint64 `json:"-"` +} + +// Upload uploads the given attachment to WhatsApp servers. +// +// You should copy the fields in the response to the corresponding fields in a protobuf message. +// +// For example, to send an image: +// +// resp, err := cli.Upload(context.Background(), yourImageBytes, whatsmeow.MediaImage) +// // handle error +// +// imageMsg := &waProto.ImageMessage{ +// Caption: proto.String("Hello, world!"), +// Mimetype: proto.String("image/png"), // replace this with the actual mime type +// // you can also optionally add other fields like ContextInfo and JpegThumbnail here +// +// Url: &resp.URL, +// DirectPath: &resp.DirectPath, +// MediaKey: resp.MediaKey, +// FileEncSha256: resp.FileEncSHA256, +// FileSha256: resp.FileSha256, +// FileLength: &resp.FileLength, +// } +// _, err = cli.SendMessage(context.Background(), targetJID, &waProto.Message{ +// ImageMessage: imageMsg, +// }) +// // handle error again +// +// The same applies to the other message types like DocumentMessage, just replace the struct type and Message field name. +func (cli *Client) Upload(ctx context.Context, plaintext []byte, appInfo MediaType) (resp UploadResponse, err error) { + resp.FileLength = uint64(len(plaintext)) + resp.MediaKey = make([]byte, 32) + _, err = rand.Read(resp.MediaKey) + if err != nil { + return + } + + plaintextSHA256 := sha256.Sum256(plaintext) + resp.FileSHA256 = plaintextSHA256[:] + + iv, cipherKey, macKey, _ := getMediaKeys(resp.MediaKey, appInfo) + + var ciphertext []byte + ciphertext, err = cbcutil.Encrypt(cipherKey, iv, plaintext) + if err != nil { + err = fmt.Errorf("failed to encrypt file: %w", err) + return + } + + h := hmac.New(sha256.New, macKey) + h.Write(iv) + h.Write(ciphertext) + dataToUpload := append(ciphertext, h.Sum(nil)[:10]...) + + fileEncSHA256 := sha256.Sum256(dataToUpload) + resp.FileEncSHA256 = fileEncSHA256[:] + + var mediaConn *MediaConn + mediaConn, err = cli.refreshMediaConn(false) + if err != nil { + err = fmt.Errorf("failed to refresh media connections: %w", err) + return + } + + token := base64.URLEncoding.EncodeToString(resp.FileEncSHA256) + q := url.Values{ + "auth": []string{mediaConn.Auth}, + "token": []string{token}, + } + mmsType := mediaTypeToMMSType[appInfo] + uploadURL := url.URL{ + Scheme: "https", + Host: mediaConn.Hosts[0].Hostname, + Path: fmt.Sprintf("/mms/%s/%s", mmsType, token), + RawQuery: q.Encode(), + } + + var req *http.Request + req, err = http.NewRequestWithContext(ctx, http.MethodPost, uploadURL.String(), bytes.NewReader(dataToUpload)) + if err != nil { + err = fmt.Errorf("failed to prepare request: %w", err) + return + } + + req.Header.Set("Origin", socket.Origin) + req.Header.Set("Referer", socket.Origin+"/") + + var httpResp *http.Response + httpResp, err = cli.http.Do(req) + if err != nil { + err = fmt.Errorf("failed to execute request: %w", err) + } else if httpResp.StatusCode != http.StatusOK { + err = fmt.Errorf("upload failed with status code %d", httpResp.StatusCode) + } else if err = json.NewDecoder(httpResp.Body).Decode(&resp); err != nil { + err = fmt.Errorf("failed to parse upload response: %w", err) + } + if httpResp != nil { + _ = httpResp.Body.Close() + } + return +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/user.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/user.go new file mode 100644 index 0000000..dae8640 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/user.go @@ -0,0 +1,501 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package whatsmeow + +import ( + "context" + "errors" + "fmt" + "strings" + + "google.golang.org/protobuf/proto" + + waBinary "go.mau.fi/whatsmeow/binary" + waProto "go.mau.fi/whatsmeow/binary/proto" + "go.mau.fi/whatsmeow/types" + "go.mau.fi/whatsmeow/types/events" +) + +const BusinessMessageLinkPrefix = "https://wa.me/message/" +const ContactQRLinkPrefix = "https://wa.me/qr/" +const BusinessMessageLinkDirectPrefix = "https://api.whatsapp.com/message/" +const ContactQRLinkDirectPrefix = "https://api.whatsapp.com/qr/" + +// ResolveBusinessMessageLink resolves a business message short link and returns the target JID, business name and +// text to prefill in the input field (if any). +// +// The links look like https://wa.me/message/<code> or https://api.whatsapp.com/message/<code>. You can either provide +// the full link, or just the <code> part. +func (cli *Client) ResolveBusinessMessageLink(code string) (*types.BusinessMessageLinkTarget, error) { + code = strings.TrimPrefix(code, BusinessMessageLinkPrefix) + code = strings.TrimPrefix(code, BusinessMessageLinkDirectPrefix) + + resp, err := cli.sendIQ(infoQuery{ + Namespace: "w:qr", + Type: iqGet, + // WhatsApp android doesn't seem to have a "to" field for this one at all, not sure why but it works + Content: []waBinary.Node{{ + Tag: "qr", + Attrs: waBinary.Attrs{ + "code": code, + }, + }}, + }) + if errors.Is(err, ErrIQNotFound) { + return nil, wrapIQError(ErrBusinessMessageLinkNotFound, err) + } else if err != nil { + return nil, err + } + qrChild, ok := resp.GetOptionalChildByTag("qr") + if !ok { + return nil, &ElementMissingError{Tag: "qr", In: "response to business message link query"} + } + var target types.BusinessMessageLinkTarget + ag := qrChild.AttrGetter() + target.JID = ag.JID("jid") + target.PushName = ag.String("notify") + messageChild, ok := qrChild.GetOptionalChildByTag("message") + if ok { + messageBytes, _ := messageChild.Content.([]byte) + target.Message = string(messageBytes) + } + businessChild, ok := qrChild.GetOptionalChildByTag("business") + if ok { + bag := businessChild.AttrGetter() + target.IsSigned = bag.OptionalBool("is_signed") + target.VerifiedName = bag.OptionalString("verified_name") + target.VerifiedLevel = bag.OptionalString("verified_level") + } + return &target, ag.Error() +} + +// ResolveContactQRLink resolves a link from a contact share QR code and returns the target JID and push name. +// +// The links look like https://wa.me/qr/<code> or https://api.whatsapp.com/qr/<code>. You can either provide +// the full link, or just the <code> part. +func (cli *Client) ResolveContactQRLink(code string) (*types.ContactQRLinkTarget, error) { + code = strings.TrimPrefix(code, ContactQRLinkPrefix) + code = strings.TrimPrefix(code, ContactQRLinkDirectPrefix) + + resp, err := cli.sendIQ(infoQuery{ + Namespace: "w:qr", + Type: iqGet, + Content: []waBinary.Node{{ + Tag: "qr", + Attrs: waBinary.Attrs{ + "code": code, + }, + }}, + }) + if errors.Is(err, ErrIQNotFound) { + return nil, wrapIQError(ErrContactQRLinkNotFound, err) + } else if err != nil { + return nil, err + } + qrChild, ok := resp.GetOptionalChildByTag("qr") + if !ok { + return nil, &ElementMissingError{Tag: "qr", In: "response to contact link query"} + } + var target types.ContactQRLinkTarget + ag := qrChild.AttrGetter() + target.JID = ag.JID("jid") + target.PushName = ag.OptionalString("notify") + target.Type = ag.String("type") + return &target, ag.Error() +} + +// GetContactQRLink gets your own contact share QR link that can be resolved using ResolveContactQRLink +// (or scanned with the official apps when encoded as a QR code). +// +// If the revoke parameter is set to true, it will ask the server to revoke the previous link and generate a new one. +func (cli *Client) GetContactQRLink(revoke bool) (string, error) { + action := "get" + if revoke { + action = "revoke" + } + resp, err := cli.sendIQ(infoQuery{ + Namespace: "w:qr", + Type: iqSet, + Content: []waBinary.Node{{ + Tag: "qr", + Attrs: waBinary.Attrs{ + "type": "contact", + "action": action, + }, + }}, + }) + if err != nil { + return "", err + } + qrChild, ok := resp.GetOptionalChildByTag("qr") + if !ok { + return "", &ElementMissingError{Tag: "qr", In: "response to own contact link fetch"} + } + ag := qrChild.AttrGetter() + return ag.String("code"), ag.Error() +} + +// SetStatusMessage updates the current user's status text, which is shown in the "About" section in the user profile. +// +// This is different from the ephemeral status broadcast messages. Use SendMessage to types.StatusBroadcastJID to send +// such messages. +func (cli *Client) SetStatusMessage(msg string) error { + _, err := cli.sendIQ(infoQuery{ + Namespace: "status", + Type: iqSet, + To: types.ServerJID, + Content: []waBinary.Node{{ + Tag: "status", + Content: msg, + }}, + }) + return err +} + +// IsOnWhatsApp checks if the given phone numbers are registered on WhatsApp. +// The phone numbers should be in international format, including the `+` prefix. +func (cli *Client) IsOnWhatsApp(phones []string) ([]types.IsOnWhatsAppResponse, error) { + jids := make([]types.JID, len(phones)) + for i := range jids { + jids[i] = types.NewJID(phones[i], types.LegacyUserServer) + } + list, err := cli.usync(context.TODO(), jids, "query", "interactive", []waBinary.Node{ + {Tag: "business", Content: []waBinary.Node{{Tag: "verified_name"}}}, + {Tag: "contact"}, + }) + if err != nil { + return nil, err + } + output := make([]types.IsOnWhatsAppResponse, 0, len(jids)) + querySuffix := "@" + types.LegacyUserServer + for _, child := range list.GetChildren() { + jid, jidOK := child.Attrs["jid"].(types.JID) + if child.Tag != "user" || !jidOK { + continue + } + var info types.IsOnWhatsAppResponse + info.JID = jid + info.VerifiedName, err = parseVerifiedName(child.GetChildByTag("business")) + if err != nil { + cli.Log.Warnf("Failed to parse %s's verified name details: %v", jid, err) + } + contactNode := child.GetChildByTag("contact") + info.IsIn = contactNode.AttrGetter().String("type") == "in" + contactQuery, _ := contactNode.Content.([]byte) + info.Query = strings.TrimSuffix(string(contactQuery), querySuffix) + output = append(output, info) + } + return output, nil +} + +// GetUserInfo gets basic user info (avatar, status, verified business name, device list). +func (cli *Client) GetUserInfo(jids []types.JID) (map[types.JID]types.UserInfo, error) { + list, err := cli.usync(context.TODO(), jids, "full", "background", []waBinary.Node{ + {Tag: "business", Content: []waBinary.Node{{Tag: "verified_name"}}}, + {Tag: "status"}, + {Tag: "picture"}, + {Tag: "devices", Attrs: waBinary.Attrs{"version": "2"}}, + }) + if err != nil { + return nil, err + } + respData := make(map[types.JID]types.UserInfo, len(jids)) + for _, child := range list.GetChildren() { + jid, jidOK := child.Attrs["jid"].(types.JID) + if child.Tag != "user" || !jidOK { + continue + } + var info types.UserInfo + verifiedName, err := parseVerifiedName(child.GetChildByTag("business")) + if err != nil { + cli.Log.Warnf("Failed to parse %s's verified name details: %v", jid, err) + } + status, _ := child.GetChildByTag("status").Content.([]byte) + info.Status = string(status) + info.PictureID, _ = child.GetChildByTag("picture").Attrs["id"].(string) + info.Devices = parseDeviceList(jid.User, child.GetChildByTag("devices")) + if verifiedName != nil { + cli.updateBusinessName(jid, nil, verifiedName.Details.GetVerifiedName()) + } + respData[jid] = info + } + return respData, nil +} + +// GetUserDevices gets the list of devices that the given user has. The input should be a list of +// regular JIDs, and the output will be a list of AD JIDs. The local device will not be included in +// the output even if the user's JID is included in the input. All other devices will be included. +func (cli *Client) GetUserDevices(jids []types.JID) ([]types.JID, error) { + return cli.GetUserDevicesContext(context.Background(), jids) +} + +func (cli *Client) GetUserDevicesContext(ctx context.Context, jids []types.JID) ([]types.JID, error) { + cli.userDevicesCacheLock.Lock() + defer cli.userDevicesCacheLock.Unlock() + + var devices, jidsToSync []types.JID + for _, jid := range jids { + cached, ok := cli.userDevicesCache[jid] + if ok && len(cached) > 0 { + devices = append(devices, cached...) + } else { + jidsToSync = append(jidsToSync, jid) + } + } + if len(jidsToSync) == 0 { + return devices, nil + } + + list, err := cli.usync(ctx, jidsToSync, "query", "message", []waBinary.Node{ + {Tag: "devices", Attrs: waBinary.Attrs{"version": "2"}}, + }) + if err != nil { + return nil, err + } + + for _, user := range list.GetChildren() { + jid, jidOK := user.Attrs["jid"].(types.JID) + if user.Tag != "user" || !jidOK { + continue + } + userDevices := parseDeviceList(jid.User, user.GetChildByTag("devices")) + cli.userDevicesCache[jid] = userDevices + devices = append(devices, userDevices...) + } + + return devices, nil +} + +type GetProfilePictureParams struct { + Preview bool + ExistingID string + IsCommunity bool +} + +// GetProfilePictureInfo gets the URL where you can download a WhatsApp user's profile picture or group's photo. +// +// Optionally, you can pass the last known profile picture ID. +// If the profile picture hasn't changed, this will return nil with no error. +// +// To get a community photo, you should pass `IsCommunity: true`, as otherwise you may get a 401 error. +func (cli *Client) GetProfilePictureInfo(jid types.JID, params *GetProfilePictureParams) (*types.ProfilePictureInfo, error) { + attrs := waBinary.Attrs{ + "query": "url", + } + if params == nil { + params = &GetProfilePictureParams{} + } + if params.Preview { + attrs["type"] = "preview" + } else { + attrs["type"] = "image" + } + if params.ExistingID != "" { + attrs["id"] = params.ExistingID + } + var pictureContent []waBinary.Node + namespace := "w:profile:picture" + if params.IsCommunity { + namespace = "w:g2" + pictureContent = []waBinary.Node{{ + Tag: "query_linked", + Attrs: waBinary.Attrs{ + "type": "parent_group", + "jid": jid, + }, + }} + } + resp, err := cli.sendIQ(infoQuery{ + Namespace: namespace, + Type: "get", + To: jid, + Content: []waBinary.Node{{ + Tag: "picture", + Attrs: attrs, + Content: pictureContent, + }}, + }) + if errors.Is(err, ErrIQNotAuthorized) { + return nil, wrapIQError(ErrProfilePictureUnauthorized, err) + } else if errors.Is(err, ErrIQNotFound) { + return nil, wrapIQError(ErrProfilePictureNotSet, err) + } else if err != nil { + return nil, err + } + picture, ok := resp.GetOptionalChildByTag("picture") + if !ok { + if params.ExistingID != "" { + return nil, nil + } + return nil, &ElementMissingError{Tag: "picture", In: "response to profile picture query"} + } + var info types.ProfilePictureInfo + ag := picture.AttrGetter() + info.ID = ag.String("id") + info.URL = ag.String("url") + info.Type = ag.String("type") + info.DirectPath = ag.String("direct_path") + if !ag.OK() { + return &info, ag.Error() + } + return &info, nil +} + +func (cli *Client) handleHistoricalPushNames(names []*waProto.Pushname) { + if cli.Store.Contacts == nil { + return + } + cli.Log.Infof("Updating contact store with %d push names from history sync", len(names)) + for _, user := range names { + if user.GetPushname() == "-" { + continue + } + var changed bool + if jid, err := types.ParseJID(user.GetId()); err != nil { + cli.Log.Warnf("Failed to parse user ID '%s' in push name history sync: %v", user.GetId(), err) + } else if changed, _, err = cli.Store.Contacts.PutPushName(jid, user.GetPushname()); err != nil { + cli.Log.Warnf("Failed to store push name of %s from history sync: %v", err) + } else if changed { + cli.Log.Debugf("Got push name %s for %s in history sync", user.GetPushname(), jid) + } + } +} + +func (cli *Client) updatePushName(user types.JID, messageInfo *types.MessageInfo, name string) { + if cli.Store.Contacts == nil { + return + } + user = user.ToNonAD() + changed, previousName, err := cli.Store.Contacts.PutPushName(user, name) + if err != nil { + cli.Log.Errorf("Failed to save push name of %s in device store: %v", user, err) + } else if changed { + cli.Log.Debugf("Push name of %s changed from %s to %s, dispatching event", user, previousName, name) + cli.dispatchEvent(&events.PushName{ + JID: user, + Message: messageInfo, + OldPushName: previousName, + NewPushName: name, + }) + } +} + +func (cli *Client) updateBusinessName(user types.JID, messageInfo *types.MessageInfo, name string) { + if cli.Store.Contacts == nil { + return + } + changed, previousName, err := cli.Store.Contacts.PutBusinessName(user, name) + if err != nil { + cli.Log.Errorf("Failed to save business name of %s in device store: %v", user, err) + } else if changed { + cli.Log.Debugf("Business name of %s changed from %s to %s, dispatching event", user, previousName, name) + cli.dispatchEvent(&events.BusinessName{ + JID: user, + Message: messageInfo, + OldBusinessName: previousName, + NewBusinessName: name, + }) + } +} + +func parseVerifiedName(businessNode waBinary.Node) (*types.VerifiedName, error) { + if businessNode.Tag != "business" { + return nil, nil + } + verifiedNameNode, ok := businessNode.GetOptionalChildByTag("verified_name") + if !ok { + return nil, nil + } + return parseVerifiedNameContent(verifiedNameNode) +} + +func parseVerifiedNameContent(verifiedNameNode waBinary.Node) (*types.VerifiedName, error) { + rawCert, ok := verifiedNameNode.Content.([]byte) + if !ok { + return nil, nil + } + + var cert waProto.VerifiedNameCertificate + err := proto.Unmarshal(rawCert, &cert) + if err != nil { + return nil, err + } + var certDetails waProto.VerifiedNameCertificate_Details + err = proto.Unmarshal(cert.GetDetails(), &certDetails) + if err != nil { + return nil, err + } + return &types.VerifiedName{ + Certificate: &cert, + Details: &certDetails, + }, nil +} + +func parseDeviceList(user string, deviceNode waBinary.Node) []types.JID { + deviceList := deviceNode.GetChildByTag("device-list") + if deviceNode.Tag != "devices" || deviceList.Tag != "device-list" { + return nil + } + children := deviceList.GetChildren() + devices := make([]types.JID, 0, len(children)) + for _, device := range children { + deviceID, ok := device.AttrGetter().GetInt64("id", true) + if device.Tag != "device" || !ok { + continue + } + devices = append(devices, types.NewADJID(user, 0, byte(deviceID))) + } + return devices +} + +func (cli *Client) usync(ctx context.Context, jids []types.JID, mode, context string, query []waBinary.Node) (*waBinary.Node, error) { + userList := make([]waBinary.Node, len(jids)) + for i, jid := range jids { + userList[i].Tag = "user" + if jid.AD { + jid.AD = false + } + switch jid.Server { + case types.LegacyUserServer: + userList[i].Content = []waBinary.Node{{ + Tag: "contact", + Content: jid.String(), + }} + case types.DefaultUserServer: + userList[i].Attrs = waBinary.Attrs{"jid": jid} + default: + return nil, fmt.Errorf("unknown user server '%s'", jid.Server) + } + } + resp, err := cli.sendIQ(infoQuery{ + Context: ctx, + Namespace: "usync", + Type: "get", + To: types.ServerJID, + Content: []waBinary.Node{{ + Tag: "usync", + Attrs: waBinary.Attrs{ + "sid": cli.generateRequestID(), + "mode": mode, + "last": "true", + "index": "0", + "context": context, + }, + Content: []waBinary.Node{ + {Tag: "query", Content: query}, + {Tag: "list", Content: userList}, + }, + }}, + }) + if err != nil { + return nil, fmt.Errorf("failed to send usync query: %w", err) + } else if list, ok := resp.GetOptionalChildByTag("usync", "list"); !ok { + return nil, &ElementMissingError{Tag: "list", In: "response to usync query"} + } else { + return &list, err + } +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/util/cbcutil/cbc.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/util/cbcutil/cbc.go new file mode 100644 index 0000000..05fa857 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/util/cbcutil/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 cbcutil + +/* +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/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/util/gcmutil/gcm.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/util/gcmutil/gcm.go new file mode 100644 index 0000000..2451aea --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/util/gcmutil/gcm.go @@ -0,0 +1,41 @@ +// Copyright (c) 2022 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +package gcmutil + +import ( + "crypto/aes" + "crypto/cipher" + "fmt" +) + +func Prepare(secretKey []byte) (gcm cipher.AEAD, err error) { + var block cipher.Block + if block, err = aes.NewCipher(secretKey); err != nil { + err = fmt.Errorf("failed to initialize AES cipher: %w", err) + } else if gcm, err = cipher.NewGCM(block); err != nil { + err = fmt.Errorf("failed to initialize GCM: %w", err) + } + return +} + +func Decrypt(secretKey, iv, ciphertext, additionalData []byte) ([]byte, error) { + if gcm, err := Prepare(secretKey); err != nil { + return nil, err + } else if plaintext, decryptErr := gcm.Open(nil, iv, ciphertext, additionalData); decryptErr != nil { + return nil, decryptErr + } else { + return plaintext, nil + } +} + +func Encrypt(secretKey, iv, plaintext, additionalData []byte) ([]byte, error) { + if gcm, err := Prepare(secretKey); err != nil { + return nil, err + } else { + return gcm.Seal(nil, iv, plaintext, additionalData), nil + } +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/util/hkdfutil/hkdf.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/util/hkdfutil/hkdf.go new file mode 100644 index 0000000..fbc9712 --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/util/hkdfutil/hkdf.go @@ -0,0 +1,28 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +// Package hkdfutil contains a simple wrapper for golang.org/x/crypto/hkdf that reads a specified number of bytes. +package hkdfutil + +import ( + "crypto/sha256" + "fmt" + + "golang.org/x/crypto/hkdf" +) + +func SHA256(key, salt, info []byte, length uint8) []byte { + data := make([]byte, length) + h := hkdf.New(sha256.New, key, salt, info) + n, err := h.Read(data) + if err != nil { + // Length is limited to 255 by being uint8, so these errors can't actually happen + panic(fmt.Errorf("failed to expand key: %w", err)) + } else if uint8(n) != length { + panic(fmt.Errorf("didn't read enough bytes (got %d, wanted %d)", n, length)) + } + return data +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/util/keys/keypair.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/util/keys/keypair.go new file mode 100644 index 0000000..55679ff --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/util/keys/keypair.go @@ -0,0 +1,75 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +// Package keys contains a utility struct for elliptic curve keypairs. +package keys + +import ( + "crypto/rand" + "fmt" + + "go.mau.fi/libsignal/ecc" + "golang.org/x/crypto/curve25519" +) + +type KeyPair struct { + Pub *[32]byte + Priv *[32]byte +} + +var _ ecc.ECPublicKeyable + +func NewKeyPairFromPrivateKey(priv [32]byte) *KeyPair { + var kp KeyPair + kp.Priv = &priv + var pub [32]byte + curve25519.ScalarBaseMult(&pub, kp.Priv) + kp.Pub = &pub + return &kp +} + +func NewKeyPair() *KeyPair { + var priv [32]byte + + _, err := rand.Read(priv[:]) + if err != nil { + panic(fmt.Errorf("failed to generate curve25519 private key: %w", err)) + } + + priv[0] &= 248 + priv[31] &= 127 + priv[31] |= 64 + + return NewKeyPairFromPrivateKey(priv) +} + +func (kp *KeyPair) CreateSignedPreKey(keyID uint32) *PreKey { + newKey := NewPreKey(keyID) + newKey.Signature = kp.Sign(&newKey.KeyPair) + return newKey +} + +func (kp *KeyPair) Sign(keyToSign *KeyPair) *[64]byte { + pubKeyForSignature := make([]byte, 33) + pubKeyForSignature[0] = ecc.DjbType + copy(pubKeyForSignature[1:], keyToSign.Pub[:]) + + signature := ecc.CalculateSignature(ecc.NewDjbECPrivateKey(*kp.Priv), pubKeyForSignature) + return &signature +} + +type PreKey struct { + KeyPair + KeyID uint32 + Signature *[64]byte +} + +func NewPreKey(keyID uint32) *PreKey { + return &PreKey{ + KeyPair: *NewKeyPair(), + KeyID: keyID, + } +} diff --git a/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/util/log/log.go b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/util/log/log.go new file mode 100644 index 0000000..2662cde --- /dev/null +++ b/teleirc/matterbridge/vendor/go.mau.fi/whatsmeow/util/log/log.go @@ -0,0 +1,83 @@ +// Copyright (c) 2021 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +// Package waLog contains a simple logger interface used by the other whatsmeow packages. +package waLog + +import ( + "fmt" + "strings" + "time" +) + +// Logger is a simple logger interface that can have subloggers for specific areas. +type Logger interface { + Warnf(msg string, args ...interface{}) + Errorf(msg string, args ...interface{}) + Infof(msg string, args ...interface{}) + Debugf(msg string, args ...interface{}) + Sub(module string) Logger +} + +type noopLogger struct{} + +func (n *noopLogger) Errorf(_ string, _ ...interface{}) {} +func (n *noopLogger) Warnf(_ string, _ ...interface{}) {} +func (n *noopLogger) Infof(_ string, _ ...interface{}) {} +func (n *noopLogger) Debugf(_ string, _ ...interface{}) {} +func (n *noopLogger) Sub(_ string) Logger { return n } + +// Noop is a no-op Logger implementation that silently drops everything. +var Noop Logger = &noopLogger{} + +type stdoutLogger struct { + mod string + color bool + min int +} + +var colors = map[string]string{ + "INFO": "\033[36m", + "WARN": "\033[33m", + "ERROR": "\033[31m", +} + +var levelToInt = map[string]int{ + "": -1, + "DEBUG": 0, + "INFO": 1, + "WARN": 2, + "ERROR": 3, +} + +func (s *stdoutLogger) outputf(level, msg string, args ...interface{}) { + if levelToInt[level] < s.min { + return + } + var colorStart, colorReset string + if s.color { + colorStart = colors[level] + colorReset = "\033[0m" + } + fmt.Printf("%s%s [%s %s] %s%s\n", time.Now().Format("15:04:05.000"), colorStart, s.mod, level, fmt.Sprintf(msg, args...), colorReset) +} + +func (s *stdoutLogger) Errorf(msg string, args ...interface{}) { s.outputf("ERROR", msg, args...) } +func (s *stdoutLogger) Warnf(msg string, args ...interface{}) { s.outputf("WARN", msg, args...) } +func (s *stdoutLogger) Infof(msg string, args ...interface{}) { s.outputf("INFO", msg, args...) } +func (s *stdoutLogger) Debugf(msg string, args ...interface{}) { s.outputf("DEBUG", msg, args...) } +func (s *stdoutLogger) Sub(mod string) Logger { + return &stdoutLogger{mod: fmt.Sprintf("%s/%s", s.mod, mod), color: s.color, min: s.min} +} + +// Stdout is a simple Logger implementation that outputs to stdout. The module name given is included in log lines. +// +// minLevel specifies the minimum log level to output. An empty string will output all logs. +// +// If color is true, then info, warn and error logs will be colored cyan, yellow and red respectively using ANSI color escape codes. +func Stdout(module string, minLevel string, color bool) Logger { + return &stdoutLogger{mod: module, color: color, min: levelToInt[strings.ToUpper(minLevel)]} +} |
