mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-07-03 08:27:44 +00:00
Update dependencies (#1813)
This commit is contained in:
6
vendor/go.mau.fi/whatsmeow/binary/node.go
vendored
6
vendor/go.mau.fi/whatsmeow/binary/node.go
vendored
@ -7,6 +7,10 @@
|
||||
// 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{}
|
||||
|
||||
@ -78,6 +82,8 @@ func Unmarshal(data []byte) (*Node, error) {
|
||||
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
|
||||
}
|
||||
|
3975
vendor/go.mau.fi/whatsmeow/binary/proto/def.pb.go
vendored
3975
vendor/go.mau.fi/whatsmeow/binary/proto/def.pb.go
vendored
File diff suppressed because it is too large
Load Diff
BIN
vendor/go.mau.fi/whatsmeow/binary/proto/def.pb.raw
vendored
BIN
vendor/go.mau.fi/whatsmeow/binary/proto/def.pb.raw
vendored
Binary file not shown.
200
vendor/go.mau.fi/whatsmeow/binary/proto/def.proto
vendored
200
vendor/go.mau.fi/whatsmeow/binary/proto/def.proto
vendored
@ -48,6 +48,7 @@ message CompanionProps {
|
||||
OHANA = 10;
|
||||
ALOHA = 11;
|
||||
CATALINA = 12;
|
||||
TCL_TV = 13;
|
||||
}
|
||||
optional CompanionPropsPlatformType platformType = 3;
|
||||
optional bool requireFullSync = 4;
|
||||
@ -61,52 +62,6 @@ message AppVersion {
|
||||
optional uint32 quinary = 5;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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 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 {
|
||||
optional MessageKey key = 1;
|
||||
enum ProtocolMessageType {
|
||||
@ -160,6 +115,33 @@ message CatalogSnapshot {
|
||||
optional string description = 3;
|
||||
}
|
||||
|
||||
message PollVoteMessage {
|
||||
repeated bytes selectedOptions = 1;
|
||||
optional int64 senderTimestampMs = 2;
|
||||
}
|
||||
|
||||
message PollUpdateMessage {
|
||||
optional MessageKey pollCreationMessageKey = 1;
|
||||
optional PollEncValue vote = 2;
|
||||
}
|
||||
|
||||
message PollEncValue {
|
||||
optional bytes encPayload = 1;
|
||||
optional bytes encIv = 2;
|
||||
}
|
||||
|
||||
message PollCreationMessage {
|
||||
optional bytes encKey = 1;
|
||||
optional string name = 2;
|
||||
repeated Option options = 3;
|
||||
optional uint32 selectableOptionsCount = 4;
|
||||
optional ContextInfo contextInfo = 5;
|
||||
}
|
||||
|
||||
message Option {
|
||||
optional string optionName = 1;
|
||||
}
|
||||
|
||||
message PaymentInviteMessage {
|
||||
enum PaymentInviteMessageServiceType {
|
||||
UNKNOWN = 0;
|
||||
@ -547,6 +529,9 @@ message ExtendedTextMessage {
|
||||
PARENT = 1;
|
||||
}
|
||||
optional ExtendedTextMessageInviteLinkGroupType inviteLinkGroupType = 26;
|
||||
optional string inviteLinkParentGroupSubjectV2 = 27;
|
||||
optional bytes inviteLinkParentGroupThumbnailV2 = 28;
|
||||
optional ExtendedTextMessageInviteLinkGroupType inviteLinkGroupTypeV2 = 29;
|
||||
}
|
||||
|
||||
message DocumentMessage {
|
||||
@ -796,6 +781,7 @@ message ContextInfo {
|
||||
optional ActionLink actionLink = 33;
|
||||
optional string groupSubject = 34;
|
||||
optional string parentGroupJid = 35;
|
||||
optional bytes messageSecret = 36;
|
||||
}
|
||||
|
||||
message ExternalAdReplyInfo {
|
||||
@ -859,34 +845,6 @@ message CallButton {
|
||||
optional HighlyStructuredMessage phoneNumber = 2;
|
||||
}
|
||||
|
||||
message PollUpdateMessage {
|
||||
optional MessageKey pollCreationMessageKey = 1;
|
||||
optional bytes encPayload = 2;
|
||||
optional bytes encIv = 3;
|
||||
}
|
||||
|
||||
message PollUpdateMessageContent {
|
||||
oneof update {
|
||||
PollVoteMessage voteMessage = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message PollVoteMessage {
|
||||
repeated bytes selectedOptions = 1;
|
||||
optional int64 senderTimestampMs = 2;
|
||||
}
|
||||
|
||||
message PollCreationMessage {
|
||||
optional bytes encKey = 1;
|
||||
optional string name = 2;
|
||||
repeated Option options = 3;
|
||||
optional uint32 selectableOptionsCount = 4;
|
||||
}
|
||||
|
||||
message Option {
|
||||
optional string optionName = 1;
|
||||
}
|
||||
|
||||
message Point {
|
||||
optional int32 xDeprecated = 1;
|
||||
optional int32 yDeprecated = 2;
|
||||
@ -1056,6 +1014,52 @@ message StickerSyncRMRMessage {
|
||||
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;
|
||||
}
|
||||
|
||||
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 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 EphemeralSetting {
|
||||
optional sfixed32 duration = 1;
|
||||
optional sfixed64 timestamp = 2;
|
||||
@ -1184,6 +1188,14 @@ message MsgOpaqueData {
|
||||
optional bytes futureproofBuffer = 14;
|
||||
optional string clientUrl = 15;
|
||||
optional string loc = 16;
|
||||
optional string pollName = 17;
|
||||
repeated PollOption pollOptions = 18;
|
||||
optional bytes pollEncKey = 19;
|
||||
optional uint32 pollSelectableOptionsCount = 20;
|
||||
}
|
||||
|
||||
message PollOption {
|
||||
optional string name = 1;
|
||||
}
|
||||
|
||||
message ServerErrorReceipt {
|
||||
@ -1309,12 +1321,24 @@ message SyncActionValue {
|
||||
optional PrimaryFeature primaryFeature = 24;
|
||||
optional FavoriteStickerAction favoriteStickerAction = 25;
|
||||
optional AndroidUnsupportedActions androidUnsupportedActions = 26;
|
||||
optional AgentAction agentAction = 27;
|
||||
optional SubscriptionAction subscriptionAction = 28;
|
||||
optional UserStatusMuteAction userStatusMuteAction = 29;
|
||||
optional TimeFormatAction timeFormatAction = 30;
|
||||
}
|
||||
|
||||
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;
|
||||
@ -1326,6 +1350,12 @@ message SyncActionMessageRange {
|
||||
repeated SyncActionMessage messages = 3;
|
||||
}
|
||||
|
||||
message SubscriptionAction {
|
||||
optional bool isDeactivated = 1;
|
||||
optional bool isAutoRenewing = 2;
|
||||
optional int64 expirationDate = 3;
|
||||
}
|
||||
|
||||
message StarAction {
|
||||
optional bool starred = 1;
|
||||
}
|
||||
@ -1439,6 +1469,12 @@ 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;
|
||||
@ -1899,6 +1935,12 @@ message WebMessageInfo {
|
||||
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;
|
||||
}
|
||||
optional WebMessageInfoStubType messageStubType = 24;
|
||||
optional bool clearMedia = 25;
|
||||
@ -1929,6 +1971,9 @@ message WebMessageInfo {
|
||||
optional StatusPSA statusPsa = 44;
|
||||
repeated PollUpdate pollUpdates = 45;
|
||||
optional PollAdditionalMetadata pollAdditionalMetadata = 46;
|
||||
optional string agentId = 47;
|
||||
optional bool statusAlreadyViewed = 48;
|
||||
optional bytes messageSecret = 49;
|
||||
}
|
||||
|
||||
message WebFeatures {
|
||||
@ -1995,7 +2040,7 @@ message UserReceipt {
|
||||
}
|
||||
|
||||
message StatusPSA {
|
||||
required string campaignId = 44;
|
||||
required uint64 campaignId = 44;
|
||||
optional uint64 campaignExpirationTimestamp = 45;
|
||||
}
|
||||
|
||||
@ -2009,7 +2054,7 @@ message Reaction {
|
||||
|
||||
message PollUpdate {
|
||||
optional MessageKey pollUpdateMessageKey = 1;
|
||||
optional PollUpdateMessageContent pollUpdateMessage = 2;
|
||||
optional PollVoteMessage vote = 2;
|
||||
}
|
||||
|
||||
message PollAdditionalMetadata {
|
||||
@ -2080,6 +2125,9 @@ message PaymentInfo {
|
||||
COLLECT_CANCELED = 26;
|
||||
COLLECT_CANCELLING = 27;
|
||||
IN_REVIEW = 28;
|
||||
REVERSAL_SUCCESS = 29;
|
||||
REVERSAL_PENDING = 30;
|
||||
REFUND_PENDING = 31;
|
||||
}
|
||||
optional PaymentInfoTxnStatus txnStatus = 10;
|
||||
optional bool useNoviFiatFormat = 11;
|
||||
|
12
vendor/go.mau.fi/whatsmeow/client.go
vendored
12
vendor/go.mau.fi/whatsmeow/client.go
vendored
@ -10,6 +10,7 @@ package whatsmeow
|
||||
import (
|
||||
"context"
|
||||
"crypto/rand"
|
||||
"encoding/base64"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
@ -110,6 +111,8 @@ type Client struct {
|
||||
// If false, decrypting a message from untrusted devices will fail.
|
||||
AutoTrustIdentity bool
|
||||
|
||||
DebugDecodeBeforeSend bool
|
||||
|
||||
uniqueID string
|
||||
idCounter uint32
|
||||
|
||||
@ -497,6 +500,15 @@ func (cli *Client) sendNode(node waBinary.Node) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to marshal node: %w", err)
|
||||
}
|
||||
if cli.DebugDecodeBeforeSend {
|
||||
var decoded *waBinary.Node
|
||||
decoded, err = waBinary.Unmarshal(payload[1:])
|
||||
if err != nil {
|
||||
cli.Log.Infof("Malformed payload: %s", base64.URLEncoding.EncodeToString(payload))
|
||||
return fmt.Errorf("failed to decode the binary we just produced: %w", err)
|
||||
}
|
||||
node = *decoded
|
||||
}
|
||||
|
||||
cli.sendLog.Debugf("%s", node.XMLString())
|
||||
return sock.SendFrame(payload)
|
||||
|
55
vendor/go.mau.fi/whatsmeow/internals.go
vendored
Normal file
55
vendor/go.mau.fi/whatsmeow/internals.go
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
// 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 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()
|
||||
}
|
10
vendor/go.mau.fi/whatsmeow/message.go
vendored
10
vendor/go.mau.fi/whatsmeow/message.go
vendored
@ -110,12 +110,20 @@ func (cli *Client) parseMessageInfo(node *waBinary.Node) (*types.MessageInfo, er
|
||||
info.PushName, _ = node.Attrs["notify"].(string)
|
||||
info.Category, _ = node.Attrs["category"].(string)
|
||||
|
||||
for _, child := range node.GetChildren() {
|
||||
if child.Tag == "multicast" {
|
||||
info.Multicast = true
|
||||
} 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")) == len(node.GetChildren()) {
|
||||
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})
|
||||
|
10
vendor/go.mau.fi/whatsmeow/send.go
vendored
10
vendor/go.mau.fi/whatsmeow/send.go
vendored
@ -35,13 +35,13 @@ import (
|
||||
// msgID := whatsmeow.GenerateMessageID()
|
||||
// cli.SendMessage(targetJID, msgID, &waProto.Message{...})
|
||||
func GenerateMessageID() types.MessageID {
|
||||
id := make([]byte, 16)
|
||||
id := make([]byte, 8)
|
||||
_, err := rand.Read(id)
|
||||
if err != nil {
|
||||
// Out of entropy
|
||||
panic(err)
|
||||
}
|
||||
return strings.ToUpper(hex.EncodeToString(id))
|
||||
return "3EB0" + strings.ToUpper(hex.EncodeToString(id))
|
||||
}
|
||||
|
||||
// SendMessage sends the given message.
|
||||
@ -229,7 +229,11 @@ func (cli *Client) prepareMessageNode(to types.JID, id types.MessageID, message
|
||||
}},
|
||||
}
|
||||
if message.ProtocolMessage != nil && message.GetProtocolMessage().GetType() == waProto.ProtocolMessage_REVOKE && message.GetProtocolMessage().GetKey() != nil {
|
||||
node.Attrs["edit"] = "7"
|
||||
if message.GetProtocolMessage().GetKey().GetFromMe() {
|
||||
node.Attrs["edit"] = "7"
|
||||
} else {
|
||||
node.Attrs["edit"] = "8"
|
||||
}
|
||||
}
|
||||
if includeIdentity {
|
||||
err := cli.appendDeviceIdentityNode(&node)
|
||||
|
@ -74,7 +74,7 @@ func (vc WAVersionContainer) ProtoAppVersion() *waProto.AppVersion {
|
||||
}
|
||||
|
||||
// waVersion is the WhatsApp web client version
|
||||
var waVersion = WAVersionContainer{2, 2210, 9}
|
||||
var waVersion = WAVersionContainer{2, 2214, 9}
|
||||
|
||||
// waVersionHash is the md5 hash of a dot-separated waVersion
|
||||
var waVersionHash [16]byte
|
||||
|
2
vendor/go.mau.fi/whatsmeow/types/message.go
vendored
2
vendor/go.mau.fi/whatsmeow/types/message.go
vendored
@ -44,6 +44,8 @@ type MessageInfo struct {
|
||||
PushName string
|
||||
Timestamp time.Time
|
||||
Category string
|
||||
Multicast bool
|
||||
MediaType string
|
||||
|
||||
DeviceSentMeta *DeviceSentMeta // Metadata for direct messages sent from another one of the user's own devices.
|
||||
}
|
||||
|
Reference in New Issue
Block a user