Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e152aee740 | |||
| ff9b84c561 | |||
| 50c13398c4 | |||
| d991d0212d | |||
| 7c095c84a5 | |||
| a25e6740fd | |||
| 986ac588a9 | |||
| 64c73faab2 | |||
| b5464bec73 | |||
| 9f8f74fc7a | |||
| aaf3bd83eb | |||
| 8fe71b03d5 | |||
| c2c156d707 | |||
| e46b9750c2 | |||
| 542b7a278d | |||
| 6d7e0d7b35 | |||
| 9daee4d8fd | |||
| d7b2ceb161 | |||
| 2236ef83a9 | |||
| 07f775dd18 | |||
| ad81d1535d | |||
| 7ecfaefcfa | |||
| ad4f676e2b | |||
| 54d6a023a4 | |||
| 935484c790 | |||
| f2c14f9ad6 | |||
| ac2acf3d87 | |||
| 0b527b0855 | |||
| 9f8b603e28 |
+75
-2
@@ -1,7 +1,7 @@
|
||||
syntax = "proto3";
|
||||
package proto;
|
||||
|
||||
/// WhatsApp Version: 2.3000.1034621774
|
||||
/// WhatsApp Version: 2.3000.1035216863
|
||||
|
||||
message ADVDeviceIdentity {
|
||||
optional uint32 rawId = 1;
|
||||
@@ -345,6 +345,14 @@ message BotAgeCollectionMetadata {
|
||||
}
|
||||
}
|
||||
|
||||
message BotAgentDeepLinkMetadata {
|
||||
optional string token = 1;
|
||||
}
|
||||
|
||||
message BotAgentMetadata {
|
||||
optional BotAgentDeepLinkMetadata deepLinkMetadata = 1;
|
||||
}
|
||||
|
||||
message BotCapabilityMetadata {
|
||||
repeated BotCapabilityType capabilities = 1;
|
||||
enum BotCapabilityType {
|
||||
@@ -407,6 +415,8 @@ message BotCapabilityMetadata {
|
||||
RICH_RESPONSE_INLINE_LINKS_ENABLED = 56;
|
||||
RICH_RESPONSE_UR_IMAGINE_VIDEO = 57;
|
||||
JSON_PATCH_STREAMING = 58;
|
||||
AI_TAB_FORCE_CLIPPY = 59;
|
||||
UNIFIED_RESPONSE_EMBEDDED_SCREENS = 60;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1074,6 +1084,7 @@ message ClientPairingProps {
|
||||
optional bool isSyncdPureLidSession = 2;
|
||||
optional bool isSyncdSnapshotRecoveryEnabled = 3;
|
||||
optional bool isHsThumbnailSyncEnabled = 4;
|
||||
optional bytes subscriptionSyncPayload = 5;
|
||||
}
|
||||
|
||||
message ClientPayload {
|
||||
@@ -1454,6 +1465,7 @@ message ContextInfo {
|
||||
optional AdType adType = 25;
|
||||
optional string wtwaWebsiteUrl = 26;
|
||||
optional string adPreviewUrl = 27;
|
||||
optional bool containsCtwaFlowsAutoReply = 28;
|
||||
enum AdType {
|
||||
CTWA = 0;
|
||||
CAWC = 1;
|
||||
@@ -1608,6 +1620,8 @@ message Conversation {
|
||||
optional bool limitSharingInitiatedByMe = 53;
|
||||
optional bool maibaAiThreadEnabled = 54;
|
||||
optional bool isMarketingMessageThread = 55;
|
||||
optional bool isSenderNewAccount = 56;
|
||||
optional uint32 afterReadDuration = 57;
|
||||
enum EndOfHistoryTransferType {
|
||||
COMPLETE_BUT_MORE_MESSAGES_REMAIN_ON_PRIMARY = 0;
|
||||
COMPLETE_AND_NO_MORE_MESSAGE_REMAIN_ON_PRIMARY = 1;
|
||||
@@ -1635,6 +1649,8 @@ message DeviceCapabilities {
|
||||
message BusinessBroadcast {
|
||||
optional bool importListEnabled = 1;
|
||||
optional bool companionSupportEnabled = 2;
|
||||
optional bool campaignSyncEnabled = 3;
|
||||
optional bool insightsSyncEnabled = 4;
|
||||
}
|
||||
|
||||
enum ChatLockSupportLevel {
|
||||
@@ -1904,6 +1920,8 @@ message HandshakeMessage {
|
||||
optional bytes static = 1;
|
||||
optional bytes payload = 2;
|
||||
optional bytes extendedCiphertext = 3;
|
||||
optional bytes paddedBytes = 4;
|
||||
optional bool simulateXxkemFs = 5;
|
||||
}
|
||||
|
||||
message ClientHello {
|
||||
@@ -1912,6 +1930,9 @@ message HandshakeMessage {
|
||||
optional bytes payload = 3;
|
||||
optional bool useExtended = 4;
|
||||
optional bytes extendedCiphertext = 5;
|
||||
optional bytes paddedBytes = 6;
|
||||
optional bool sendServerHelloPaddedBytes = 7;
|
||||
optional bool simulateXxkemFs = 8;
|
||||
}
|
||||
|
||||
message ServerHello {
|
||||
@@ -1919,6 +1940,7 @@ message HandshakeMessage {
|
||||
optional bytes static = 2;
|
||||
optional bytes payload = 3;
|
||||
optional bytes extendedStatic = 4;
|
||||
optional bytes paddingBytes = 5;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2275,6 +2297,7 @@ message Message {
|
||||
optional PollCreationMessage pollCreationMessageV6 = 119;
|
||||
optional ConditionalRevealMessage conditionalRevealMessage = 120;
|
||||
optional PollAddOptionMessage pollAddOptionMessage = 121;
|
||||
optional EventInviteMessage eventInviteMessage = 122;
|
||||
message AlbumMessage {
|
||||
optional uint32 expectedImageCount = 2;
|
||||
optional uint32 expectedVideoCount = 3;
|
||||
@@ -2555,6 +2578,16 @@ message Message {
|
||||
optional bytes encIv = 3;
|
||||
}
|
||||
|
||||
message EventInviteMessage {
|
||||
optional ContextInfo contextInfo = 1;
|
||||
optional string eventId = 2;
|
||||
optional string eventTitle = 3;
|
||||
optional bytes jpegThumbnail = 4;
|
||||
optional int64 startTime = 5;
|
||||
optional string caption = 6;
|
||||
optional bool isCanceled = 7;
|
||||
}
|
||||
|
||||
message EventMessage {
|
||||
optional ContextInfo contextInfo = 1;
|
||||
optional bool isCanceled = 2;
|
||||
@@ -3081,9 +3114,10 @@ message Message {
|
||||
|
||||
message MessageHistoryMetadata {
|
||||
repeated string historyReceivers = 1;
|
||||
optional int64 oldestMessageTimestamp = 2;
|
||||
optional int64 oldestMessageTimestampInWindow = 2;
|
||||
optional int64 messageCount = 3;
|
||||
repeated string nonHistoryReceivers = 4;
|
||||
optional int64 oldestMessageTimestampInBundle = 5;
|
||||
}
|
||||
|
||||
message MessageHistoryNotice {
|
||||
@@ -3144,6 +3178,11 @@ message Message {
|
||||
optional int64 expiryTimestamp = 2;
|
||||
optional bool incentiveEligible = 3;
|
||||
optional string referralId = 4;
|
||||
optional InviteType inviteType = 5;
|
||||
enum InviteType {
|
||||
DEFAULT = 0;
|
||||
MAPPER = 1;
|
||||
}
|
||||
enum ServiceType {
|
||||
UNKNOWN = 0;
|
||||
FBPAY = 1;
|
||||
@@ -3565,6 +3604,7 @@ message Message {
|
||||
GROUP_MEMBER_LABEL_CHANGE = 30;
|
||||
AI_MEDIA_COLLECTION_MESSAGE = 31;
|
||||
MESSAGE_UNSCHEDULE = 32;
|
||||
BOT_UNLINK_MESSAGE = 33;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3597,6 +3637,7 @@ message Message {
|
||||
message RequestWelcomeMessageMetadata {
|
||||
optional LocalChatState localChatState = 1;
|
||||
optional WelcomeTrigger welcomeTrigger = 2;
|
||||
optional BotAgentMetadata botAgentMetadata = 3;
|
||||
enum LocalChatState {
|
||||
EMPTY = 0;
|
||||
NON_EMPTY = 1;
|
||||
@@ -4124,6 +4165,8 @@ enum MutationProps {
|
||||
BUSINESS_BROADCAST_CAMPAIGN_ACTION = 81;
|
||||
BUSINESS_BROADCAST_INSIGHTS_ACTION = 82;
|
||||
CUSTOMER_DATA_ACTION = 83;
|
||||
SUBSCRIPTIONS_SYNC_V2_ACTION = 84;
|
||||
THREAD_PIN_ACTION = 85;
|
||||
SHARE_OWN_PN = 10001;
|
||||
BUSINESS_BROADCAST_ACTION = 10002;
|
||||
AI_THREAD_DELETE_ACTION = 10003;
|
||||
@@ -4592,6 +4635,7 @@ message StatusAttribution {
|
||||
APPLE_MUSIC = 8;
|
||||
SHARECHAT = 9;
|
||||
GOOGLE_PHOTOS = 10;
|
||||
SOUNDCLOUD = 11;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4760,6 +4804,8 @@ message SyncActionValue {
|
||||
optional BusinessBroadcastCampaignAction businessBroadcastCampaignAction = 81;
|
||||
optional BusinessBroadcastInsightsAction businessBroadcastInsightsAction = 82;
|
||||
optional CustomerDataAction customerDataAction = 83;
|
||||
optional SubscriptionsSyncV2Action subscriptionsSyncV2Action = 84;
|
||||
optional ThreadPinAction threadPinAction = 85;
|
||||
message AgentAction {
|
||||
optional string name = 1;
|
||||
optional int32 deviceID = 2;
|
||||
@@ -5275,6 +5321,29 @@ message SyncActionValue {
|
||||
optional int64 expirationDate = 3;
|
||||
}
|
||||
|
||||
message SubscriptionsSyncV2Action {
|
||||
repeated SubscriptionInfo subscriptions = 1;
|
||||
repeated PaidFeature paidFeature = 2;
|
||||
message PaidFeature {
|
||||
optional string name = 1;
|
||||
optional bool enabled = 2;
|
||||
optional int32 limit = 3;
|
||||
optional int64 expirationTime = 4;
|
||||
}
|
||||
|
||||
message SubscriptionInfo {
|
||||
optional string id = 1;
|
||||
optional int32 tier = 2;
|
||||
optional string status = 3;
|
||||
optional int64 startTime = 4;
|
||||
optional int64 endTime = 5;
|
||||
optional bool isPlatformChanged = 6;
|
||||
optional string source = 7;
|
||||
optional int64 creationTime = 8;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
message SyncActionMessage {
|
||||
optional MessageKey key = 1;
|
||||
optional int64 timestamp = 2;
|
||||
@@ -5286,6 +5355,10 @@ message SyncActionValue {
|
||||
repeated SyncActionValue.SyncActionMessage messages = 3;
|
||||
}
|
||||
|
||||
message ThreadPinAction {
|
||||
optional bool pinned = 1;
|
||||
}
|
||||
|
||||
message TimeFormatAction {
|
||||
optional bool isTwentyFourHourFormatEnabled = 1;
|
||||
}
|
||||
|
||||
Vendored
+201
-5
@@ -981,6 +981,38 @@ export namespace proto {
|
||||
}
|
||||
}
|
||||
|
||||
interface IBotAgentDeepLinkMetadata {
|
||||
token?: (string|null);
|
||||
}
|
||||
|
||||
class BotAgentDeepLinkMetadata implements IBotAgentDeepLinkMetadata {
|
||||
constructor(p?: proto.IBotAgentDeepLinkMetadata);
|
||||
public token?: (string|null);
|
||||
public static create(properties?: proto.IBotAgentDeepLinkMetadata): proto.BotAgentDeepLinkMetadata;
|
||||
public static encode(m: proto.IBotAgentDeepLinkMetadata, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.BotAgentDeepLinkMetadata;
|
||||
public static fromObject(d: { [k: string]: any }): proto.BotAgentDeepLinkMetadata;
|
||||
public static toObject(m: proto.BotAgentDeepLinkMetadata, o?: $protobuf.IConversionOptions): { [k: string]: any };
|
||||
public toJSON(): { [k: string]: any };
|
||||
public static getTypeUrl(typeUrlPrefix?: string): string;
|
||||
}
|
||||
|
||||
interface IBotAgentMetadata {
|
||||
deepLinkMetadata?: (proto.IBotAgentDeepLinkMetadata|null);
|
||||
}
|
||||
|
||||
class BotAgentMetadata implements IBotAgentMetadata {
|
||||
constructor(p?: proto.IBotAgentMetadata);
|
||||
public deepLinkMetadata?: (proto.IBotAgentDeepLinkMetadata|null);
|
||||
public static create(properties?: proto.IBotAgentMetadata): proto.BotAgentMetadata;
|
||||
public static encode(m: proto.IBotAgentMetadata, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.BotAgentMetadata;
|
||||
public static fromObject(d: { [k: string]: any }): proto.BotAgentMetadata;
|
||||
public static toObject(m: proto.BotAgentMetadata, o?: $protobuf.IConversionOptions): { [k: string]: any };
|
||||
public toJSON(): { [k: string]: any };
|
||||
public static getTypeUrl(typeUrlPrefix?: string): string;
|
||||
}
|
||||
|
||||
interface IBotCapabilityMetadata {
|
||||
capabilities?: (proto.BotCapabilityMetadata.BotCapabilityType[]|null);
|
||||
}
|
||||
@@ -1058,7 +1090,9 @@ export namespace proto {
|
||||
RICH_RESPONSE_UR_BLOKS_ENABLED = 55,
|
||||
RICH_RESPONSE_INLINE_LINKS_ENABLED = 56,
|
||||
RICH_RESPONSE_UR_IMAGINE_VIDEO = 57,
|
||||
JSON_PATCH_STREAMING = 58
|
||||
JSON_PATCH_STREAMING = 58,
|
||||
AI_TAB_FORCE_CLIPPY = 59,
|
||||
UNIFIED_RESPONSE_EMBEDDED_SCREENS = 60
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2769,6 +2803,7 @@ export namespace proto {
|
||||
isSyncdPureLidSession?: (boolean|null);
|
||||
isSyncdSnapshotRecoveryEnabled?: (boolean|null);
|
||||
isHsThumbnailSyncEnabled?: (boolean|null);
|
||||
subscriptionSyncPayload?: (Uint8Array|null);
|
||||
}
|
||||
|
||||
class ClientPairingProps implements IClientPairingProps {
|
||||
@@ -2777,6 +2812,7 @@ export namespace proto {
|
||||
public isSyncdPureLidSession?: (boolean|null);
|
||||
public isSyncdSnapshotRecoveryEnabled?: (boolean|null);
|
||||
public isHsThumbnailSyncEnabled?: (boolean|null);
|
||||
public subscriptionSyncPayload?: (Uint8Array|null);
|
||||
public static create(properties?: proto.IClientPairingProps): proto.ClientPairingProps;
|
||||
public static encode(m: proto.IClientPairingProps, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.ClientPairingProps;
|
||||
@@ -3554,6 +3590,7 @@ export namespace proto {
|
||||
adType?: (proto.ContextInfo.ExternalAdReplyInfo.AdType|null);
|
||||
wtwaWebsiteUrl?: (string|null);
|
||||
adPreviewUrl?: (string|null);
|
||||
containsCtwaFlowsAutoReply?: (boolean|null);
|
||||
}
|
||||
|
||||
class ExternalAdReplyInfo implements IExternalAdReplyInfo {
|
||||
@@ -3585,6 +3622,7 @@ export namespace proto {
|
||||
public adType?: (proto.ContextInfo.ExternalAdReplyInfo.AdType|null);
|
||||
public wtwaWebsiteUrl?: (string|null);
|
||||
public adPreviewUrl?: (string|null);
|
||||
public containsCtwaFlowsAutoReply?: (boolean|null);
|
||||
public static create(properties?: proto.ContextInfo.IExternalAdReplyInfo): proto.ContextInfo.ExternalAdReplyInfo;
|
||||
public static encode(m: proto.ContextInfo.IExternalAdReplyInfo, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.ContextInfo.ExternalAdReplyInfo;
|
||||
@@ -3849,6 +3887,8 @@ export namespace proto {
|
||||
limitSharingInitiatedByMe?: (boolean|null);
|
||||
maibaAiThreadEnabled?: (boolean|null);
|
||||
isMarketingMessageThread?: (boolean|null);
|
||||
isSenderNewAccount?: (boolean|null);
|
||||
afterReadDuration?: (number|null);
|
||||
}
|
||||
|
||||
class Conversation implements IConversation {
|
||||
@@ -3908,6 +3948,8 @@ export namespace proto {
|
||||
public limitSharingInitiatedByMe?: (boolean|null);
|
||||
public maibaAiThreadEnabled?: (boolean|null);
|
||||
public isMarketingMessageThread?: (boolean|null);
|
||||
public isSenderNewAccount?: (boolean|null);
|
||||
public afterReadDuration?: (number|null);
|
||||
public static create(properties?: proto.IConversation): proto.Conversation;
|
||||
public static encode(m: proto.IConversation, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.Conversation;
|
||||
@@ -3983,12 +4025,16 @@ export namespace proto {
|
||||
interface IBusinessBroadcast {
|
||||
importListEnabled?: (boolean|null);
|
||||
companionSupportEnabled?: (boolean|null);
|
||||
campaignSyncEnabled?: (boolean|null);
|
||||
insightsSyncEnabled?: (boolean|null);
|
||||
}
|
||||
|
||||
class BusinessBroadcast implements IBusinessBroadcast {
|
||||
constructor(p?: proto.DeviceCapabilities.IBusinessBroadcast);
|
||||
public importListEnabled?: (boolean|null);
|
||||
public companionSupportEnabled?: (boolean|null);
|
||||
public campaignSyncEnabled?: (boolean|null);
|
||||
public insightsSyncEnabled?: (boolean|null);
|
||||
public static create(properties?: proto.DeviceCapabilities.IBusinessBroadcast): proto.DeviceCapabilities.BusinessBroadcast;
|
||||
public static encode(m: proto.DeviceCapabilities.IBusinessBroadcast, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.DeviceCapabilities.BusinessBroadcast;
|
||||
@@ -4684,6 +4730,8 @@ export namespace proto {
|
||||
"static"?: (Uint8Array|null);
|
||||
payload?: (Uint8Array|null);
|
||||
extendedCiphertext?: (Uint8Array|null);
|
||||
paddedBytes?: (Uint8Array|null);
|
||||
simulateXxkemFs?: (boolean|null);
|
||||
}
|
||||
|
||||
class ClientFinish implements IClientFinish {
|
||||
@@ -4691,6 +4739,8 @@ export namespace proto {
|
||||
public static?: (Uint8Array|null);
|
||||
public payload?: (Uint8Array|null);
|
||||
public extendedCiphertext?: (Uint8Array|null);
|
||||
public paddedBytes?: (Uint8Array|null);
|
||||
public simulateXxkemFs?: (boolean|null);
|
||||
public static create(properties?: proto.HandshakeMessage.IClientFinish): proto.HandshakeMessage.ClientFinish;
|
||||
public static encode(m: proto.HandshakeMessage.IClientFinish, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.HandshakeMessage.ClientFinish;
|
||||
@@ -4706,6 +4756,9 @@ export namespace proto {
|
||||
payload?: (Uint8Array|null);
|
||||
useExtended?: (boolean|null);
|
||||
extendedCiphertext?: (Uint8Array|null);
|
||||
paddedBytes?: (Uint8Array|null);
|
||||
sendServerHelloPaddedBytes?: (boolean|null);
|
||||
simulateXxkemFs?: (boolean|null);
|
||||
}
|
||||
|
||||
class ClientHello implements IClientHello {
|
||||
@@ -4715,6 +4768,9 @@ export namespace proto {
|
||||
public payload?: (Uint8Array|null);
|
||||
public useExtended?: (boolean|null);
|
||||
public extendedCiphertext?: (Uint8Array|null);
|
||||
public paddedBytes?: (Uint8Array|null);
|
||||
public sendServerHelloPaddedBytes?: (boolean|null);
|
||||
public simulateXxkemFs?: (boolean|null);
|
||||
public static create(properties?: proto.HandshakeMessage.IClientHello): proto.HandshakeMessage.ClientHello;
|
||||
public static encode(m: proto.HandshakeMessage.IClientHello, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.HandshakeMessage.ClientHello;
|
||||
@@ -4729,6 +4785,7 @@ export namespace proto {
|
||||
"static"?: (Uint8Array|null);
|
||||
payload?: (Uint8Array|null);
|
||||
extendedStatic?: (Uint8Array|null);
|
||||
paddingBytes?: (Uint8Array|null);
|
||||
}
|
||||
|
||||
class ServerHello implements IServerHello {
|
||||
@@ -4737,6 +4794,7 @@ export namespace proto {
|
||||
public static?: (Uint8Array|null);
|
||||
public payload?: (Uint8Array|null);
|
||||
public extendedStatic?: (Uint8Array|null);
|
||||
public paddingBytes?: (Uint8Array|null);
|
||||
public static create(properties?: proto.HandshakeMessage.IServerHello): proto.HandshakeMessage.ServerHello;
|
||||
public static encode(m: proto.HandshakeMessage.IServerHello, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.HandshakeMessage.ServerHello;
|
||||
@@ -5546,6 +5604,7 @@ export namespace proto {
|
||||
pollCreationMessageV6?: (proto.Message.IPollCreationMessage|null);
|
||||
conditionalRevealMessage?: (proto.Message.IConditionalRevealMessage|null);
|
||||
pollAddOptionMessage?: (proto.Message.IPollAddOptionMessage|null);
|
||||
eventInviteMessage?: (proto.Message.IEventInviteMessage|null);
|
||||
}
|
||||
|
||||
class Message implements IMessage {
|
||||
@@ -5651,6 +5710,7 @@ export namespace proto {
|
||||
public pollCreationMessageV6?: (proto.Message.IPollCreationMessage|null);
|
||||
public conditionalRevealMessage?: (proto.Message.IConditionalRevealMessage|null);
|
||||
public pollAddOptionMessage?: (proto.Message.IPollAddOptionMessage|null);
|
||||
public eventInviteMessage?: (proto.Message.IEventInviteMessage|null);
|
||||
public static create(properties?: proto.IMessage): proto.Message;
|
||||
public static encode(m: proto.IMessage, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.Message;
|
||||
@@ -6454,6 +6514,34 @@ export namespace proto {
|
||||
public static getTypeUrl(typeUrlPrefix?: string): string;
|
||||
}
|
||||
|
||||
interface IEventInviteMessage {
|
||||
contextInfo?: (proto.IContextInfo|null);
|
||||
eventId?: (string|null);
|
||||
eventTitle?: (string|null);
|
||||
jpegThumbnail?: (Uint8Array|null);
|
||||
startTime?: (number|Long|null);
|
||||
caption?: (string|null);
|
||||
isCanceled?: (boolean|null);
|
||||
}
|
||||
|
||||
class EventInviteMessage implements IEventInviteMessage {
|
||||
constructor(p?: proto.Message.IEventInviteMessage);
|
||||
public contextInfo?: (proto.IContextInfo|null);
|
||||
public eventId?: (string|null);
|
||||
public eventTitle?: (string|null);
|
||||
public jpegThumbnail?: (Uint8Array|null);
|
||||
public startTime?: (number|Long|null);
|
||||
public caption?: (string|null);
|
||||
public isCanceled?: (boolean|null);
|
||||
public static create(properties?: proto.Message.IEventInviteMessage): proto.Message.EventInviteMessage;
|
||||
public static encode(m: proto.Message.IEventInviteMessage, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.Message.EventInviteMessage;
|
||||
public static fromObject(d: { [k: string]: any }): proto.Message.EventInviteMessage;
|
||||
public static toObject(m: proto.Message.EventInviteMessage, o?: $protobuf.IConversionOptions): { [k: string]: any };
|
||||
public toJSON(): { [k: string]: any };
|
||||
public static getTypeUrl(typeUrlPrefix?: string): string;
|
||||
}
|
||||
|
||||
interface IEventMessage {
|
||||
contextInfo?: (proto.IContextInfo|null);
|
||||
isCanceled?: (boolean|null);
|
||||
@@ -7818,17 +7906,19 @@ export namespace proto {
|
||||
|
||||
interface IMessageHistoryMetadata {
|
||||
historyReceivers?: (string[]|null);
|
||||
oldestMessageTimestamp?: (number|Long|null);
|
||||
oldestMessageTimestampInWindow?: (number|Long|null);
|
||||
messageCount?: (number|Long|null);
|
||||
nonHistoryReceivers?: (string[]|null);
|
||||
oldestMessageTimestampInBundle?: (number|Long|null);
|
||||
}
|
||||
|
||||
class MessageHistoryMetadata implements IMessageHistoryMetadata {
|
||||
constructor(p?: proto.Message.IMessageHistoryMetadata);
|
||||
public historyReceivers: string[];
|
||||
public oldestMessageTimestamp?: (number|Long|null);
|
||||
public oldestMessageTimestampInWindow?: (number|Long|null);
|
||||
public messageCount?: (number|Long|null);
|
||||
public nonHistoryReceivers: string[];
|
||||
public oldestMessageTimestampInBundle?: (number|Long|null);
|
||||
public static create(properties?: proto.Message.IMessageHistoryMetadata): proto.Message.MessageHistoryMetadata;
|
||||
public static encode(m: proto.Message.IMessageHistoryMetadata, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.Message.MessageHistoryMetadata;
|
||||
@@ -7986,6 +8076,7 @@ export namespace proto {
|
||||
expiryTimestamp?: (number|Long|null);
|
||||
incentiveEligible?: (boolean|null);
|
||||
referralId?: (string|null);
|
||||
inviteType?: (proto.Message.PaymentInviteMessage.InviteType|null);
|
||||
}
|
||||
|
||||
class PaymentInviteMessage implements IPaymentInviteMessage {
|
||||
@@ -7994,6 +8085,7 @@ export namespace proto {
|
||||
public expiryTimestamp?: (number|Long|null);
|
||||
public incentiveEligible?: (boolean|null);
|
||||
public referralId?: (string|null);
|
||||
public inviteType?: (proto.Message.PaymentInviteMessage.InviteType|null);
|
||||
public static create(properties?: proto.Message.IPaymentInviteMessage): proto.Message.PaymentInviteMessage;
|
||||
public static encode(m: proto.Message.IPaymentInviteMessage, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.Message.PaymentInviteMessage;
|
||||
@@ -8005,6 +8097,11 @@ export namespace proto {
|
||||
|
||||
namespace PaymentInviteMessage {
|
||||
|
||||
enum InviteType {
|
||||
DEFAULT = 0,
|
||||
MAPPER = 1
|
||||
}
|
||||
|
||||
enum ServiceType {
|
||||
UNKNOWN = 0,
|
||||
FBPAY = 1,
|
||||
@@ -9170,7 +9267,8 @@ export namespace proto {
|
||||
AI_QUERY_FANOUT = 29,
|
||||
GROUP_MEMBER_LABEL_CHANGE = 30,
|
||||
AI_MEDIA_COLLECTION_MESSAGE = 31,
|
||||
MESSAGE_UNSCHEDULE = 32
|
||||
MESSAGE_UNSCHEDULE = 32,
|
||||
BOT_UNLINK_MESSAGE = 33
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9261,12 +9359,14 @@ export namespace proto {
|
||||
interface IRequestWelcomeMessageMetadata {
|
||||
localChatState?: (proto.Message.RequestWelcomeMessageMetadata.LocalChatState|null);
|
||||
welcomeTrigger?: (proto.Message.RequestWelcomeMessageMetadata.WelcomeTrigger|null);
|
||||
botAgentMetadata?: (proto.IBotAgentMetadata|null);
|
||||
}
|
||||
|
||||
class RequestWelcomeMessageMetadata implements IRequestWelcomeMessageMetadata {
|
||||
constructor(p?: proto.Message.IRequestWelcomeMessageMetadata);
|
||||
public localChatState?: (proto.Message.RequestWelcomeMessageMetadata.LocalChatState|null);
|
||||
public welcomeTrigger?: (proto.Message.RequestWelcomeMessageMetadata.WelcomeTrigger|null);
|
||||
public botAgentMetadata?: (proto.IBotAgentMetadata|null);
|
||||
public static create(properties?: proto.Message.IRequestWelcomeMessageMetadata): proto.Message.RequestWelcomeMessageMetadata;
|
||||
public static encode(m: proto.Message.IRequestWelcomeMessageMetadata, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.Message.RequestWelcomeMessageMetadata;
|
||||
@@ -10462,6 +10562,8 @@ export namespace proto {
|
||||
BUSINESS_BROADCAST_CAMPAIGN_ACTION = 81,
|
||||
BUSINESS_BROADCAST_INSIGHTS_ACTION = 82,
|
||||
CUSTOMER_DATA_ACTION = 83,
|
||||
SUBSCRIPTIONS_SYNC_V2_ACTION = 84,
|
||||
THREAD_PIN_ACTION = 85,
|
||||
SHARE_OWN_PN = 10001,
|
||||
BUSINESS_BROADCAST_ACTION = 10002,
|
||||
AI_THREAD_DELETE_ACTION = 10003
|
||||
@@ -11745,7 +11847,8 @@ export namespace proto {
|
||||
THREADS = 7,
|
||||
APPLE_MUSIC = 8,
|
||||
SHARECHAT = 9,
|
||||
GOOGLE_PHOTOS = 10
|
||||
GOOGLE_PHOTOS = 10,
|
||||
SOUNDCLOUD = 11
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12056,6 +12159,8 @@ export namespace proto {
|
||||
businessBroadcastCampaignAction?: (proto.SyncActionValue.IBusinessBroadcastCampaignAction|null);
|
||||
businessBroadcastInsightsAction?: (proto.SyncActionValue.IBusinessBroadcastInsightsAction|null);
|
||||
customerDataAction?: (proto.SyncActionValue.ICustomerDataAction|null);
|
||||
subscriptionsSyncV2Action?: (proto.SyncActionValue.ISubscriptionsSyncV2Action|null);
|
||||
threadPinAction?: (proto.SyncActionValue.IThreadPinAction|null);
|
||||
}
|
||||
|
||||
class SyncActionValue implements ISyncActionValue {
|
||||
@@ -12134,6 +12239,8 @@ export namespace proto {
|
||||
public businessBroadcastCampaignAction?: (proto.SyncActionValue.IBusinessBroadcastCampaignAction|null);
|
||||
public businessBroadcastInsightsAction?: (proto.SyncActionValue.IBusinessBroadcastInsightsAction|null);
|
||||
public customerDataAction?: (proto.SyncActionValue.ICustomerDataAction|null);
|
||||
public subscriptionsSyncV2Action?: (proto.SyncActionValue.ISubscriptionsSyncV2Action|null);
|
||||
public threadPinAction?: (proto.SyncActionValue.IThreadPinAction|null);
|
||||
public static create(properties?: proto.ISyncActionValue): proto.SyncActionValue;
|
||||
public static encode(m: proto.ISyncActionValue, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.SyncActionValue;
|
||||
@@ -13666,6 +13773,79 @@ export namespace proto {
|
||||
public static getTypeUrl(typeUrlPrefix?: string): string;
|
||||
}
|
||||
|
||||
interface ISubscriptionsSyncV2Action {
|
||||
subscriptions?: (proto.SyncActionValue.SubscriptionsSyncV2Action.ISubscriptionInfo[]|null);
|
||||
paidFeature?: (proto.SyncActionValue.SubscriptionsSyncV2Action.IPaidFeature[]|null);
|
||||
}
|
||||
|
||||
class SubscriptionsSyncV2Action implements ISubscriptionsSyncV2Action {
|
||||
constructor(p?: proto.SyncActionValue.ISubscriptionsSyncV2Action);
|
||||
public subscriptions: proto.SyncActionValue.SubscriptionsSyncV2Action.ISubscriptionInfo[];
|
||||
public paidFeature: proto.SyncActionValue.SubscriptionsSyncV2Action.IPaidFeature[];
|
||||
public static create(properties?: proto.SyncActionValue.ISubscriptionsSyncV2Action): proto.SyncActionValue.SubscriptionsSyncV2Action;
|
||||
public static encode(m: proto.SyncActionValue.ISubscriptionsSyncV2Action, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.SyncActionValue.SubscriptionsSyncV2Action;
|
||||
public static fromObject(d: { [k: string]: any }): proto.SyncActionValue.SubscriptionsSyncV2Action;
|
||||
public static toObject(m: proto.SyncActionValue.SubscriptionsSyncV2Action, o?: $protobuf.IConversionOptions): { [k: string]: any };
|
||||
public toJSON(): { [k: string]: any };
|
||||
public static getTypeUrl(typeUrlPrefix?: string): string;
|
||||
}
|
||||
|
||||
namespace SubscriptionsSyncV2Action {
|
||||
|
||||
interface IPaidFeature {
|
||||
name?: (string|null);
|
||||
enabled?: (boolean|null);
|
||||
limit?: (number|null);
|
||||
expirationTime?: (number|Long|null);
|
||||
}
|
||||
|
||||
class PaidFeature implements IPaidFeature {
|
||||
constructor(p?: proto.SyncActionValue.SubscriptionsSyncV2Action.IPaidFeature);
|
||||
public name?: (string|null);
|
||||
public enabled?: (boolean|null);
|
||||
public limit?: (number|null);
|
||||
public expirationTime?: (number|Long|null);
|
||||
public static create(properties?: proto.SyncActionValue.SubscriptionsSyncV2Action.IPaidFeature): proto.SyncActionValue.SubscriptionsSyncV2Action.PaidFeature;
|
||||
public static encode(m: proto.SyncActionValue.SubscriptionsSyncV2Action.IPaidFeature, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.SyncActionValue.SubscriptionsSyncV2Action.PaidFeature;
|
||||
public static fromObject(d: { [k: string]: any }): proto.SyncActionValue.SubscriptionsSyncV2Action.PaidFeature;
|
||||
public static toObject(m: proto.SyncActionValue.SubscriptionsSyncV2Action.PaidFeature, o?: $protobuf.IConversionOptions): { [k: string]: any };
|
||||
public toJSON(): { [k: string]: any };
|
||||
public static getTypeUrl(typeUrlPrefix?: string): string;
|
||||
}
|
||||
|
||||
interface ISubscriptionInfo {
|
||||
id?: (string|null);
|
||||
tier?: (number|null);
|
||||
status?: (string|null);
|
||||
startTime?: (number|Long|null);
|
||||
endTime?: (number|Long|null);
|
||||
isPlatformChanged?: (boolean|null);
|
||||
source?: (string|null);
|
||||
creationTime?: (number|Long|null);
|
||||
}
|
||||
|
||||
class SubscriptionInfo implements ISubscriptionInfo {
|
||||
constructor(p?: proto.SyncActionValue.SubscriptionsSyncV2Action.ISubscriptionInfo);
|
||||
public id?: (string|null);
|
||||
public tier?: (number|null);
|
||||
public status?: (string|null);
|
||||
public startTime?: (number|Long|null);
|
||||
public endTime?: (number|Long|null);
|
||||
public isPlatformChanged?: (boolean|null);
|
||||
public source?: (string|null);
|
||||
public creationTime?: (number|Long|null);
|
||||
public static create(properties?: proto.SyncActionValue.SubscriptionsSyncV2Action.ISubscriptionInfo): proto.SyncActionValue.SubscriptionsSyncV2Action.SubscriptionInfo;
|
||||
public static encode(m: proto.SyncActionValue.SubscriptionsSyncV2Action.ISubscriptionInfo, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.SyncActionValue.SubscriptionsSyncV2Action.SubscriptionInfo;
|
||||
public static fromObject(d: { [k: string]: any }): proto.SyncActionValue.SubscriptionsSyncV2Action.SubscriptionInfo;
|
||||
public static toObject(m: proto.SyncActionValue.SubscriptionsSyncV2Action.SubscriptionInfo, o?: $protobuf.IConversionOptions): { [k: string]: any };
|
||||
public toJSON(): { [k: string]: any };
|
||||
public static getTypeUrl(typeUrlPrefix?: string): string;
|
||||
}
|
||||
}
|
||||
|
||||
interface ISyncActionMessage {
|
||||
key?: (proto.IMessageKey|null);
|
||||
timestamp?: (number|Long|null);
|
||||
@@ -13704,6 +13884,22 @@ export namespace proto {
|
||||
public static getTypeUrl(typeUrlPrefix?: string): string;
|
||||
}
|
||||
|
||||
interface IThreadPinAction {
|
||||
pinned?: (boolean|null);
|
||||
}
|
||||
|
||||
class ThreadPinAction implements IThreadPinAction {
|
||||
constructor(p?: proto.SyncActionValue.IThreadPinAction);
|
||||
public pinned?: (boolean|null);
|
||||
public static create(properties?: proto.SyncActionValue.IThreadPinAction): proto.SyncActionValue.ThreadPinAction;
|
||||
public static encode(m: proto.SyncActionValue.IThreadPinAction, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.SyncActionValue.ThreadPinAction;
|
||||
public static fromObject(d: { [k: string]: any }): proto.SyncActionValue.ThreadPinAction;
|
||||
public static toObject(m: proto.SyncActionValue.ThreadPinAction, o?: $protobuf.IConversionOptions): { [k: string]: any };
|
||||
public toJSON(): { [k: string]: any };
|
||||
public static getTypeUrl(typeUrlPrefix?: string): string;
|
||||
}
|
||||
|
||||
interface ITimeFormatAction {
|
||||
isTwentyFourHourFormatEnabled?: (boolean|null);
|
||||
}
|
||||
|
||||
+1515
-19
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -47,7 +47,7 @@
|
||||
"fflate": "^0.8.2",
|
||||
"libsignal": "github:whiskeysockets/libsignal-node",
|
||||
"lru-cache": "^11.2.6",
|
||||
"music-metadata": "^11.12.0",
|
||||
"music-metadata": "^11.12.3",
|
||||
"p-queue": "^9.0.0",
|
||||
"pino": "^10.3.1",
|
||||
"prom-client": "^15.1.3",
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":[2,3000,1034641024]}
|
||||
{"version":[2,3000,1035223526]}
|
||||
|
||||
+160
-875
File diff suppressed because it is too large
Load Diff
@@ -160,7 +160,7 @@ export const extractImageThumb = async (bufferOrFilePath: Readable | Buffer | st
|
||||
height: dimensions.height
|
||||
}
|
||||
}
|
||||
} else if ('jimp' in lib && typeof lib.jimp?.Jimp === 'object') {
|
||||
} else if ('jimp' in lib && (typeof lib.jimp?.Jimp === 'object' || typeof lib.jimp?.Jimp === 'function')) {
|
||||
const jimp = await (lib.jimp.Jimp as any).read(bufferOrFilePath)
|
||||
const dimensions = {
|
||||
width: jimp.width,
|
||||
|
||||
+96
-11
@@ -41,10 +41,12 @@ import type { ILogger } from './logger'
|
||||
import {
|
||||
downloadContentFromMessage,
|
||||
encryptedStream,
|
||||
extractImageThumb,
|
||||
generateThumbnail,
|
||||
getAudioDuration,
|
||||
getAudioWaveform,
|
||||
getRawMediaUploadData,
|
||||
getStream,
|
||||
type MediaDownloadOptions
|
||||
} from './messages-media'
|
||||
import { shouldIncludeReportingToken } from './reporting-utils'
|
||||
@@ -473,6 +475,48 @@ export const formatNativeFlowButton = (button: NativeButton): NativeFlowButton =
|
||||
}
|
||||
}
|
||||
|
||||
const recoverCarouselImageMetadata = async (
|
||||
card: CarouselMessageOptions['cards'][number],
|
||||
imageMessage: proto.Message.IImageMessage,
|
||||
mediaOptions: MessageContentGenerationOptions
|
||||
) => {
|
||||
if (imageMessage.jpegThumbnail && imageMessage.height && imageMessage.width) {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const { stream } = await getStream(card.image!, mediaOptions.options)
|
||||
const thumb = await extractImageThumb(stream)
|
||||
|
||||
if (!imageMessage.jpegThumbnail) {
|
||||
imageMessage.jpegThumbnail = thumb.buffer
|
||||
}
|
||||
|
||||
if (!imageMessage.width && thumb.original.width) {
|
||||
imageMessage.width = thumb.original.width
|
||||
}
|
||||
|
||||
if (!imageMessage.height && thumb.original.height) {
|
||||
imageMessage.height = thumb.original.height
|
||||
}
|
||||
|
||||
mediaOptions.logger?.info(
|
||||
{
|
||||
cardTitle: card.title,
|
||||
hasJpegThumbnail: !!imageMessage.jpegThumbnail,
|
||||
width: imageMessage.width,
|
||||
height: imageMessage.height
|
||||
},
|
||||
'[CAROUSEL] Recovered image thumbnail/dimensions from source media'
|
||||
)
|
||||
} catch (error) {
|
||||
mediaOptions.logger?.warn(
|
||||
{ cardTitle: card.title, error },
|
||||
'[CAROUSEL] Failed to recover image thumbnail/dimensions from source media'
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a button message using Native Flow format wrapped in viewOnceMessage
|
||||
* This is the modern approach for button messages that works on iOS and Android
|
||||
@@ -648,7 +692,10 @@ export const generateCarouselMessage = async (
|
||||
if (hasMedia && mediaOptions) {
|
||||
if (card.image) {
|
||||
const { imageMessage } = await prepareWAMessageMedia({ image: card.image }, mediaOptions)
|
||||
// Validate image fields needed for WhatsApp rendering
|
||||
if (imageMessage) {
|
||||
await recoverCarouselImageMetadata(card, imageMessage, mediaOptions)
|
||||
}
|
||||
|
||||
if (imageMessage && !imageMessage.jpegThumbnail) {
|
||||
mediaOptions.logger?.warn(
|
||||
{ cardTitle: card.title },
|
||||
@@ -1228,19 +1275,57 @@ export const generateWAMessageContent = async (
|
||||
options.logger?.info('Sending CTA buttons as nativeFlowMessage with viewOnceMessage wrapper')
|
||||
}
|
||||
}
|
||||
// Check for nativeCarousel
|
||||
// Check for nativeCarousel — inline handler (validated on Android, iOS, Web)
|
||||
// Direct interactiveMessage at root (field 45), NO viewOnceMessage wrapper,
|
||||
// NO messageContextInfo, NO biz/bot stanza nodes needed
|
||||
else if (hasNonNullishProperty(message, 'nativeCarousel')) {
|
||||
const carouselMsg = message as any
|
||||
const carouselOptions: CarouselMessageOptions = {
|
||||
cards: carouselMsg.nativeCarousel.cards,
|
||||
title: carouselMsg.nativeCarousel.title || carouselMsg.title,
|
||||
text: carouselMsg.text,
|
||||
footer: carouselMsg.footer
|
||||
const cards = carouselMsg.nativeCarousel.cards || []
|
||||
const title = carouselMsg.nativeCarousel.title || carouselMsg.title
|
||||
const text = carouselMsg.text
|
||||
const footer = carouselMsg.footer
|
||||
|
||||
const carouselCards = await Promise.all(
|
||||
cards.map(async (card: any) => {
|
||||
const hasMedia = !!(card.image || card.video)
|
||||
const header: any = {
|
||||
title: card.title || '',
|
||||
subtitle: card.footer || '',
|
||||
hasMediaAttachment: hasMedia
|
||||
}
|
||||
if (hasMedia && card.image) {
|
||||
const { imageMessage } = await prepareWAMessageMedia({ image: card.image }, options)
|
||||
if (imageMessage && !imageMessage.height) imageMessage.height = 500
|
||||
if (imageMessage && !imageMessage.width) imageMessage.width = 500
|
||||
header.imageMessage = imageMessage
|
||||
}
|
||||
return {
|
||||
header,
|
||||
body: { text: card.body || '' },
|
||||
footer: card.footer ? { text: card.footer } : undefined,
|
||||
nativeFlowMessage: {
|
||||
buttons: (card.buttons || []).map((btn: any) => {
|
||||
switch (btn.type) {
|
||||
case 'url': return { name: 'cta_url', buttonParamsJson: JSON.stringify({ display_text: btn.text, url: btn.url, merchant_url: btn.url }) }
|
||||
case 'copy': return { name: 'cta_copy', buttonParamsJson: JSON.stringify({ display_text: btn.text, copy_code: btn.copyText }) }
|
||||
case 'call': return { name: 'cta_call', buttonParamsJson: JSON.stringify({ display_text: btn.text, phone_number: btn.phoneNumber }) }
|
||||
default: return { name: 'quick_reply', buttonParamsJson: JSON.stringify({ display_text: btn.text, id: btn.id }) }
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
m.interactiveMessage = {
|
||||
header: { title: title || ' ', hasMediaAttachment: false },
|
||||
body: { text: text || '' },
|
||||
footer: footer ? { text: footer } : undefined,
|
||||
carouselMessage: {
|
||||
cards: carouselCards,
|
||||
messageVersion: 1
|
||||
}
|
||||
}
|
||||
// Pass options for media processing if cards have images/videos
|
||||
const generated = await generateCarouselMessage(carouselOptions, options)
|
||||
// Direct interactiveMessage — no viewOnceMessage wrapper, no root header/body/footer
|
||||
m.interactiveMessage = generated.interactiveMessage
|
||||
return m
|
||||
}
|
||||
// Check for nativeList
|
||||
|
||||
+18
-12
@@ -154,18 +154,24 @@ export async function storeTcTokensFromIqResult({
|
||||
continue
|
||||
}
|
||||
|
||||
await keys.set({
|
||||
tctoken: {
|
||||
[storageJid]: {
|
||||
...existingEntry,
|
||||
token: Buffer.from(tokenNode.content),
|
||||
timestamp: tokenNode.attrs.t,
|
||||
// WABA Android: resets real_issue_timestamp to null when storing a new token
|
||||
// (UPDATE wa_trusted_contacts_send SET real_issue_timestamp=null)
|
||||
realIssueTimestamp: null
|
||||
}
|
||||
}
|
||||
})
|
||||
const tokenEntry = {
|
||||
...existingEntry,
|
||||
token: Buffer.from(tokenNode.content),
|
||||
timestamp: tokenNode.attrs.t,
|
||||
// Resets real_issue_timestamp to null when storing a new token
|
||||
realIssueTimestamp: null
|
||||
}
|
||||
|
||||
// Store under resolved storageJid AND under fallbackJid (PN) for reliable lookup
|
||||
const normalizedFallback = jidNormalizedUser(fallbackJid)
|
||||
const keysToStore: Record<string, typeof tokenEntry | null> = {
|
||||
[storageJid]: tokenEntry
|
||||
}
|
||||
if (normalizedFallback !== storageJid) {
|
||||
keysToStore[normalizedFallback] = tokenEntry
|
||||
}
|
||||
|
||||
await keys.set({ tctoken: keysToStore })
|
||||
onNewJidStored?.(storageJid)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,24 +14,19 @@ import { encodeBigEndian } from './generics'
|
||||
import { createSignalIdentity } from './signal'
|
||||
|
||||
const getUserAgent = (config: SocketConfig): proto.ClientPayload.IUserAgent => {
|
||||
// Always use MACOS/Desktop identity for UserAgent — we connect via web
|
||||
// protocol (WA\x06\x03) so the server expects a web-like UserAgent.
|
||||
// Using SMB_ANDROID here causes pair code registration to fail with
|
||||
// "não é possível conectar" even though the phone shows the confirmation.
|
||||
// Android identity is only set in DeviceProps (registration node) which
|
||||
// determines the display name in "Linked Devices".
|
||||
return {
|
||||
appVersion: {
|
||||
primary: config.version[0],
|
||||
secondary: config.version[1],
|
||||
tertiary: config.version[2]
|
||||
},
|
||||
platform: proto.ClientPayload.UserAgent.Platform.MACOS,
|
||||
platform: proto.ClientPayload.UserAgent.Platform.WEB,
|
||||
releaseChannel: proto.ClientPayload.UserAgent.ReleaseChannel.RELEASE,
|
||||
osVersion: '0.1',
|
||||
device: 'Desktop',
|
||||
osBuildNumber: '0.1',
|
||||
localeLanguageIso6391: 'en',
|
||||
|
||||
mnc: '000',
|
||||
mcc: '000',
|
||||
localeCountryIso31661Alpha2: config.countryCode
|
||||
@@ -60,20 +55,16 @@ const getClientPayload = (config: SocketConfig) => {
|
||||
const payload: proto.IClientPayload = {
|
||||
connectType: proto.ClientPayload.ConnectType.WIFI_UNKNOWN,
|
||||
connectReason: proto.ClientPayload.ConnectReason.USER_ACTIVATED,
|
||||
userAgent: getUserAgent(config),
|
||||
webInfo: getWebInfo(config)
|
||||
userAgent: getUserAgent(config)
|
||||
}
|
||||
|
||||
payload.webInfo = getWebInfo(config)
|
||||
|
||||
return payload
|
||||
}
|
||||
|
||||
export const generateLoginNode = (userJid: string, config: SocketConfig): proto.IClientPayload => {
|
||||
const decoded = jidDecode(userJid)
|
||||
if (!decoded) {
|
||||
throw new Boom('Invalid user JID', { statusCode: 400 })
|
||||
}
|
||||
|
||||
const { user, device } = decoded
|
||||
const { user, device } = jidDecode(userJid)!
|
||||
const payload: proto.IClientPayload = {
|
||||
...getClientPayload(config),
|
||||
passive: true,
|
||||
@@ -88,10 +79,6 @@ export const generateLoginNode = (userJid: string, config: SocketConfig): proto.
|
||||
|
||||
const getPlatformType = (platform: string): proto.DeviceProps.PlatformType => {
|
||||
const platformType = platform.toUpperCase()
|
||||
if (platformType === 'ANDROID') {
|
||||
return proto.DeviceProps.PlatformType.ANDROID_PHONE
|
||||
}
|
||||
|
||||
return (
|
||||
proto.DeviceProps.PlatformType[platformType as keyof typeof proto.DeviceProps.PlatformType] ||
|
||||
proto.DeviceProps.PlatformType.CHROME
|
||||
@@ -166,9 +153,6 @@ export const configureSuccessfulPairing = (
|
||||
}: Pick<AuthenticationCreds, 'advSecretKey' | 'signedIdentityKey' | 'signalIdentities'>
|
||||
) => {
|
||||
const msgId = stanza.attrs.id
|
||||
if (!msgId) {
|
||||
throw new Boom('Missing message ID', { statusCode: 400 })
|
||||
}
|
||||
|
||||
const pairSuccessNode = getBinaryNodeChild(stanza, 'pair-success')
|
||||
|
||||
@@ -184,51 +168,42 @@ export const configureSuccessfulPairing = (
|
||||
const bizName = businessNode?.attrs.name
|
||||
const jid = deviceNode.attrs.jid
|
||||
const lid = deviceNode.attrs.lid
|
||||
if (!jid || !lid) {
|
||||
throw new Boom('Missing JID or LID in device node', { statusCode: 400 })
|
||||
}
|
||||
|
||||
const { details, hmac, accountType } = proto.ADVSignedDeviceIdentityHMAC.decode(deviceIdentityNode.content as Buffer)
|
||||
if (!details || !hmac) {
|
||||
throw new Boom('Missing ADV signature fields', { statusCode: 400 })
|
||||
}
|
||||
|
||||
let hmacPrefix = Buffer.from([])
|
||||
if (accountType !== undefined && accountType === proto.ADVEncryptionType.HOSTED) {
|
||||
hmacPrefix = WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX
|
||||
}
|
||||
|
||||
const advSign = hmacSign(Buffer.concat([hmacPrefix, details]), Buffer.from(advSecretKey, 'base64'))
|
||||
if (Buffer.compare(hmac, advSign) !== 0) {
|
||||
const advSign = hmacSign(Buffer.concat([hmacPrefix, details!]), Buffer.from(advSecretKey, 'base64'))
|
||||
if (Buffer.compare(hmac!, advSign) !== 0) {
|
||||
throw new Boom('Invalid account signature')
|
||||
}
|
||||
|
||||
const account = proto.ADVSignedDeviceIdentity.decode(details)
|
||||
const account = proto.ADVSignedDeviceIdentity.decode(details!)
|
||||
const { accountSignatureKey, accountSignature, details: deviceDetails } = account
|
||||
if (!accountSignatureKey || !accountSignature || !deviceDetails) {
|
||||
throw new Boom('Missing ADV account fields', { statusCode: 400 })
|
||||
}
|
||||
|
||||
const deviceIdentity = proto.ADVDeviceIdentity.decode(deviceDetails)
|
||||
const deviceIdentity = proto.ADVDeviceIdentity.decode(deviceDetails!)
|
||||
|
||||
const accountSignaturePrefix =
|
||||
deviceIdentity.deviceType === proto.ADVEncryptionType.HOSTED
|
||||
? WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX
|
||||
: WA_ADV_ACCOUNT_SIG_PREFIX
|
||||
const accountMsg = Buffer.concat([accountSignaturePrefix, deviceDetails, signedIdentityKey.public])
|
||||
if (!Curve.verify(accountSignatureKey, accountMsg, accountSignature)) {
|
||||
const accountMsg = Buffer.concat([accountSignaturePrefix, deviceDetails!, signedIdentityKey.public])
|
||||
if (!Curve.verify(accountSignatureKey!, accountMsg, accountSignature!)) {
|
||||
throw new Boom('Failed to verify account signature')
|
||||
}
|
||||
|
||||
const deviceMsg = Buffer.concat([
|
||||
WA_ADV_DEVICE_SIG_PREFIX,
|
||||
deviceDetails,
|
||||
deviceDetails!,
|
||||
signedIdentityKey.public,
|
||||
accountSignatureKey
|
||||
accountSignatureKey!
|
||||
])
|
||||
account.deviceSignature = Curve.sign(signedIdentityKey.private, deviceMsg)
|
||||
|
||||
const identity = createSignalIdentity(lid, accountSignatureKey)
|
||||
const identity = createSignalIdentity(lid!, accountSignatureKey!)
|
||||
const accountEnc = encodeSignedDeviceIdentity(account, false)
|
||||
|
||||
const reply: BinaryNode = {
|
||||
@@ -236,7 +211,7 @@ export const configureSuccessfulPairing = (
|
||||
attrs: {
|
||||
to: S_WHATSAPP_NET,
|
||||
type: 'result',
|
||||
id: msgId
|
||||
id: msgId!
|
||||
},
|
||||
content: [
|
||||
{
|
||||
@@ -255,7 +230,7 @@ export const configureSuccessfulPairing = (
|
||||
|
||||
const authUpdate: Partial<AuthenticationCreds> = {
|
||||
account,
|
||||
me: { id: jid, name: bizName, lid },
|
||||
me: { id: jid!, name: bizName, lid },
|
||||
signalIdentities: [...(signalIdentities || []), identity],
|
||||
platform: platformNode?.attrs.name
|
||||
}
|
||||
|
||||
@@ -388,6 +388,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@borewit/text-codec@npm:^0.2.2":
|
||||
version: 0.2.2
|
||||
resolution: "@borewit/text-codec@npm:0.2.2"
|
||||
checksum: 10c0/2d3fb132bc6a132914a8fbf8e9ff2fa1ead210ecc395b28bb7355bd7719548a5e351ffe39f21c3bee8048f6cabd99eabd404bb5cc809cad9cba25abed19d271f
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@cacheable/node-cache@npm:^2.0.1":
|
||||
version: 2.0.1
|
||||
resolution: "@cacheable/node-cache@npm:2.0.1"
|
||||
@@ -3105,7 +3112,7 @@ __metadata:
|
||||
libsignal: "github:whiskeysockets/libsignal-node"
|
||||
link-preview-js: "npm:^4.0.0"
|
||||
lru-cache: "npm:^11.2.6"
|
||||
music-metadata: "npm:^11.12.0"
|
||||
music-metadata: "npm:^11.12.3"
|
||||
open: "npm:^11.0.0"
|
||||
p-queue: "npm:^9.0.0"
|
||||
pino: "npm:^10.3.1"
|
||||
@@ -4556,15 +4563,15 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"file-type@npm:^21.3.0":
|
||||
version: 21.3.0
|
||||
resolution: "file-type@npm:21.3.0"
|
||||
"file-type@npm:^21.3.1":
|
||||
version: 21.3.1
|
||||
resolution: "file-type@npm:21.3.1"
|
||||
dependencies:
|
||||
"@tokenizer/inflate": "npm:^0.4.1"
|
||||
strtok3: "npm:^10.3.4"
|
||||
token-types: "npm:^6.1.1"
|
||||
uint8array-extras: "npm:^1.4.0"
|
||||
checksum: 10c0/1b1fa909e6063044a6da1d2ea348ee4d747ed9286382d3f0d4d6532c11fb2ea9f2e7e67b2bc7d745d1bc937e05dee1aa8cb912c64250933bcb393a3744f4e284
|
||||
checksum: 10c0/66a8eda781c803c6fc372464abba88cee564cfe30f029716f06909da1564bc51d0a4e8d34654b881dc751cdb0513338b3c0747e06a608cee0dd5c5499b018d47
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -6504,21 +6511,21 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"music-metadata@npm:^11.12.0":
|
||||
version: 11.12.0
|
||||
resolution: "music-metadata@npm:11.12.0"
|
||||
"music-metadata@npm:^11.12.3":
|
||||
version: 11.12.3
|
||||
resolution: "music-metadata@npm:11.12.3"
|
||||
dependencies:
|
||||
"@borewit/text-codec": "npm:^0.2.1"
|
||||
"@borewit/text-codec": "npm:^0.2.2"
|
||||
"@tokenizer/token": "npm:^0.3.0"
|
||||
content-type: "npm:^1.0.5"
|
||||
debug: "npm:^4.4.3"
|
||||
file-type: "npm:^21.3.0"
|
||||
file-type: "npm:^21.3.1"
|
||||
media-typer: "npm:^1.1.0"
|
||||
strtok3: "npm:^10.3.4"
|
||||
token-types: "npm:^6.1.2"
|
||||
uint8array-extras: "npm:^1.5.0"
|
||||
win-guid: "npm:^0.2.1"
|
||||
checksum: 10c0/014a120b8941ab80452171def0ec3cba013041ba4b94f8061ad493a037d3423e6d316131a13fb0433404685ebd3c8e3ae2255c1bafaeb20673fcd73af2df0148
|
||||
checksum: 10c0/57df905f51ec792e5b4c994645eab64d47d5608b9de11151f54b26fbd5f563598ec04d8aed7f244ef1479030d78ddab8af1ee84dfcee40a93b3241941b50999d
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
||||
Reference in New Issue
Block a user