Skip to content

Commit

Permalink
update whatsmeow to 20240130 from tulir/whatsmeow@0bb4134
Browse files Browse the repository at this point in the history
  • Loading branch information
d99kris committed Mar 30, 2024
1 parent f0e91a3 commit 90dd619
Show file tree
Hide file tree
Showing 9 changed files with 4,782 additions and 3,979 deletions.
2 changes: 1 addition & 1 deletion lib/common/src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

#pragma once

#define NCHAT_VERSION "4.47"
#define NCHAT_VERSION "4.48"
8,530 changes: 4,632 additions & 3,898 deletions lib/wmchat/go/ext/whatsmeow/binary/proto/def.pb.go

Large diffs are not rendered by default.

Binary file modified lib/wmchat/go/ext/whatsmeow/binary/proto/def.pb.raw
Binary file not shown.
197 changes: 129 additions & 68 deletions lib/wmchat/go/ext/whatsmeow/binary/proto/def.proto
Original file line number Diff line number Diff line change
Expand Up @@ -92,74 +92,6 @@ message DeviceProps {
optional HistorySyncConfig historySyncConfig = 5;
}

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;
LocationMessage locationMessage = 8;
}
}

message Footer {
optional string text = 1;
}

message CollectionMessage {
optional string bizJid = 1;
optional string id = 2;
optional int32 messageVersion = 3;
}

message CarouselMessage {
repeated InteractiveMessage cards = 1;
optional int32 messageVersion = 2;
}

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;
CarouselMessage carouselMessage = 7;
}
}

message InitialSecurityNotificationSettingSync {
optional bool securityNotificationEnabled = 1;
}
Expand Down Expand Up @@ -296,6 +228,11 @@ message FutureProofMessage {
optional Message message = 1;
}

message ExtendedTextMessageWithParentKey {
optional MessageKey key = 1;
optional ExtendedTextMessage extendedTextMessage = 2;
}

message ExtendedTextMessage {
enum PreviewType {
NONE = 0;
Expand Down Expand Up @@ -633,6 +570,12 @@ message AppStateFatalExceptionNotification {
optional int64 timestamp = 2;
}

message MediaNotifyMessage {
optional string expressPathUrl = 1;
optional bytes fileEncSha256 = 2;
optional uint64 fileLength = 3;
}

message Location {
optional double degreesLatitude = 1;
optional double degreesLongitude = 2;
Expand Down Expand Up @@ -695,11 +638,13 @@ message DisappearingMode {
CHAT_SETTING = 1;
ACCOUNT_SETTING = 2;
BULK_CHANGE = 3;
BIZ_SUPPORTS_FB_HOSTING = 4;
}
enum Initiator {
CHANGED_IN_CHAT = 0;
INITIATED_BY_ME = 1;
INITIATED_BY_OTHER = 2;
BIZ_UPGRADE_FB_HOSTING = 3;
}
optional Initiator initiator = 1;
optional Trigger trigger = 2;
Expand Down Expand Up @@ -834,13 +779,17 @@ message BotPluginMetadata {
optional string profilePhotoCdnUrl = 4;
optional string searchProviderUrl = 5;
optional uint32 referenceIndex = 6;
optional uint32 expectedLinksCount = 7;
optional uint32 pluginVersion = 8;
optional string searchQuery = 9;
}

message BotMetadata {
optional BotAvatarMetadata avatarMetadata = 1;
optional string personaId = 2;
optional BotPluginMetadata pluginMetadata = 3;
optional BotSuggestedPromptMetadata suggestedPromptMetadata = 4;
optional string invokerJid = 5;
}

message BotAvatarMetadata {
Expand Down Expand Up @@ -985,6 +934,9 @@ message Message {
optional EncEventResponseMessage encEventResponseMessage = 76;
optional CommentMessage commentMessage = 77;
optional NewsletterAdminInviteMessage newsletterAdminInviteMessage = 78;
optional ExtendedTextMessageWithParentKey extendedTextMessageWithParentKey = 79;
optional PlaceholderMessage placeholderMessage = 80;
optional SecretEncryptedMessage secretEncryptedMessage = 82;
}

message MessageSecretMessage {
Expand Down Expand Up @@ -1042,6 +994,7 @@ message TemplateMessage {
optional string hydratedFooterText = 7;
repeated HydratedTemplateButton hydratedButtons = 8;
optional string templateId = 9;
optional bool maskLinkedDevices = 10;
oneof title {
DocumentMessage documentMessage = 1;
string hydratedTitleText = 2;
Expand Down Expand Up @@ -1121,6 +1074,18 @@ message SendPaymentMessage {
optional PaymentBackground background = 4;
}

message SecretEncryptedMessage {
enum SecretEncType {
UNKNOWN = 0;
EVENT_RESPONSE = 1;
EVENT_EDIT = 2;
}
optional MessageKey targetMessageKey = 1;
optional bytes encPayload = 2;
optional bytes encIv = 3;
optional SecretEncType secretEncType = 4;
}

message ScheduledCallEditMessage {
enum EditType {
UNKNOWN = 0;
Expand Down Expand Up @@ -1187,6 +1152,7 @@ message ProtocolMessage {
PEER_DATA_OPERATION_REQUEST_RESPONSE_MESSAGE = 17;
REQUEST_WELCOME_MESSAGE = 18;
BOT_FEEDBACK_MESSAGE = 19;
MEDIA_NOTIFY_MESSAGE = 20;
}
optional MessageKey key = 1;
optional Type type = 2;
Expand All @@ -1205,6 +1171,7 @@ message ProtocolMessage {
optional BotFeedbackMessage botFeedbackMessage = 18;
optional string invokerJid = 19;
optional RequestWelcomeMessageMetadata requestWelcomeMessageMetadata = 20;
optional MediaNotifyMessage mediaNotifyMessage = 21;
}

message ProductMessage {
Expand Down Expand Up @@ -1267,6 +1234,13 @@ message PollCreationMessage {
optional ContextInfo contextInfo = 5;
}

message PlaceholderMessage {
enum PlaceholderType {
MASK_LINKED_DEVICES = 0;
}
optional PlaceholderType type = 1;
}

message PinInChatMessage {
enum Type {
UNKNOWN_TYPE = 0;
Expand Down Expand Up @@ -1544,6 +1518,75 @@ message InteractiveResponseMessage {
}
}

message InteractiveMessage {
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;
LocationMessage locationMessage = 8;
ProductMessage productMessage = 9;
}
}

message Footer {
optional string text = 1;
}

message CollectionMessage {
optional string bizJid = 1;
optional string id = 2;
optional int32 messageVersion = 3;
}

message CarouselMessage {
repeated InteractiveMessage cards = 1;
optional int32 messageVersion = 2;
}

message Body {
optional string text = 1;
}

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;
}

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;
CarouselMessage carouselMessage = 7;
}
}

message EphemeralSetting {
optional sfixed32 duration = 1;
optional sfixed64 timestamp = 2;
Expand Down Expand Up @@ -1880,6 +1923,7 @@ message SyncActionValue {
optional DeleteIndividualCallLogAction deleteIndividualCallLog = 46;
optional LabelReorderingAction labelReorderingAction = 47;
optional PaymentInfoAction paymentInfoAction = 48;
optional CustomPaymentMethodsAction customPaymentMethodsAction = 49;
}

message UserStatusMuteAction {
Expand Down Expand Up @@ -2060,6 +2104,22 @@ message DeleteChatAction {
optional SyncActionMessageRange messageRange = 1;
}

message CustomPaymentMethodsAction {
repeated CustomPaymentMethod customPaymentMethods = 1;
}

message CustomPaymentMethod {
required string credentialId = 1;
required string country = 2;
required string type = 3;
repeated CustomPaymentMethodMetadata metadata = 4;
}

message CustomPaymentMethodMetadata {
required string key = 1;
required string value = 2;
}

message ContactAction {
optional string fullName = 1;
optional string firstName = 2;
Expand Down Expand Up @@ -2343,6 +2403,7 @@ message ClientPayload {
BLUE_WEB = 32;
IPAD = 33;
TEST = 34;
SMART_GLASSES = 35;
}
enum DeviceType {
PHONE = 0;
Expand Down
24 changes: 16 additions & 8 deletions lib/wmchat/go/ext/whatsmeow/handshake.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,23 +77,31 @@ func (cli *Client) doHandshake(fs *socket.FrameSocket, ephemeralKP keys.KeyPair)
if err != nil {
return fmt.Errorf("failed to decrypt noise certificate ciphertext: %w", err)
}
var cert waProto.NoiseCertificate
err = proto.Unmarshal(certDecrypted, &cert)
var certChain waProto.CertChain
err = proto.Unmarshal(certDecrypted, &certChain)
if err != nil {
return fmt.Errorf("failed to unmarshal noise certificate: %w", err)
}
certDetailsRaw := cert.GetDetails()
certSignature := cert.GetSignature()
if certDetailsRaw == nil || certSignature == nil {
intermediateCertDetailsRaw := certChain.GetIntermediate().GetDetails()
intermediateCertSignature := certChain.GetIntermediate().GetSignature()
leafCertDetailsRaw := certChain.GetLeaf().GetDetails()
leafCertSignature := certChain.GetLeaf().GetSignature()
if intermediateCertDetailsRaw == nil || intermediateCertSignature == nil || leafCertDetailsRaw == nil || leafCertSignature == nil {
return fmt.Errorf("missing parts of noise certificate")
}
var certDetails waProto.NoiseCertificate_Details
err = proto.Unmarshal(certDetailsRaw, &certDetails)
var leafCertDetails waProto.CertChain_NoiseCertificate_Details
err = proto.Unmarshal(leafCertDetailsRaw, &leafCertDetails)
if err != nil {
return fmt.Errorf("failed to unmarshal noise certificate details: %w", err)
} else if !bytes.Equal(certDetails.GetKey(), staticDecrypted) {
} else if !bytes.Equal(leafCertDetails.GetKey(), staticDecrypted) {
return fmt.Errorf("cert key doesn't match decrypted static")
}
var intermediateCertDetails waProto.CertChain_NoiseCertificate_Details
err = proto.Unmarshal(intermediateCertDetailsRaw, &intermediateCertDetails)
if err != nil {
return fmt.Errorf("failed to unmarshal noise certificate details: %w", err)
}
// TODO check cert signatures?

encryptedPubkey := nh.Encrypt(cli.Store.NoiseKey.Pub[:])
err = nh.MixSharedSecretIntoKey(*cli.Store.NoiseKey.Priv, serverEphemeralArr)
Expand Down
2 changes: 1 addition & 1 deletion lib/wmchat/go/ext/whatsmeow/socket/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const (
const (
NoiseStartPattern = "Noise_XX_25519_AESGCM_SHA256\x00\x00\x00\x00"

WAMagicValue = 5
WAMagicValue = 6
)

var WAConnHeader = []byte{'W', 'A', WAMagicValue, token.DictVersion}
Expand Down
2 changes: 1 addition & 1 deletion lib/wmchat/go/ext/whatsmeow/store/clientpayload.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (vc WAVersionContainer) ProtoAppVersion() *waProto.ClientPayload_UserAgent_
}

// waVersion is the WhatsApp web client version
var waVersion = WAVersionContainer{2, 2353, 59}
var waVersion = WAVersionContainer{2, 2404, 5}

// waVersionHash is the md5 hash of a dot-separated waVersion
var waVersionHash [16]byte
Expand Down
2 changes: 1 addition & 1 deletion lib/wmchat/go/gowm.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import (
waLog "go.mau.fi/whatsmeow/util/log"
)

var whatsmeowDate int = 20240106
var whatsmeowDate int = 20240130

type JSONMessage []json.RawMessage
type JSONMessageType string
Expand Down
2 changes: 1 addition & 1 deletion src/nchat.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man.
.TH NCHAT "1" "March 2024" "nchat v4.47" "User Commands"
.TH NCHAT "1" "March 2024" "nchat v4.48" "User Commands"
.SH NAME
nchat \- ncurses chat
.SH SYNOPSIS
Expand Down

0 comments on commit 90dd619

Please sign in to comment.