Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| acfaaff68b | |||
| 4fa7d4ee11 |
+4
-145
@@ -1,7 +1,7 @@
|
||||
syntax = "proto3";
|
||||
package proto;
|
||||
|
||||
/// WhatsApp Version: 2.3000.1035577069
|
||||
/// WhatsApp Version: 2.3000.1034302344
|
||||
|
||||
message ADVDeviceIdentity {
|
||||
optional uint32 rawId = 1;
|
||||
@@ -74,7 +74,6 @@ message AIMediaCollectionMessage {
|
||||
|
||||
message AIMediaCollectionMetadata {
|
||||
optional string collectionId = 1;
|
||||
optional uint32 uploadOrderIndex = 2;
|
||||
}
|
||||
|
||||
message AIQueryFanout {
|
||||
@@ -252,12 +251,10 @@ message AIThreadInfo {
|
||||
optional AIThreadClientInfo clientInfo = 2;
|
||||
message AIThreadClientInfo {
|
||||
optional AIThreadType type = 1;
|
||||
optional string sourceChatJid = 2;
|
||||
enum AIThreadType {
|
||||
UNKNOWN = 0;
|
||||
DEFAULT = 1;
|
||||
INCOGNITO = 2;
|
||||
SIDE_CHAT = 3;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -345,14 +342,6 @@ message BotAgeCollectionMetadata {
|
||||
}
|
||||
}
|
||||
|
||||
message BotAgentDeepLinkMetadata {
|
||||
optional string token = 1;
|
||||
}
|
||||
|
||||
message BotAgentMetadata {
|
||||
optional BotAgentDeepLinkMetadata deepLinkMetadata = 1;
|
||||
}
|
||||
|
||||
message BotCapabilityMetadata {
|
||||
repeated BotCapabilityType capabilities = 1;
|
||||
enum BotCapabilityType {
|
||||
@@ -414,10 +403,6 @@ message BotCapabilityMetadata {
|
||||
RICH_RESPONSE_UR_BLOKS_ENABLED = 55;
|
||||
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;
|
||||
AI_SUBSCRIPTION_ENABLED = 61;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -702,7 +687,6 @@ enum BotMetricsEntryPoint {
|
||||
WEB_INTRO_PANEL = 46;
|
||||
WEB_NAVIGATION_BAR = 47;
|
||||
GROUP_MEMBER = 54;
|
||||
CHATLIST_SEARCH = 55;
|
||||
}
|
||||
message BotMetricsMetadata {
|
||||
optional string destinationId = 1;
|
||||
@@ -1085,7 +1069,6 @@ message ClientPairingProps {
|
||||
optional bool isSyncdPureLidSession = 2;
|
||||
optional bool isSyncdSnapshotRecoveryEnabled = 3;
|
||||
optional bool isHsThumbnailSyncEnabled = 4;
|
||||
optional bytes subscriptionSyncPayload = 5;
|
||||
}
|
||||
|
||||
message ClientPayload {
|
||||
@@ -1123,7 +1106,6 @@ message ClientPayload {
|
||||
optional bool paaLink = 44;
|
||||
optional int32 preacksCount = 45;
|
||||
optional int32 processingQueueSize = 46;
|
||||
repeated string pairedPeripherals = 47;
|
||||
enum AccountType {
|
||||
DEFAULT = 0;
|
||||
GUEST = 1;
|
||||
@@ -1466,7 +1448,6 @@ message ContextInfo {
|
||||
optional AdType adType = 25;
|
||||
optional string wtwaWebsiteUrl = 26;
|
||||
optional string adPreviewUrl = 27;
|
||||
optional bool containsCtwaFlowsAutoReply = 28;
|
||||
enum AdType {
|
||||
CTWA = 0;
|
||||
CAWC = 1;
|
||||
@@ -1621,8 +1602,6 @@ 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;
|
||||
@@ -1649,9 +1628,6 @@ message DeviceCapabilities {
|
||||
|
||||
message BusinessBroadcast {
|
||||
optional bool importListEnabled = 1;
|
||||
optional bool companionSupportEnabled = 2;
|
||||
optional bool campaignSyncEnabled = 3;
|
||||
optional bool insightsSyncEnabled = 4;
|
||||
}
|
||||
|
||||
enum ChatLockSupportLevel {
|
||||
@@ -1726,7 +1702,6 @@ message DeviceProps {
|
||||
optional uint32 thumbnailSyncDaysLimit = 19;
|
||||
optional uint32 initialSyncMaxMessagesPerChat = 20;
|
||||
optional bool supportManusHistory = 21;
|
||||
optional bool supportHatchHistory = 22;
|
||||
}
|
||||
|
||||
enum PlatformType {
|
||||
@@ -1921,8 +1896,6 @@ message HandshakeMessage {
|
||||
optional bytes static = 1;
|
||||
optional bytes payload = 2;
|
||||
optional bytes extendedCiphertext = 3;
|
||||
optional bytes paddedBytes = 4;
|
||||
optional bool simulateXxkemFs = 5;
|
||||
}
|
||||
|
||||
message ClientHello {
|
||||
@@ -1931,29 +1904,13 @@ 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;
|
||||
optional HandshakeMessage.HandshakePqMode pqMode = 9;
|
||||
}
|
||||
|
||||
enum HandshakePqMode {
|
||||
HANDSHAKE_PQ_MODE_UNKNOWN = 0;
|
||||
XXKEM = 1;
|
||||
XXKEM_FS = 2;
|
||||
WA_CLASSICAL = 3;
|
||||
WA_PQ = 4;
|
||||
IKKEM = 5;
|
||||
IKKEM_FS = 6;
|
||||
XXKEM_2 = 7;
|
||||
IKKEM_2 = 8;
|
||||
}
|
||||
message ServerHello {
|
||||
optional bytes ephemeral = 1;
|
||||
optional bytes static = 2;
|
||||
optional bytes payload = 3;
|
||||
optional bytes extendedStatic = 4;
|
||||
optional bytes paddingBytes = 5;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2149,6 +2106,7 @@ message LimitSharing {
|
||||
CHAT_SETTING = 1;
|
||||
BIZ_SUPPORTS_FB_HOSTING = 2;
|
||||
UNKNOWN_GROUP = 3;
|
||||
DEPRECATION = 4;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2309,7 +2267,6 @@ 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;
|
||||
@@ -2590,16 +2547,6 @@ 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;
|
||||
@@ -2851,13 +2798,6 @@ message Message {
|
||||
optional bool securityNotificationEnabled = 1;
|
||||
}
|
||||
|
||||
enum InsightDeliveryState {
|
||||
SENT = 0;
|
||||
DELIVERED = 1;
|
||||
READ = 2;
|
||||
REPLIED = 3;
|
||||
QUICK_REPLIED = 4;
|
||||
}
|
||||
message InteractiveMessage {
|
||||
optional Header header = 1;
|
||||
optional Body body = 2;
|
||||
@@ -3126,10 +3066,9 @@ message Message {
|
||||
|
||||
message MessageHistoryMetadata {
|
||||
repeated string historyReceivers = 1;
|
||||
optional int64 oldestMessageTimestampInWindow = 2;
|
||||
optional int64 oldestMessageTimestamp = 2;
|
||||
optional int64 messageCount = 3;
|
||||
repeated string nonHistoryReceivers = 4;
|
||||
optional int64 oldestMessageTimestampInBundle = 5;
|
||||
}
|
||||
|
||||
message MessageHistoryNotice {
|
||||
@@ -3190,11 +3129,6 @@ 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;
|
||||
@@ -3236,16 +3170,6 @@ message Message {
|
||||
optional HistorySyncChunkRetryRequest historySyncChunkRetryRequest = 8;
|
||||
optional GalaxyFlowAction galaxyFlowAction = 9;
|
||||
optional CompanionCanonicalUserNonceFetchRequest companionCanonicalUserNonceFetchRequest = 10;
|
||||
optional BizBroadcastInsightsContactListRequest bizBroadcastInsightsContactListRequest = 11;
|
||||
optional BizBroadcastInsightsRefreshRequest bizBroadcastInsightsRefreshRequest = 12;
|
||||
message BizBroadcastInsightsContactListRequest {
|
||||
optional string campaignId = 1;
|
||||
}
|
||||
|
||||
message BizBroadcastInsightsRefreshRequest {
|
||||
optional string campaignId = 1;
|
||||
}
|
||||
|
||||
message CompanionCanonicalUserNonceFetchRequest {
|
||||
optional string registrationTraceId = 1;
|
||||
}
|
||||
@@ -3320,18 +3244,6 @@ message Message {
|
||||
optional CompanionCanonicalUserNonceFetchResponse companionCanonicalUserNonceFetchRequestResponse = 9;
|
||||
optional HistorySyncChunkRetryResponse historySyncChunkRetryResponse = 10;
|
||||
optional FlowResponsesCsvBundle flowResponsesCsvBundle = 11;
|
||||
optional BizBroadcastInsightsContactListResponse bizBroadcastInsightsContactListResponse = 12;
|
||||
message BizBroadcastInsightsContactListResponse {
|
||||
optional string campaignId = 1;
|
||||
optional int64 timestampMs = 2;
|
||||
repeated Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.BizBroadcastInsightsContactState contacts = 3;
|
||||
}
|
||||
|
||||
message BizBroadcastInsightsContactState {
|
||||
optional string contactJid = 1;
|
||||
optional Message.InsightDeliveryState state = 2;
|
||||
}
|
||||
|
||||
message CompanionCanonicalUserNonceFetchResponse {
|
||||
optional string nonce = 1;
|
||||
optional string waFbid = 2;
|
||||
@@ -3445,8 +3357,6 @@ message Message {
|
||||
COMPANION_CANONICAL_USER_NONCE_FETCH = 9;
|
||||
HISTORY_SYNC_CHUNK_RETRY = 10;
|
||||
GALAXY_FLOW_ACTION = 11;
|
||||
BUSINESS_BROADCAST_INSIGHTS_DELIVERED_TO = 12;
|
||||
BUSINESS_BROADCAST_INSIGHTS_REFRESH = 13;
|
||||
}
|
||||
message PinInChatMessage {
|
||||
optional MessageKey key = 1;
|
||||
@@ -3616,7 +3526,6 @@ message Message {
|
||||
GROUP_MEMBER_LABEL_CHANGE = 30;
|
||||
AI_MEDIA_COLLECTION_MESSAGE = 31;
|
||||
MESSAGE_UNSCHEDULE = 32;
|
||||
BOT_UNLINK_MESSAGE = 33;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3649,7 +3558,6 @@ message Message {
|
||||
message RequestWelcomeMessageMetadata {
|
||||
optional LocalChatState localChatState = 1;
|
||||
optional WelcomeTrigger welcomeTrigger = 2;
|
||||
optional BotAgentMetadata botAgentMetadata = 3;
|
||||
enum LocalChatState {
|
||||
EMPTY = 0;
|
||||
NON_EMPTY = 1;
|
||||
@@ -4059,7 +3967,6 @@ message MsgOpaqueData {
|
||||
optional string quarantineExtractedText = 48;
|
||||
optional int64 pollEndTime = 49;
|
||||
optional bool pollHideVoterNames = 50;
|
||||
optional bool pollAllowAddOption = 52;
|
||||
message EventLocation {
|
||||
optional double degreesLatitude = 1;
|
||||
optional double degreesLongitude = 2;
|
||||
@@ -4176,9 +4083,6 @@ enum MutationProps {
|
||||
NCT_SALT_SYNC_ACTION = 80;
|
||||
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;
|
||||
@@ -4647,7 +4551,6 @@ message StatusAttribution {
|
||||
APPLE_MUSIC = 8;
|
||||
SHARECHAT = 9;
|
||||
GOOGLE_PHOTOS = 10;
|
||||
SOUNDCLOUD = 11;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4815,9 +4718,6 @@ message SyncActionValue {
|
||||
optional NctSaltSyncAction nctSaltSyncAction = 80;
|
||||
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;
|
||||
@@ -4892,7 +4792,6 @@ message SyncActionValue {
|
||||
repeated SyncActionValue.BroadcastListParticipant participants = 2;
|
||||
optional string listName = 3;
|
||||
repeated string labelIds = 4;
|
||||
optional string audienceExpression = 5;
|
||||
}
|
||||
|
||||
message CallLogAction {
|
||||
@@ -4940,20 +4839,6 @@ message SyncActionValue {
|
||||
repeated SyncActionValue.CustomPaymentMethod customPaymentMethods = 1;
|
||||
}
|
||||
|
||||
message CustomerDataAction {
|
||||
optional string chatJid = 1;
|
||||
optional int32 contactType = 2;
|
||||
optional string email = 3;
|
||||
optional string altPhoneNumbers = 4;
|
||||
optional int64 birthday = 5;
|
||||
optional string address = 6;
|
||||
optional int32 acquisitionSource = 7;
|
||||
optional int32 leadStage = 8;
|
||||
optional int64 lastOrder = 9;
|
||||
optional int64 createdAt = 10;
|
||||
optional int64 modifiedAt = 11;
|
||||
}
|
||||
|
||||
message DeleteChatAction {
|
||||
optional SyncActionValue.SyncActionMessageRange messageRange = 1;
|
||||
}
|
||||
@@ -5334,29 +5219,6 @@ 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;
|
||||
@@ -5368,10 +5230,6 @@ message SyncActionValue {
|
||||
repeated SyncActionValue.SyncActionMessage messages = 3;
|
||||
}
|
||||
|
||||
message ThreadPinAction {
|
||||
optional bool pinned = 1;
|
||||
}
|
||||
|
||||
message TimeFormatAction {
|
||||
optional bool isTwentyFourHourFormatEnabled = 1;
|
||||
}
|
||||
@@ -5493,6 +5351,7 @@ message TemplateButton {
|
||||
message ThreadID {
|
||||
optional ThreadType threadType = 1;
|
||||
optional MessageKey threadKey = 2;
|
||||
optional string sourceChatJid = 3;
|
||||
enum ThreadType {
|
||||
UNKNOWN = 0;
|
||||
VIEW_REPLIES = 1;
|
||||
|
||||
Vendored
+12
-362
@@ -203,13 +203,11 @@ export namespace proto {
|
||||
|
||||
interface IAIMediaCollectionMetadata {
|
||||
collectionId?: (string|null);
|
||||
uploadOrderIndex?: (number|null);
|
||||
}
|
||||
|
||||
class AIMediaCollectionMetadata implements IAIMediaCollectionMetadata {
|
||||
constructor(p?: proto.IAIMediaCollectionMetadata);
|
||||
public collectionId?: (string|null);
|
||||
public uploadOrderIndex?: (number|null);
|
||||
public static create(properties?: proto.IAIMediaCollectionMetadata): proto.AIMediaCollectionMetadata;
|
||||
public static encode(m: proto.IAIMediaCollectionMetadata, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.AIMediaCollectionMetadata;
|
||||
@@ -727,13 +725,11 @@ export namespace proto {
|
||||
|
||||
interface IAIThreadClientInfo {
|
||||
type?: (proto.AIThreadInfo.AIThreadClientInfo.AIThreadType|null);
|
||||
sourceChatJid?: (string|null);
|
||||
}
|
||||
|
||||
class AIThreadClientInfo implements IAIThreadClientInfo {
|
||||
constructor(p?: proto.AIThreadInfo.IAIThreadClientInfo);
|
||||
public type?: (proto.AIThreadInfo.AIThreadClientInfo.AIThreadType|null);
|
||||
public sourceChatJid?: (string|null);
|
||||
public static create(properties?: proto.AIThreadInfo.IAIThreadClientInfo): proto.AIThreadInfo.AIThreadClientInfo;
|
||||
public static encode(m: proto.AIThreadInfo.IAIThreadClientInfo, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.AIThreadInfo.AIThreadClientInfo;
|
||||
@@ -748,8 +744,7 @@ export namespace proto {
|
||||
enum AIThreadType {
|
||||
UNKNOWN = 0,
|
||||
DEFAULT = 1,
|
||||
INCOGNITO = 2,
|
||||
SIDE_CHAT = 3
|
||||
INCOGNITO = 2
|
||||
}
|
||||
}
|
||||
|
||||
@@ -981,38 +976,6 @@ 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);
|
||||
}
|
||||
@@ -1089,11 +1052,7 @@ export namespace proto {
|
||||
AI_IMAGINE_UR_TO_NATIVE_LOADING_INDICATOR = 54,
|
||||
RICH_RESPONSE_UR_BLOKS_ENABLED = 55,
|
||||
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,
|
||||
AI_SUBSCRIPTION_ENABLED = 61
|
||||
RICH_RESPONSE_UR_IMAGINE_VIDEO = 57
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1779,8 +1738,7 @@ export namespace proto {
|
||||
META_AI_SETTINGS = 45,
|
||||
WEB_INTRO_PANEL = 46,
|
||||
WEB_NAVIGATION_BAR = 47,
|
||||
GROUP_MEMBER = 54,
|
||||
CHATLIST_SEARCH = 55
|
||||
GROUP_MEMBER = 54
|
||||
}
|
||||
|
||||
interface IBotMetricsMetadata {
|
||||
@@ -2804,7 +2762,6 @@ export namespace proto {
|
||||
isSyncdPureLidSession?: (boolean|null);
|
||||
isSyncdSnapshotRecoveryEnabled?: (boolean|null);
|
||||
isHsThumbnailSyncEnabled?: (boolean|null);
|
||||
subscriptionSyncPayload?: (Uint8Array|null);
|
||||
}
|
||||
|
||||
class ClientPairingProps implements IClientPairingProps {
|
||||
@@ -2813,7 +2770,6 @@ 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;
|
||||
@@ -2858,7 +2814,6 @@ export namespace proto {
|
||||
paaLink?: (boolean|null);
|
||||
preacksCount?: (number|null);
|
||||
processingQueueSize?: (number|null);
|
||||
pairedPeripherals?: (string[]|null);
|
||||
}
|
||||
|
||||
class ClientPayload implements IClientPayload {
|
||||
@@ -2897,7 +2852,6 @@ export namespace proto {
|
||||
public paaLink?: (boolean|null);
|
||||
public preacksCount?: (number|null);
|
||||
public processingQueueSize?: (number|null);
|
||||
public pairedPeripherals: string[];
|
||||
public static create(properties?: proto.IClientPayload): proto.ClientPayload;
|
||||
public static encode(m: proto.IClientPayload, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.ClientPayload;
|
||||
@@ -3591,7 +3545,6 @@ export namespace proto {
|
||||
adType?: (proto.ContextInfo.ExternalAdReplyInfo.AdType|null);
|
||||
wtwaWebsiteUrl?: (string|null);
|
||||
adPreviewUrl?: (string|null);
|
||||
containsCtwaFlowsAutoReply?: (boolean|null);
|
||||
}
|
||||
|
||||
class ExternalAdReplyInfo implements IExternalAdReplyInfo {
|
||||
@@ -3623,7 +3576,6 @@ 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;
|
||||
@@ -3888,8 +3840,6 @@ export namespace proto {
|
||||
limitSharingInitiatedByMe?: (boolean|null);
|
||||
maibaAiThreadEnabled?: (boolean|null);
|
||||
isMarketingMessageThread?: (boolean|null);
|
||||
isSenderNewAccount?: (boolean|null);
|
||||
afterReadDuration?: (number|null);
|
||||
}
|
||||
|
||||
class Conversation implements IConversation {
|
||||
@@ -3949,8 +3899,6 @@ 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;
|
||||
@@ -4025,17 +3973,11 @@ 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;
|
||||
@@ -4210,7 +4152,6 @@ export namespace proto {
|
||||
thumbnailSyncDaysLimit?: (number|null);
|
||||
initialSyncMaxMessagesPerChat?: (number|null);
|
||||
supportManusHistory?: (boolean|null);
|
||||
supportHatchHistory?: (boolean|null);
|
||||
}
|
||||
|
||||
class HistorySyncConfig implements IHistorySyncConfig {
|
||||
@@ -4236,7 +4177,6 @@ export namespace proto {
|
||||
public thumbnailSyncDaysLimit?: (number|null);
|
||||
public initialSyncMaxMessagesPerChat?: (number|null);
|
||||
public supportManusHistory?: (boolean|null);
|
||||
public supportHatchHistory?: (boolean|null);
|
||||
public static create(properties?: proto.DeviceProps.IHistorySyncConfig): proto.DeviceProps.HistorySyncConfig;
|
||||
public static encode(m: proto.DeviceProps.IHistorySyncConfig, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.DeviceProps.HistorySyncConfig;
|
||||
@@ -4731,8 +4671,6 @@ export namespace proto {
|
||||
"static"?: (Uint8Array|null);
|
||||
payload?: (Uint8Array|null);
|
||||
extendedCiphertext?: (Uint8Array|null);
|
||||
paddedBytes?: (Uint8Array|null);
|
||||
simulateXxkemFs?: (boolean|null);
|
||||
}
|
||||
|
||||
class ClientFinish implements IClientFinish {
|
||||
@@ -4740,8 +4678,6 @@ 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;
|
||||
@@ -4757,10 +4693,6 @@ export namespace proto {
|
||||
payload?: (Uint8Array|null);
|
||||
useExtended?: (boolean|null);
|
||||
extendedCiphertext?: (Uint8Array|null);
|
||||
paddedBytes?: (Uint8Array|null);
|
||||
sendServerHelloPaddedBytes?: (boolean|null);
|
||||
simulateXxkemFs?: (boolean|null);
|
||||
pqMode?: (proto.HandshakeMessage.HandshakePqMode|null);
|
||||
}
|
||||
|
||||
class ClientHello implements IClientHello {
|
||||
@@ -4770,10 +4702,6 @@ 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 pqMode?: (proto.HandshakeMessage.HandshakePqMode|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;
|
||||
@@ -4783,24 +4711,11 @@ export namespace proto {
|
||||
public static getTypeUrl(typeUrlPrefix?: string): string;
|
||||
}
|
||||
|
||||
enum HandshakePqMode {
|
||||
HANDSHAKE_PQ_MODE_UNKNOWN = 0,
|
||||
XXKEM = 1,
|
||||
XXKEM_FS = 2,
|
||||
WA_CLASSICAL = 3,
|
||||
WA_PQ = 4,
|
||||
IKKEM = 5,
|
||||
IKKEM_FS = 6,
|
||||
XXKEM_2 = 7,
|
||||
IKKEM_2 = 8
|
||||
}
|
||||
|
||||
interface IServerHello {
|
||||
ephemeral?: (Uint8Array|null);
|
||||
"static"?: (Uint8Array|null);
|
||||
payload?: (Uint8Array|null);
|
||||
extendedStatic?: (Uint8Array|null);
|
||||
paddingBytes?: (Uint8Array|null);
|
||||
}
|
||||
|
||||
class ServerHello implements IServerHello {
|
||||
@@ -4809,7 +4724,6 @@ 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;
|
||||
@@ -5356,7 +5270,8 @@ export namespace proto {
|
||||
UNKNOWN = 0,
|
||||
CHAT_SETTING = 1,
|
||||
BIZ_SUPPORTS_FB_HOSTING = 2,
|
||||
UNKNOWN_GROUP = 3
|
||||
UNKNOWN_GROUP = 3,
|
||||
DEPRECATION = 4
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5618,7 +5533,6 @@ 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 {
|
||||
@@ -5724,7 +5638,6 @@ 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;
|
||||
@@ -6528,34 +6441,6 @@ 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);
|
||||
@@ -7157,14 +7042,6 @@ export namespace proto {
|
||||
public static getTypeUrl(typeUrlPrefix?: string): string;
|
||||
}
|
||||
|
||||
enum InsightDeliveryState {
|
||||
SENT = 0,
|
||||
DELIVERED = 1,
|
||||
READ = 2,
|
||||
REPLIED = 3,
|
||||
QUICK_REPLIED = 4
|
||||
}
|
||||
|
||||
interface IInteractiveMessage {
|
||||
header?: (proto.Message.InteractiveMessage.IHeader|null);
|
||||
body?: (proto.Message.InteractiveMessage.IBody|null);
|
||||
@@ -7920,19 +7797,17 @@ export namespace proto {
|
||||
|
||||
interface IMessageHistoryMetadata {
|
||||
historyReceivers?: (string[]|null);
|
||||
oldestMessageTimestampInWindow?: (number|Long|null);
|
||||
oldestMessageTimestamp?: (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 oldestMessageTimestampInWindow?: (number|Long|null);
|
||||
public oldestMessageTimestamp?: (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;
|
||||
@@ -8090,7 +7965,6 @@ export namespace proto {
|
||||
expiryTimestamp?: (number|Long|null);
|
||||
incentiveEligible?: (boolean|null);
|
||||
referralId?: (string|null);
|
||||
inviteType?: (proto.Message.PaymentInviteMessage.InviteType|null);
|
||||
}
|
||||
|
||||
class PaymentInviteMessage implements IPaymentInviteMessage {
|
||||
@@ -8099,7 +7973,6 @@ 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;
|
||||
@@ -8111,11 +7984,6 @@ export namespace proto {
|
||||
|
||||
namespace PaymentInviteMessage {
|
||||
|
||||
enum InviteType {
|
||||
DEFAULT = 0,
|
||||
MAPPER = 1
|
||||
}
|
||||
|
||||
enum ServiceType {
|
||||
UNKNOWN = 0,
|
||||
FBPAY = 1,
|
||||
@@ -8214,8 +8082,6 @@ export namespace proto {
|
||||
historySyncChunkRetryRequest?: (proto.Message.PeerDataOperationRequestMessage.IHistorySyncChunkRetryRequest|null);
|
||||
galaxyFlowAction?: (proto.Message.PeerDataOperationRequestMessage.IGalaxyFlowAction|null);
|
||||
companionCanonicalUserNonceFetchRequest?: (proto.Message.PeerDataOperationRequestMessage.ICompanionCanonicalUserNonceFetchRequest|null);
|
||||
bizBroadcastInsightsContactListRequest?: (proto.Message.PeerDataOperationRequestMessage.IBizBroadcastInsightsContactListRequest|null);
|
||||
bizBroadcastInsightsRefreshRequest?: (proto.Message.PeerDataOperationRequestMessage.IBizBroadcastInsightsRefreshRequest|null);
|
||||
}
|
||||
|
||||
class PeerDataOperationRequestMessage implements IPeerDataOperationRequestMessage {
|
||||
@@ -8230,8 +8096,6 @@ export namespace proto {
|
||||
public historySyncChunkRetryRequest?: (proto.Message.PeerDataOperationRequestMessage.IHistorySyncChunkRetryRequest|null);
|
||||
public galaxyFlowAction?: (proto.Message.PeerDataOperationRequestMessage.IGalaxyFlowAction|null);
|
||||
public companionCanonicalUserNonceFetchRequest?: (proto.Message.PeerDataOperationRequestMessage.ICompanionCanonicalUserNonceFetchRequest|null);
|
||||
public bizBroadcastInsightsContactListRequest?: (proto.Message.PeerDataOperationRequestMessage.IBizBroadcastInsightsContactListRequest|null);
|
||||
public bizBroadcastInsightsRefreshRequest?: (proto.Message.PeerDataOperationRequestMessage.IBizBroadcastInsightsRefreshRequest|null);
|
||||
public static create(properties?: proto.Message.IPeerDataOperationRequestMessage): proto.Message.PeerDataOperationRequestMessage;
|
||||
public static encode(m: proto.Message.IPeerDataOperationRequestMessage, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.Message.PeerDataOperationRequestMessage;
|
||||
@@ -8243,38 +8107,6 @@ export namespace proto {
|
||||
|
||||
namespace PeerDataOperationRequestMessage {
|
||||
|
||||
interface IBizBroadcastInsightsContactListRequest {
|
||||
campaignId?: (string|null);
|
||||
}
|
||||
|
||||
class BizBroadcastInsightsContactListRequest implements IBizBroadcastInsightsContactListRequest {
|
||||
constructor(p?: proto.Message.PeerDataOperationRequestMessage.IBizBroadcastInsightsContactListRequest);
|
||||
public campaignId?: (string|null);
|
||||
public static create(properties?: proto.Message.PeerDataOperationRequestMessage.IBizBroadcastInsightsContactListRequest): proto.Message.PeerDataOperationRequestMessage.BizBroadcastInsightsContactListRequest;
|
||||
public static encode(m: proto.Message.PeerDataOperationRequestMessage.IBizBroadcastInsightsContactListRequest, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.Message.PeerDataOperationRequestMessage.BizBroadcastInsightsContactListRequest;
|
||||
public static fromObject(d: { [k: string]: any }): proto.Message.PeerDataOperationRequestMessage.BizBroadcastInsightsContactListRequest;
|
||||
public static toObject(m: proto.Message.PeerDataOperationRequestMessage.BizBroadcastInsightsContactListRequest, o?: $protobuf.IConversionOptions): { [k: string]: any };
|
||||
public toJSON(): { [k: string]: any };
|
||||
public static getTypeUrl(typeUrlPrefix?: string): string;
|
||||
}
|
||||
|
||||
interface IBizBroadcastInsightsRefreshRequest {
|
||||
campaignId?: (string|null);
|
||||
}
|
||||
|
||||
class BizBroadcastInsightsRefreshRequest implements IBizBroadcastInsightsRefreshRequest {
|
||||
constructor(p?: proto.Message.PeerDataOperationRequestMessage.IBizBroadcastInsightsRefreshRequest);
|
||||
public campaignId?: (string|null);
|
||||
public static create(properties?: proto.Message.PeerDataOperationRequestMessage.IBizBroadcastInsightsRefreshRequest): proto.Message.PeerDataOperationRequestMessage.BizBroadcastInsightsRefreshRequest;
|
||||
public static encode(m: proto.Message.PeerDataOperationRequestMessage.IBizBroadcastInsightsRefreshRequest, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.Message.PeerDataOperationRequestMessage.BizBroadcastInsightsRefreshRequest;
|
||||
public static fromObject(d: { [k: string]: any }): proto.Message.PeerDataOperationRequestMessage.BizBroadcastInsightsRefreshRequest;
|
||||
public static toObject(m: proto.Message.PeerDataOperationRequestMessage.BizBroadcastInsightsRefreshRequest, o?: $protobuf.IConversionOptions): { [k: string]: any };
|
||||
public toJSON(): { [k: string]: any };
|
||||
public static getTypeUrl(typeUrlPrefix?: string): string;
|
||||
}
|
||||
|
||||
interface ICompanionCanonicalUserNonceFetchRequest {
|
||||
registrationTraceId?: (string|null);
|
||||
}
|
||||
@@ -8494,7 +8326,6 @@ export namespace proto {
|
||||
companionCanonicalUserNonceFetchRequestResponse?: (proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.ICompanionCanonicalUserNonceFetchResponse|null);
|
||||
historySyncChunkRetryResponse?: (proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.IHistorySyncChunkRetryResponse|null);
|
||||
flowResponsesCsvBundle?: (proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.IFlowResponsesCsvBundle|null);
|
||||
bizBroadcastInsightsContactListResponse?: (proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.IBizBroadcastInsightsContactListResponse|null);
|
||||
}
|
||||
|
||||
class PeerDataOperationResult implements IPeerDataOperationResult {
|
||||
@@ -8510,7 +8341,6 @@ export namespace proto {
|
||||
public companionCanonicalUserNonceFetchRequestResponse?: (proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.ICompanionCanonicalUserNonceFetchResponse|null);
|
||||
public historySyncChunkRetryResponse?: (proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.IHistorySyncChunkRetryResponse|null);
|
||||
public flowResponsesCsvBundle?: (proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.IFlowResponsesCsvBundle|null);
|
||||
public bizBroadcastInsightsContactListResponse?: (proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.IBizBroadcastInsightsContactListResponse|null);
|
||||
public static create(properties?: proto.Message.PeerDataOperationRequestResponseMessage.IPeerDataOperationResult): proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult;
|
||||
public static encode(m: proto.Message.PeerDataOperationRequestResponseMessage.IPeerDataOperationResult, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult;
|
||||
@@ -8522,44 +8352,6 @@ export namespace proto {
|
||||
|
||||
namespace PeerDataOperationResult {
|
||||
|
||||
interface IBizBroadcastInsightsContactListResponse {
|
||||
campaignId?: (string|null);
|
||||
timestampMs?: (number|Long|null);
|
||||
contacts?: (proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.IBizBroadcastInsightsContactState[]|null);
|
||||
}
|
||||
|
||||
class BizBroadcastInsightsContactListResponse implements IBizBroadcastInsightsContactListResponse {
|
||||
constructor(p?: proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.IBizBroadcastInsightsContactListResponse);
|
||||
public campaignId?: (string|null);
|
||||
public timestampMs?: (number|Long|null);
|
||||
public contacts: proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.IBizBroadcastInsightsContactState[];
|
||||
public static create(properties?: proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.IBizBroadcastInsightsContactListResponse): proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.BizBroadcastInsightsContactListResponse;
|
||||
public static encode(m: proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.IBizBroadcastInsightsContactListResponse, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.BizBroadcastInsightsContactListResponse;
|
||||
public static fromObject(d: { [k: string]: any }): proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.BizBroadcastInsightsContactListResponse;
|
||||
public static toObject(m: proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.BizBroadcastInsightsContactListResponse, o?: $protobuf.IConversionOptions): { [k: string]: any };
|
||||
public toJSON(): { [k: string]: any };
|
||||
public static getTypeUrl(typeUrlPrefix?: string): string;
|
||||
}
|
||||
|
||||
interface IBizBroadcastInsightsContactState {
|
||||
contactJid?: (string|null);
|
||||
state?: (proto.Message.InsightDeliveryState|null);
|
||||
}
|
||||
|
||||
class BizBroadcastInsightsContactState implements IBizBroadcastInsightsContactState {
|
||||
constructor(p?: proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.IBizBroadcastInsightsContactState);
|
||||
public contactJid?: (string|null);
|
||||
public state?: (proto.Message.InsightDeliveryState|null);
|
||||
public static create(properties?: proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.IBizBroadcastInsightsContactState): proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.BizBroadcastInsightsContactState;
|
||||
public static encode(m: proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.IBizBroadcastInsightsContactState, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.BizBroadcastInsightsContactState;
|
||||
public static fromObject(d: { [k: string]: any }): proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.BizBroadcastInsightsContactState;
|
||||
public static toObject(m: proto.Message.PeerDataOperationRequestResponseMessage.PeerDataOperationResult.BizBroadcastInsightsContactState, o?: $protobuf.IConversionOptions): { [k: string]: any };
|
||||
public toJSON(): { [k: string]: any };
|
||||
public static getTypeUrl(typeUrlPrefix?: string): string;
|
||||
}
|
||||
|
||||
interface ICompanionCanonicalUserNonceFetchResponse {
|
||||
nonce?: (string|null);
|
||||
waFbid?: (string|null);
|
||||
@@ -8842,9 +8634,7 @@ export namespace proto {
|
||||
COMPANION_SYNCD_SNAPSHOT_FATAL_RECOVERY = 8,
|
||||
COMPANION_CANONICAL_USER_NONCE_FETCH = 9,
|
||||
HISTORY_SYNC_CHUNK_RETRY = 10,
|
||||
GALAXY_FLOW_ACTION = 11,
|
||||
BUSINESS_BROADCAST_INSIGHTS_DELIVERED_TO = 12,
|
||||
BUSINESS_BROADCAST_INSIGHTS_REFRESH = 13
|
||||
GALAXY_FLOW_ACTION = 11
|
||||
}
|
||||
|
||||
interface IPinInChatMessage {
|
||||
@@ -9281,8 +9071,7 @@ export namespace proto {
|
||||
AI_QUERY_FANOUT = 29,
|
||||
GROUP_MEMBER_LABEL_CHANGE = 30,
|
||||
AI_MEDIA_COLLECTION_MESSAGE = 31,
|
||||
MESSAGE_UNSCHEDULE = 32,
|
||||
BOT_UNLINK_MESSAGE = 33
|
||||
MESSAGE_UNSCHEDULE = 32
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9373,14 +9162,12 @@ 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;
|
||||
@@ -10327,7 +10114,6 @@ export namespace proto {
|
||||
quarantineExtractedText?: (string|null);
|
||||
pollEndTime?: (number|Long|null);
|
||||
pollHideVoterNames?: (boolean|null);
|
||||
pollAllowAddOption?: (boolean|null);
|
||||
}
|
||||
|
||||
class MsgOpaqueData implements IMsgOpaqueData {
|
||||
@@ -10378,7 +10164,6 @@ export namespace proto {
|
||||
public quarantineExtractedText?: (string|null);
|
||||
public pollEndTime?: (number|Long|null);
|
||||
public pollHideVoterNames?: (boolean|null);
|
||||
public pollAllowAddOption?: (boolean|null);
|
||||
public static create(properties?: proto.IMsgOpaqueData): proto.MsgOpaqueData;
|
||||
public static encode(m: proto.IMsgOpaqueData, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.MsgOpaqueData;
|
||||
@@ -10575,9 +10360,6 @@ export namespace proto {
|
||||
NCT_SALT_SYNC_ACTION = 80,
|
||||
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
|
||||
@@ -11861,8 +11643,7 @@ export namespace proto {
|
||||
THREADS = 7,
|
||||
APPLE_MUSIC = 8,
|
||||
SHARECHAT = 9,
|
||||
GOOGLE_PHOTOS = 10,
|
||||
SOUNDCLOUD = 11
|
||||
GOOGLE_PHOTOS = 10
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12172,9 +11953,6 @@ export namespace proto {
|
||||
nctSaltSyncAction?: (proto.SyncActionValue.INctSaltSyncAction|null);
|
||||
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 {
|
||||
@@ -12252,9 +12030,6 @@ export namespace proto {
|
||||
public nctSaltSyncAction?: (proto.SyncActionValue.INctSaltSyncAction|null);
|
||||
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;
|
||||
@@ -12482,7 +12257,6 @@ export namespace proto {
|
||||
participants?: (proto.SyncActionValue.IBroadcastListParticipant[]|null);
|
||||
listName?: (string|null);
|
||||
labelIds?: (string[]|null);
|
||||
audienceExpression?: (string|null);
|
||||
}
|
||||
|
||||
class BusinessBroadcastListAction implements IBusinessBroadcastListAction {
|
||||
@@ -12491,7 +12265,6 @@ export namespace proto {
|
||||
public participants: proto.SyncActionValue.IBroadcastListParticipant[];
|
||||
public listName?: (string|null);
|
||||
public labelIds: string[];
|
||||
public audienceExpression?: (string|null);
|
||||
public static create(properties?: proto.SyncActionValue.IBusinessBroadcastListAction): proto.SyncActionValue.BusinessBroadcastListAction;
|
||||
public static encode(m: proto.SyncActionValue.IBusinessBroadcastListAction, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.SyncActionValue.BusinessBroadcastListAction;
|
||||
@@ -12663,42 +12436,6 @@ export namespace proto {
|
||||
public static getTypeUrl(typeUrlPrefix?: string): string;
|
||||
}
|
||||
|
||||
interface ICustomerDataAction {
|
||||
chatJid?: (string|null);
|
||||
contactType?: (number|null);
|
||||
email?: (string|null);
|
||||
altPhoneNumbers?: (string|null);
|
||||
birthday?: (number|Long|null);
|
||||
address?: (string|null);
|
||||
acquisitionSource?: (number|null);
|
||||
leadStage?: (number|null);
|
||||
lastOrder?: (number|Long|null);
|
||||
createdAt?: (number|Long|null);
|
||||
modifiedAt?: (number|Long|null);
|
||||
}
|
||||
|
||||
class CustomerDataAction implements ICustomerDataAction {
|
||||
constructor(p?: proto.SyncActionValue.ICustomerDataAction);
|
||||
public chatJid?: (string|null);
|
||||
public contactType?: (number|null);
|
||||
public email?: (string|null);
|
||||
public altPhoneNumbers?: (string|null);
|
||||
public birthday?: (number|Long|null);
|
||||
public address?: (string|null);
|
||||
public acquisitionSource?: (number|null);
|
||||
public leadStage?: (number|null);
|
||||
public lastOrder?: (number|Long|null);
|
||||
public createdAt?: (number|Long|null);
|
||||
public modifiedAt?: (number|Long|null);
|
||||
public static create(properties?: proto.SyncActionValue.ICustomerDataAction): proto.SyncActionValue.CustomerDataAction;
|
||||
public static encode(m: proto.SyncActionValue.ICustomerDataAction, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.SyncActionValue.CustomerDataAction;
|
||||
public static fromObject(d: { [k: string]: any }): proto.SyncActionValue.CustomerDataAction;
|
||||
public static toObject(m: proto.SyncActionValue.CustomerDataAction, o?: $protobuf.IConversionOptions): { [k: string]: any };
|
||||
public toJSON(): { [k: string]: any };
|
||||
public static getTypeUrl(typeUrlPrefix?: string): string;
|
||||
}
|
||||
|
||||
interface IDeleteChatAction {
|
||||
messageRange?: (proto.SyncActionValue.ISyncActionMessageRange|null);
|
||||
}
|
||||
@@ -13789,79 +13526,6 @@ 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);
|
||||
@@ -13900,22 +13564,6 @@ 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);
|
||||
}
|
||||
@@ -14311,12 +13959,14 @@ export namespace proto {
|
||||
interface IThreadID {
|
||||
threadType?: (proto.ThreadID.ThreadType|null);
|
||||
threadKey?: (proto.IMessageKey|null);
|
||||
sourceChatJid?: (string|null);
|
||||
}
|
||||
|
||||
class ThreadID implements IThreadID {
|
||||
constructor(p?: proto.IThreadID);
|
||||
public threadType?: (proto.ThreadID.ThreadType|null);
|
||||
public threadKey?: (proto.IMessageKey|null);
|
||||
public sourceChatJid?: (string|null);
|
||||
public static create(properties?: proto.IThreadID): proto.ThreadID;
|
||||
public static encode(m: proto.IThreadID, w?: $protobuf.Writer): $protobuf.Writer;
|
||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.ThreadID;
|
||||
|
||||
+49
-2687
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.3",
|
||||
"music-metadata": "^11.12.0",
|
||||
"p-queue": "^9.0.0",
|
||||
"pino": "^10.3.1",
|
||||
"prom-client": "^15.1.3",
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":[2,3000,1035595667]}
|
||||
{"version":[2,3000,1034382497]}
|
||||
|
||||
@@ -188,12 +188,10 @@ export const MEDIA_KEYS = Object.keys(MEDIA_PATH_MAP) as MediaType[]
|
||||
/** 120s timeout for history sync stall detection, same as WA Web's handleChunkProgress / restartPausedTimer (g = 120) */
|
||||
export const HISTORY_SYNC_PAUSED_TIMEOUT_MS = 120_000
|
||||
|
||||
// Replenishment threshold: when server count drops below this, top-up back to INITIAL_PREKEY_COUNT
|
||||
export const MIN_PREKEY_COUNT = 200
|
||||
export const MIN_PREKEY_COUNT = 5
|
||||
|
||||
// Initial pool size matching WA Business (CDP IDB capture: prekey-store = 812 on registration)
|
||||
// Rounded to 800 for cleanliness; replenishment always tops up to this value
|
||||
export const INITIAL_PREKEY_COUNT = 800
|
||||
// Moderate prekey count (upstream uses 812, reduced to balance rate limiting and availability)
|
||||
export const INITIAL_PREKEY_COUNT = 200
|
||||
|
||||
export const UPLOAD_TIMEOUT = 30000 // 30 seconds
|
||||
// Moderate upload interval to balance rate limiting and responsiveness (was 5000)
|
||||
|
||||
+13
-79
@@ -302,25 +302,6 @@ export function makeLibSignalRepository(
|
||||
// Promise instead of each spawning their own DB transactions.
|
||||
const migrationInFlight = new Map<string, Promise<{ migrated: number; skipped: number; total: number }>>()
|
||||
|
||||
// Resolve PN JID to its canonical LID JID for transaction locking.
|
||||
// This prevents PN/LID race conditions where concurrent operations for the
|
||||
// same logical contact acquire different mutex locks because one uses PN
|
||||
// and the other uses LID. (Aligned with WABA behavior — all operations use LID internally.)
|
||||
const resolveCanonicalJid = async(jid: string): Promise<string> => {
|
||||
if (isAnyLidUser(jid)) {
|
||||
return jid
|
||||
}
|
||||
|
||||
if (isAnyPnUser(jid)) {
|
||||
const lid = await lidMapping.getLIDForPN(jid)
|
||||
if (lid) {
|
||||
return lid
|
||||
}
|
||||
}
|
||||
|
||||
return jid
|
||||
}
|
||||
|
||||
const repository: SignalRepositoryWithLIDStore = {
|
||||
decryptGroupMessage({ group, authorJid, msg }) {
|
||||
const senderName = jidToSignalSenderKeyName(group, authorJid)
|
||||
@@ -415,24 +396,23 @@ export function makeLibSignalRepository(
|
||||
return result
|
||||
}
|
||||
|
||||
// Use canonical JID (PN→LID resolved) as transaction key to prevent
|
||||
// PN/LID race conditions on the same logical session.
|
||||
const canonicalJid = await resolveCanonicalJid(jid)
|
||||
// If it's not a sync message, we need to ensure atomicity
|
||||
// For regular messages, we use a transaction to ensure atomicity
|
||||
return parsedKeys.transaction(async () => {
|
||||
return await doDecrypt()
|
||||
}, canonicalJid)
|
||||
}, jid)
|
||||
},
|
||||
|
||||
async encryptMessage({ jid, data }) {
|
||||
const addr = jidToSignalProtocolAddress(jid)
|
||||
const cipher = new libsignal.SessionCipher(storage, addr)
|
||||
|
||||
const canonicalJid = await resolveCanonicalJid(jid)
|
||||
// Use transaction to ensure atomicity
|
||||
return parsedKeys.transaction(async () => {
|
||||
const { type: sigType, body } = await cipher.encrypt(data)
|
||||
const type = sigType === 3 ? 'pkmsg' : 'msg'
|
||||
return { type, ciphertext: Buffer.from(body, 'binary') }
|
||||
}, canonicalJid)
|
||||
}, jid)
|
||||
},
|
||||
|
||||
async encryptGroupMessage({ group, meId, data }) {
|
||||
@@ -674,10 +654,9 @@ export function makeLibSignalRepository(
|
||||
// Session exists (guaranteed from device discovery)
|
||||
const fromSession = libsignal.SessionRecord.deserialize(pnSession)
|
||||
if (fromSession.haveOpenSession()) {
|
||||
// Queue for bulk update: copy to LID, retain PN session.
|
||||
// WABA retains both PN and LID sessions during migration to avoid
|
||||
// No Session errors if messages arrive via PN before migration completes.
|
||||
// Queue for bulk update: copy to LID, delete from PN
|
||||
sessionUpdates[lidAddrStr] = fromSession.serialize()
|
||||
sessionUpdates[pnAddrStr] = null
|
||||
|
||||
migratedCount++
|
||||
}
|
||||
@@ -797,13 +776,6 @@ function signalStorage(
|
||||
return id
|
||||
}
|
||||
|
||||
// Delayed PreKey deletion: grace period to handle race conditions
|
||||
// where two pkmsg with the same preKeyId arrive nearly simultaneously.
|
||||
// WABA deletes immediately (33ms), but we add a 5-min grace period
|
||||
// because we can't handle "Invalid PreKey ID" errors at the native level.
|
||||
const PREKEY_GRACE_PERIOD_MS = 5 * 60 * 1000 // 5 minutes
|
||||
const pendingPreKeyDeletions = new Map<string, ReturnType<typeof setTimeout>>()
|
||||
|
||||
return {
|
||||
loadSession: async (id: string) => {
|
||||
try {
|
||||
@@ -836,26 +808,7 @@ function signalStorage(
|
||||
}
|
||||
}
|
||||
},
|
||||
removePreKey: (id: number) => {
|
||||
const keyId = id.toString()
|
||||
// Clear any existing timer for this key
|
||||
const existing = pendingPreKeyDeletions.get(keyId)
|
||||
if (existing) {
|
||||
clearTimeout(existing)
|
||||
}
|
||||
|
||||
// Schedule deletion after grace period
|
||||
const timer = setTimeout(async () => {
|
||||
pendingPreKeyDeletions.delete(keyId)
|
||||
try {
|
||||
await keys.set({ 'pre-key': { [id]: null } })
|
||||
} catch {
|
||||
// Keystore may be destroyed if connection closed — safe to ignore
|
||||
}
|
||||
}, PREKEY_GRACE_PERIOD_MS)
|
||||
|
||||
pendingPreKeyDeletions.set(keyId, timer)
|
||||
},
|
||||
removePreKey: (id: number) => keys.set({ 'pre-key': { [id]: null } }),
|
||||
loadSignedPreKey: () => {
|
||||
const key = creds.signedPreKey
|
||||
return {
|
||||
@@ -945,24 +898,14 @@ function signalStorage(
|
||||
// IDENTITY KEY CHANGED - contact reinstalled WhatsApp or switched devices
|
||||
const previousFingerprint = generateKeyFingerprint(existingKey)
|
||||
|
||||
// Delete old session and save new identity key atomically.
|
||||
// Store identity in BOTH LID and PN addresses (WABA stores in both
|
||||
// recipient_account_type=0 and type=1 with CONFLICT_REPLACE).
|
||||
const identityUpdates: Record<string, Uint8Array> = { [wireJid]: identityKey }
|
||||
if (wireJid !== id) {
|
||||
identityUpdates[id] = identityKey
|
||||
}
|
||||
|
||||
// Delete old session and save new identity key atomically
|
||||
await keys.set({
|
||||
session: { [wireJid]: null },
|
||||
'identity-key': identityUpdates
|
||||
'identity-key': { [wireJid]: identityKey }
|
||||
})
|
||||
|
||||
// Update cache for both addresses
|
||||
// Update cache
|
||||
identityKeyCache.set(wireJid, identityKey)
|
||||
if (wireJid !== id) {
|
||||
identityKeyCache.set(id, identityKey)
|
||||
}
|
||||
|
||||
// Record metrics
|
||||
metrics.signalIdentityChanges?.inc({ type: 'changed' })
|
||||
@@ -998,19 +941,10 @@ function signalStorage(
|
||||
|
||||
if (!existingKey) {
|
||||
// NEW CONTACT - Trust On First Use (TOFU)
|
||||
// Store in both LID and PN addresses (aligned with WABA dual identity storage)
|
||||
const identityUpdates: Record<string, Uint8Array> = { [wireJid]: identityKey }
|
||||
if (wireJid !== id) {
|
||||
identityUpdates[id] = identityKey
|
||||
}
|
||||
await keys.set({ 'identity-key': { [wireJid]: identityKey } })
|
||||
|
||||
await keys.set({ 'identity-key': identityUpdates })
|
||||
|
||||
// Update cache for both addresses
|
||||
// Update cache
|
||||
identityKeyCache.set(wireJid, identityKey)
|
||||
if (wireJid !== id) {
|
||||
identityKeyCache.set(id, identityKey)
|
||||
}
|
||||
|
||||
// Record metrics
|
||||
metrics.signalIdentityChanges?.inc({ type: 'new' })
|
||||
|
||||
+41
-45
@@ -7,7 +7,6 @@ import { proto } from '../../WAProto/index.js'
|
||||
import {
|
||||
DEFAULT_CACHE_TTLS,
|
||||
DEFAULT_SESSION_CLEANUP_CONFIG,
|
||||
INITIAL_PREKEY_COUNT,
|
||||
KEY_BUNDLE_TYPE,
|
||||
MIN_PREKEY_COUNT,
|
||||
PLACEHOLDER_MAX_AGE_SECONDS,
|
||||
@@ -49,12 +48,9 @@ import {
|
||||
getStatusFromReceiptType,
|
||||
handleIdentityChange,
|
||||
hkdf,
|
||||
BAD_MAC_ERROR_TEXT,
|
||||
DECRYPTION_RETRY_CONFIG,
|
||||
MISSING_KEYS_ERROR_TEXT,
|
||||
NACK_REASONS,
|
||||
NO_MESSAGE_FOUND_ERROR_TEXT,
|
||||
RetryReason,
|
||||
normalizeKeyLidToPn,
|
||||
normalizeMessageJids,
|
||||
resolveLidToPn,
|
||||
@@ -1216,7 +1212,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
return await query(stanza)
|
||||
}
|
||||
|
||||
const sendRetryRequest = async (node: BinaryNode, forceIncludeKeys = false, decryptionError?: string) => {
|
||||
const sendRetryRequest = async (node: BinaryNode, forceIncludeKeys = false) => {
|
||||
const { fullMessage } = decodeMessageNode(node, authState.creds.me!.id, authState.creds.me!.lid || '')
|
||||
const { key: msgKey } = fullMessage
|
||||
const msgId = msgKey.id!
|
||||
@@ -1314,39 +1310,39 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
const { account, signedPreKey, signedIdentityKey: identityKey } = authState.creds
|
||||
const fromJid = node.attrs.from!
|
||||
|
||||
// Derive the Signal error code from the actual decryption failure message.
|
||||
// Sent in the retry receipt so the peer (even another InfiniteAPI instance)
|
||||
// knows the exact failure type and can recreate the session immediately
|
||||
// instead of falling back to the 1-hour timeout.
|
||||
//
|
||||
// Codes mirror RetryReason enum in message-retry-manager.ts:
|
||||
// 0 = UnknownError | 1 = NoSession | 2 = InvalidKey
|
||||
// 3 = InvalidKeyId | 4 = InvalidMessage | 7 = BadMac
|
||||
//
|
||||
// Uses DECRYPTION_RETRY_CONFIG error lists (single source of truth in
|
||||
// decode-wa-message.ts) so additions to those lists are picked up here
|
||||
// automatically.
|
||||
//
|
||||
// NOTE: We do NOT delete the session here (receiver side). The Signal Protocol
|
||||
// recovers automatically when the sender's pkmsg arrives — it overwrites the
|
||||
// corrupted session. Deleting prematurely creates a race window where no session
|
||||
// exists, which can cause "No Session" errors on concurrent messages.
|
||||
const retryErrorCode = (() => {
|
||||
if (!decryptionError) return RetryReason.UnknownError
|
||||
// Bad MAC must be checked first — it is also in corruptedSessionErrors
|
||||
// but warrants the more specific code 7 over the generic code 4.
|
||||
if (decryptionError.includes(BAD_MAC_ERROR_TEXT)) return RetryReason.SignalErrorBadMac
|
||||
// MessageCounterError and other corrupted-session variants
|
||||
if (DECRYPTION_RETRY_CONFIG.corruptedSessionErrors.some(e => decryptionError.includes(e))) return RetryReason.SignalErrorInvalidMessage
|
||||
// Missing / invalid session record
|
||||
if (DECRYPTION_RETRY_CONFIG.sessionRecordErrors.some(e => decryptionError.includes(e)) ||
|
||||
/no\s+(open\s+)?sessions?/i.test(decryptionError)) return RetryReason.SignalErrorNoSession
|
||||
// PreKey / key-id errors
|
||||
if (/pre\s*key/i.test(decryptionError)) return RetryReason.SignalErrorInvalidKeyId
|
||||
// Identity / key errors
|
||||
if (/invalid\s*key|untrusted\s*identity/i.test(decryptionError)) return RetryReason.SignalErrorInvalidKey
|
||||
return RetryReason.UnknownError
|
||||
})()
|
||||
// Check if we should recreate the session
|
||||
let shouldRecreateSession = false
|
||||
let recreateReason = ''
|
||||
|
||||
if (enableAutoSessionRecreation && messageRetryManager && retryCount > 1) {
|
||||
try {
|
||||
// Check if we have a session with this JID
|
||||
const sessionId = signalRepository.jidToSignalProtocolAddress(fromJid)
|
||||
const hasSession = await signalRepository.validateSession(fromJid)
|
||||
|
||||
// Extract error code from retry node if present (for MAC error detection)
|
||||
const retryNode = getBinaryNodeChild(node, 'retry')
|
||||
const errorAttr = retryNode?.attrs?.error
|
||||
const errorCode = messageRetryManager.parseRetryErrorCode(errorAttr)
|
||||
|
||||
const result = messageRetryManager.shouldRecreateSession(fromJid, hasSession.exists, errorCode)
|
||||
shouldRecreateSession = result.recreate
|
||||
recreateReason = result.reason
|
||||
|
||||
if (shouldRecreateSession) {
|
||||
logger.debug({ fromJid, retryCount, reason: recreateReason, errorCode }, 'recreating session for retry')
|
||||
// Delete existing session to force recreation
|
||||
// CRITICAL: Use same transaction key as encrypt/decrypt operations to prevent race
|
||||
// Using meId ensures this delete serializes with sendMessage() and other session operations
|
||||
await authState.keys.transaction(async () => {
|
||||
await authState.keys.set({ session: { [sessionId]: null } })
|
||||
}, authState.creds.me?.id || 'session-operation')
|
||||
forceIncludeKeys = true
|
||||
}
|
||||
} catch (error) {
|
||||
logger.warn({ error, fromJid }, 'failed to check session recreation')
|
||||
}
|
||||
}
|
||||
|
||||
if (retryCount <= 2) {
|
||||
// Use new retry manager for phone requests if available
|
||||
@@ -1387,7 +1383,8 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
id: node.attrs.id!,
|
||||
t: node.attrs.t!,
|
||||
v: '1',
|
||||
error: retryErrorCode.toString()
|
||||
// ADD ERROR FIELD
|
||||
error: '0'
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -1406,7 +1403,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
receipt.attrs.participant = node.attrs.participant
|
||||
}
|
||||
|
||||
if (retryCount > 1 || forceIncludeKeys) {
|
||||
if (retryCount > 1 || forceIncludeKeys || shouldRecreateSession) {
|
||||
const { update, preKeys } = await getNextPreKeys(authState, 1)
|
||||
|
||||
const [keyId] = Object.keys(preKeys)
|
||||
@@ -1443,8 +1440,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
|
||||
logger.debug({ count, shouldUploadMorePreKeys }, 'recv pre-key count')
|
||||
if (shouldUploadMorePreKeys) {
|
||||
// Top-up back to INITIAL_PREKEY_COUNT so the pool is always restored to full size
|
||||
await uploadPreKeys(Math.max(1, INITIAL_PREKEY_COUNT - count))
|
||||
await uploadPreKeys()
|
||||
}
|
||||
} else {
|
||||
const result = await handleIdentityChange(node, {
|
||||
@@ -2037,7 +2033,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
let shouldRecreateSession = false
|
||||
let recreateReason = ''
|
||||
|
||||
if (enableAutoSessionRecreation && messageRetryManager && retryCount >= 1) {
|
||||
if (enableAutoSessionRecreation && messageRetryManager && retryCount > 1) {
|
||||
try {
|
||||
const sessionId = signalRepository.jidToSignalProtocolAddress(participant)
|
||||
|
||||
@@ -2509,7 +2505,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
}
|
||||
|
||||
const encNode = getBinaryNodeChild(node, 'enc')
|
||||
await sendRetryRequest(node, !encNode, errorMessage)
|
||||
await sendRetryRequest(node, !encNode)
|
||||
if (retryRequestDelayMs) {
|
||||
await delay(retryRequestDelayMs)
|
||||
}
|
||||
@@ -2518,7 +2514,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
// Still attempt retry even if pre-key upload failed
|
||||
try {
|
||||
const encNode = getBinaryNodeChild(node, 'enc')
|
||||
await sendRetryRequest(node, !encNode, errorMessage)
|
||||
await sendRetryRequest(node, !encNode)
|
||||
} catch (retryErr) {
|
||||
logger.error({ retryErr }, 'Failed to send retry after error handling')
|
||||
}
|
||||
|
||||
+101
-327
@@ -1,4 +1,3 @@
|
||||
import { randomBytes } from 'crypto'
|
||||
import NodeCache from '@cacheable/node-cache'
|
||||
import { Boom } from '@hapi/boom'
|
||||
import { proto } from '../../WAProto/index.js'
|
||||
@@ -9,7 +8,6 @@ import type {
|
||||
AlbumMessageOptions,
|
||||
AlbumSendResult,
|
||||
AnyMessageContent,
|
||||
LIDMapping,
|
||||
MediaConnInfo,
|
||||
MessageReceiptType,
|
||||
MessageRelayOptions,
|
||||
@@ -339,33 +337,6 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
||||
}
|
||||
}
|
||||
|
||||
// 4th LID→PN source: device-list entries sharing the same raw_id
|
||||
// WA Business uses this for accounts where HistorySync sends zero phoneNumberToLidMappings
|
||||
const allEntries = [...result.list, ...result.sideList]
|
||||
const rawIdMap = new Map<number, { pn?: string; lid?: string }>()
|
||||
for (const item of allEntries) {
|
||||
if (typeof item.rawId !== 'number' || isNaN(item.rawId)) continue
|
||||
const decoded = jidDecode(item.id)
|
||||
if (!decoded) continue
|
||||
const entry = rawIdMap.get(item.rawId) || {}
|
||||
if (decoded.server === 'lid' || decoded.server === 'hosted.lid') {
|
||||
entry.lid = item.id
|
||||
} else if (decoded.server === 's.whatsapp.net' || decoded.server === 'c.us') {
|
||||
entry.pn = item.id
|
||||
}
|
||||
rawIdMap.set(item.rawId, entry)
|
||||
}
|
||||
const rawIdMappings: LIDMapping[] = []
|
||||
for (const { pn, lid } of rawIdMap.values()) {
|
||||
if (pn && lid) {
|
||||
rawIdMappings.push({ lid: jidNormalizedUser(lid), pn: jidNormalizedUser(pn) })
|
||||
}
|
||||
}
|
||||
if (rawIdMappings.length > 0) {
|
||||
await signalRepository.lidMapping.storeLIDPNMappings(rawIdMappings)
|
||||
logger.debug({ count: rawIdMappings.length }, 'stored LID-PN mappings from raw_id pairing')
|
||||
}
|
||||
|
||||
const meId = authState.creds.me?.id
|
||||
if (!meId) throw new Boom('Not authenticated', { statusCode: 401 })
|
||||
const meLid = authState.creds.me?.lid || ''
|
||||
@@ -536,38 +507,6 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
||||
return didFetchNewSession
|
||||
}
|
||||
|
||||
const canonicalizeCarouselRecipients = async (recipientJids: string[]): Promise<string[]> => {
|
||||
if (!recipientJids.length) {
|
||||
return recipientJids
|
||||
}
|
||||
|
||||
const pnRecipients = [...new Set(recipientJids.filter(jid => isAnyPnUser(jid)))]
|
||||
if (!pnRecipients.length) {
|
||||
return recipientJids
|
||||
}
|
||||
|
||||
const mappings = (await signalRepository.lidMapping.getLIDsForPNs(pnRecipients)) || []
|
||||
if (!mappings.length) {
|
||||
logger.debug({ recipientCount: recipientJids.length }, '[CAROUSEL] No PN→LID recipient mappings found')
|
||||
return recipientJids
|
||||
}
|
||||
|
||||
const pnToLid = new Map(mappings.map(item => [item.pn, item.lid]))
|
||||
const mapped = recipientJids.map(jid => pnToLid.get(jid) || jid)
|
||||
const changed = mapped.filter((jid, index) => jid !== recipientJids[index]).length
|
||||
|
||||
logger.info(
|
||||
{
|
||||
recipientCount: recipientJids.length,
|
||||
pnRecipients: pnRecipients.length,
|
||||
mappedRecipients: changed
|
||||
},
|
||||
'[CAROUSEL] Canonicalized recipient addressing to LID before session assert/encrypt'
|
||||
)
|
||||
|
||||
return mapped
|
||||
}
|
||||
|
||||
const sendPeerDataOperationMessage = async (
|
||||
pdoMessage: proto.Message.IPeerDataOperationRequestMessage
|
||||
): Promise<string> => {
|
||||
@@ -602,82 +541,6 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
||||
return msgId
|
||||
}
|
||||
|
||||
const resolveDsmMessageForRecipient = (
|
||||
jid: string,
|
||||
patchedMessage: proto.IMessage,
|
||||
dsmMessage: proto.IMessage | undefined,
|
||||
meId: string,
|
||||
meLid: string | undefined,
|
||||
meLidUser: string | null | undefined
|
||||
) => {
|
||||
if (!dsmMessage) {
|
||||
return patchedMessage
|
||||
}
|
||||
|
||||
const { user: targetUser } = jidDecode(jid)!
|
||||
const { user: ownPnUser } = jidDecode(meId)!
|
||||
const isOwnUser = targetUser === ownPnUser || (meLidUser && targetUser === meLidUser)
|
||||
const isExactSenderDevice = jid === meId || (meLid && jid === meLid)
|
||||
|
||||
if (isOwnUser && !isExactSenderDevice) {
|
||||
logger.debug({ jid, targetUser }, 'Using DSM for own device')
|
||||
return dsmMessage
|
||||
}
|
||||
|
||||
return patchedMessage
|
||||
}
|
||||
|
||||
const encryptPatchedMessageForRecipient = async ({
|
||||
jid,
|
||||
patchedMessage,
|
||||
dsmMessage,
|
||||
meId,
|
||||
meLid,
|
||||
meLidUser,
|
||||
extraAttrs,
|
||||
onPkmsg
|
||||
}: {
|
||||
jid: string
|
||||
patchedMessage: proto.IMessage
|
||||
dsmMessage: proto.IMessage | undefined
|
||||
meId: string
|
||||
meLid: string | undefined
|
||||
meLidUser: string | null | undefined
|
||||
extraAttrs: BinaryNode['attrs'] | undefined
|
||||
onPkmsg: () => void
|
||||
}) => {
|
||||
if (!jid) return null
|
||||
|
||||
try {
|
||||
const msgToEncrypt = resolveDsmMessageForRecipient(jid, patchedMessage, dsmMessage, meId, meLid, meLidUser)
|
||||
const bytes = encodeWAMessage(msgToEncrypt)
|
||||
const mutexKey = jid
|
||||
|
||||
return await encryptionMutex.mutex(mutexKey, async () => {
|
||||
const { type, ciphertext } = await signalRepository.encryptMessage({ jid, data: bytes })
|
||||
|
||||
if (type === 'pkmsg') {
|
||||
onPkmsg()
|
||||
}
|
||||
|
||||
return {
|
||||
tag: 'to',
|
||||
attrs: { jid },
|
||||
content: [
|
||||
{
|
||||
tag: 'enc',
|
||||
attrs: { v: '2', type, ...(extraAttrs || {}) },
|
||||
content: ciphertext
|
||||
}
|
||||
]
|
||||
} as BinaryNode
|
||||
})
|
||||
} catch (err) {
|
||||
logger.error({ jid, err }, 'Failed to encrypt for recipient')
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
const createParticipantNodes = async (
|
||||
recipientJids: string[],
|
||||
message: proto.IMessage,
|
||||
@@ -697,23 +560,58 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
||||
const meId = authState.creds.me?.id
|
||||
if (!meId) throw new Boom('Not authenticated', { statusCode: 401 })
|
||||
const meLid = authState.creds.me?.lid
|
||||
const meLidUser = meLid ? (jidDecode(meLid)?.user ?? null) : null
|
||||
const onPkmsg = () => {
|
||||
shouldIncludeDeviceIdentity = true
|
||||
}
|
||||
const meLidUser = meLid ? jidDecode(meLid)?.user : null
|
||||
|
||||
const encryptionPromises = (patchedMessages as { recipientJid: string; message: proto.IMessage }[]).map(
|
||||
({ recipientJid: jid, message: patchedMessage }: { recipientJid: string; message: proto.IMessage }) =>
|
||||
encryptPatchedMessageForRecipient({
|
||||
jid,
|
||||
patchedMessage,
|
||||
dsmMessage,
|
||||
meId,
|
||||
meLid,
|
||||
meLidUser,
|
||||
extraAttrs,
|
||||
onPkmsg
|
||||
})
|
||||
async ({ recipientJid: jid, message: patchedMessage }: { recipientJid: string; message: proto.IMessage }) => {
|
||||
try {
|
||||
if (!jid) return null
|
||||
|
||||
let msgToEncrypt = patchedMessage
|
||||
|
||||
if (dsmMessage) {
|
||||
const { user: targetUser } = jidDecode(jid)!
|
||||
const { user: ownPnUser } = jidDecode(meId)!
|
||||
const ownLidUser = meLidUser
|
||||
|
||||
const isOwnUser = targetUser === ownPnUser || (ownLidUser && targetUser === ownLidUser)
|
||||
const isExactSenderDevice = jid === meId || (meLid && jid === meLid)
|
||||
|
||||
if (isOwnUser && !isExactSenderDevice) {
|
||||
msgToEncrypt = dsmMessage
|
||||
logger.debug({ jid, targetUser }, 'Using DSM for own device')
|
||||
}
|
||||
}
|
||||
|
||||
const bytes = encodeWAMessage(msgToEncrypt)
|
||||
const mutexKey = jid
|
||||
|
||||
const node = await encryptionMutex.mutex(mutexKey, async () => {
|
||||
const { type, ciphertext } = await signalRepository.encryptMessage({ jid, data: bytes })
|
||||
|
||||
if (type === 'pkmsg') {
|
||||
shouldIncludeDeviceIdentity = true
|
||||
}
|
||||
|
||||
return {
|
||||
tag: 'to',
|
||||
attrs: { jid },
|
||||
content: [
|
||||
{
|
||||
tag: 'enc',
|
||||
attrs: { v: '2', type, ...(extraAttrs || {}) },
|
||||
content: ciphertext
|
||||
}
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
return node
|
||||
} catch (err) {
|
||||
logger.error({ jid, err }, 'Failed to encrypt for recipient')
|
||||
return null
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
const nodes = (await Promise.all(encryptionPromises)).filter(node => node !== null) as BinaryNode[]
|
||||
@@ -1268,57 +1166,21 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
||||
allRecipients.push(jid)
|
||||
}
|
||||
|
||||
const isCarouselFanout = isCarouselMessage(message)
|
||||
const effectiveMeRecipients = isCarouselFanout
|
||||
? await canonicalizeCarouselRecipients(meRecipients)
|
||||
: meRecipients
|
||||
const effectiveOtherRecipients = isCarouselFanout
|
||||
? await canonicalizeCarouselRecipients(otherRecipients)
|
||||
: otherRecipients
|
||||
const effectiveAllRecipients = [...effectiveMeRecipients, ...effectiveOtherRecipients]
|
||||
|
||||
// P2: detect actual view-once media by checking inner message's viewOnce flag.
|
||||
// viewOnceMessage wrapper is also used for interactive messages (buttons, lists, etc)
|
||||
// which do NOT carry viewOnce=true on the media — those must NOT be filtered.
|
||||
const viewOnceInner =
|
||||
message.viewOnceMessageV2?.message ||
|
||||
message.viewOnceMessage?.message ||
|
||||
message.viewOnceMessageV2Extension?.message
|
||||
const isViewOnceMsg = !!(
|
||||
viewOnceInner?.imageMessage?.viewOnce ||
|
||||
viewOnceInner?.videoMessage?.viewOnce ||
|
||||
viewOnceInner?.audioMessage?.viewOnce
|
||||
)
|
||||
|
||||
// For view-once: only send DSM to primary phone (device=0).
|
||||
// Companion devices (device>0) are omitted — WA server generates
|
||||
// <unavailable type="view_once"/> for them automatically.
|
||||
// Sending explicit <unavailable> from a companion is rejected by the server.
|
||||
const viewOnceMeRecipients = isViewOnceMsg
|
||||
? effectiveMeRecipients.filter(jid => !jidDecode(jid)?.device)
|
||||
: effectiveMeRecipients
|
||||
|
||||
// P3: assert sessions only for recipients we actually encrypt for.
|
||||
// For view-once, companions are omitted — asserting their sessions is wasteful
|
||||
// and could block the send if a companion session is corrupted.
|
||||
await assertSessions([...viewOnceMeRecipients, ...effectiveOtherRecipients])
|
||||
await assertSessions(allRecipients)
|
||||
|
||||
const [
|
||||
{ nodes: meNodes, shouldIncludeDeviceIdentity: s1 },
|
||||
{ nodes: otherNodes, shouldIncludeDeviceIdentity: s2 }
|
||||
] = await Promise.all([
|
||||
// For own devices: use DSM (deviceSentMessage) wrapper
|
||||
createParticipantNodes(viewOnceMeRecipients, meMsg || message, extraAttrs),
|
||||
createParticipantNodes(effectiveOtherRecipients, message, extraAttrs)
|
||||
createParticipantNodes(meRecipients, meMsg || message, extraAttrs),
|
||||
createParticipantNodes(otherRecipients, message, extraAttrs)
|
||||
])
|
||||
participants.push(...meNodes)
|
||||
participants.push(...otherNodes)
|
||||
|
||||
const phashRecipients = isViewOnceMsg
|
||||
? [...viewOnceMeRecipients, ...effectiveOtherRecipients]
|
||||
: effectiveAllRecipients
|
||||
if (phashRecipients.length > 0) {
|
||||
extraAttrs['phash'] = generateParticipantHashV2(phashRecipients)
|
||||
if (meRecipients.length > 0 || otherRecipients.length > 0) {
|
||||
extraAttrs['phash'] = generateParticipantHashV2([...meRecipients, ...otherRecipients])
|
||||
}
|
||||
|
||||
shouldIncludeDeviceIdentity = shouldIncludeDeviceIdentity || s1 || s2
|
||||
@@ -1391,15 +1253,13 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
||||
const isCarousel = isCarouselMessage(message)
|
||||
|
||||
// Collect biz/bot nodes to append AFTER device-identity and tctoken
|
||||
// Stanza order: participants → device-identity → tctoken → biz (when applicable)
|
||||
// CDP capture confirms Pastorini INCLUDES biz node for carousel (native_flow v=9, name=mixed)
|
||||
// Stanza order: participants → device-identity → tctoken → biz
|
||||
// The biz node MUST be last for WhatsApp Web carousel rendering
|
||||
const deferredNodes: BinaryNode[] = []
|
||||
|
||||
// Inject biz node for interactive messages (including carousel — CDP evidence from Pastorini)
|
||||
if ((buttonType || isCarousel) && enableInteractiveMessages) {
|
||||
// Inject biz node for interactive messages (including carousel)
|
||||
if (buttonType && enableInteractiveMessages) {
|
||||
const startTime = Date.now()
|
||||
// When entering via isCarousel, buttonType may be undefined — default to 'native_flow'
|
||||
const effectiveButtonType = buttonType || 'native_flow'
|
||||
|
||||
// Debug: Log message structure to diagnose list detection
|
||||
const interactiveMsg =
|
||||
@@ -1437,7 +1297,7 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
||||
)
|
||||
|
||||
// Track that we're sending an interactive message
|
||||
metrics.interactiveMessagesSent.inc({ type: effectiveButtonType })
|
||||
metrics.interactiveMessagesSent.inc({ type: buttonType })
|
||||
|
||||
try {
|
||||
// Classify button types for native_flow name and bot node decisions
|
||||
@@ -1480,49 +1340,27 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
||||
)
|
||||
|
||||
const interactiveType = 'native_flow'
|
||||
const bizContent: BinaryNode[] = [
|
||||
{
|
||||
tag: 'interactive',
|
||||
attrs: {
|
||||
type: interactiveType,
|
||||
v: '1'
|
||||
},
|
||||
content: [
|
||||
{
|
||||
tag: interactiveType,
|
||||
attrs: {
|
||||
v: '9',
|
||||
name: nativeFlowName
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
// CDP capture shows Pastorini includes quality_control inside biz for carousel
|
||||
if (isCarousel) {
|
||||
const decisionId = randomBytes(20).toString('hex')
|
||||
bizContent.push({
|
||||
tag: 'quality_control',
|
||||
attrs: {
|
||||
decision_id: decisionId
|
||||
},
|
||||
content: [
|
||||
{
|
||||
tag: 'decision_source',
|
||||
attrs: {
|
||||
value: 'df'
|
||||
}
|
||||
}
|
||||
]
|
||||
})
|
||||
logger.info({ msgId, decisionId }, '[BIZ NODE] Added quality_control for carousel')
|
||||
}
|
||||
|
||||
deferredNodes.push({
|
||||
tag: 'biz',
|
||||
attrs: {},
|
||||
content: bizContent
|
||||
content: [
|
||||
{
|
||||
tag: 'interactive',
|
||||
attrs: {
|
||||
type: interactiveType,
|
||||
v: '1'
|
||||
},
|
||||
content: [
|
||||
{
|
||||
tag: interactiveType,
|
||||
attrs: {
|
||||
v: '9',
|
||||
name: nativeFlowName
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1548,11 +1386,11 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
||||
}
|
||||
|
||||
// Track success and latency after message is sent
|
||||
metrics.interactiveMessagesSuccess.inc({ type: effectiveButtonType })
|
||||
metrics.interactiveMessagesLatency.observe({ type: effectiveButtonType }, Date.now() - startTime)
|
||||
metrics.interactiveMessagesSuccess.inc({ type: buttonType })
|
||||
metrics.interactiveMessagesLatency.observe({ type: buttonType }, Date.now() - startTime)
|
||||
} catch (error) {
|
||||
logger.error({ error, msgId, buttonType: effectiveButtonType }, '[BIZ NODE] Failed to inject biz node')
|
||||
metrics.interactiveMessagesFailures.inc({ type: effectiveButtonType, reason: 'injection_failed' })
|
||||
logger.error({ error, msgId, buttonType }, '[BIZ NODE] Failed to inject biz node')
|
||||
metrics.interactiveMessagesFailures.inc({ type: buttonType, reason: 'injection_failed' })
|
||||
}
|
||||
} else if (buttonType && !enableInteractiveMessages) {
|
||||
logger.warn(
|
||||
@@ -1579,8 +1417,7 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
||||
stanza.attrs.to = destinationJid
|
||||
}
|
||||
|
||||
// Always include device-identity for carousel (Pastorini stanza always has it)
|
||||
if (shouldIncludeDeviceIdentity || isCarousel) {
|
||||
if (shouldIncludeDeviceIdentity) {
|
||||
;(stanza.content as BinaryNode[]).push({
|
||||
tag: 'device-identity',
|
||||
attrs: {},
|
||||
@@ -1637,79 +1474,27 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
||||
}
|
||||
}
|
||||
|
||||
// If tctoken is missing for a 1:1 send, fetch it
|
||||
// CDP capture confirms Pastorini stanza includes tctoken for carousel
|
||||
// If tctoken is missing for a 1:1 send, fire-and-forget fetch so the
|
||||
// retry path (error 463 → handleBadAck) can pick it up on resend
|
||||
if (!tcTokenBuffer?.length && is1on1Send && !tcTokenFetchingJids.has(tcTokenJid)) {
|
||||
tcTokenFetchingJids.add(tcTokenJid)
|
||||
logTcToken('fetch', { jid: destinationJid })
|
||||
|
||||
if (isCarousel) {
|
||||
// BLOCKING fetch for carousel — tctoken is required (Pastorini stanza has it)
|
||||
try {
|
||||
const fetchResult = await getPrivacyTokens([destinationJid])
|
||||
|
||||
// Direct extraction from IQ result — bypass store/read key mismatch
|
||||
const tokensNode = getBinaryNodeChild(fetchResult, 'tokens')
|
||||
if (tokensNode) {
|
||||
const tokenNodes = getBinaryNodeChildren(tokensNode, 'token')
|
||||
for (const tokenNode of tokenNodes) {
|
||||
if (tokenNode.attrs.type === 'trusted_contact' && tokenNode.content instanceof Uint8Array) {
|
||||
tcTokenBuffer = Buffer.from(tokenNode.content)
|
||||
logger.info(
|
||||
{
|
||||
jid: destinationJid,
|
||||
tokenLen: tcTokenBuffer.length,
|
||||
tokenJid: tokenNode.attrs.jid,
|
||||
timestamp: tokenNode.attrs.t
|
||||
},
|
||||
'[CAROUSEL] tctoken extracted directly from IQ result'
|
||||
)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!tcTokenBuffer?.length) {
|
||||
// Debug: dump the IQ result structure
|
||||
const childTags = Array.isArray(fetchResult.content)
|
||||
? (fetchResult.content as BinaryNode[]).map(n => `${n.tag}(${JSON.stringify(n.attrs)})`)
|
||||
: []
|
||||
logger.warn(
|
||||
{ jid: destinationJid, resultTag: fetchResult.tag, resultAttrs: fetchResult.attrs, childTags },
|
||||
'[CAROUSEL] tctoken fetch completed but NO valid token in IQ result'
|
||||
)
|
||||
}
|
||||
|
||||
// Also store for future use
|
||||
getPrivacyTokens([destinationJid])
|
||||
.then(async fetchResult => {
|
||||
await storeTcTokensFromIqResult({
|
||||
result: fetchResult,
|
||||
fallbackJid: destinationJid,
|
||||
keys: authState.keys,
|
||||
getLIDForPN
|
||||
}).catch(() => {})
|
||||
} catch (err: any) {
|
||||
logger.warn({ jid: destinationJid, err: err?.message }, '[CAROUSEL] Blocking tctoken fetch failed')
|
||||
} finally {
|
||||
// onNewJidStored not passed — the pruning index lives in messages-recv (higher layer)
|
||||
})
|
||||
})
|
||||
.catch(err => {
|
||||
logger.debug({ jid: destinationJid, err: err?.message }, 'fire-and-forget tctoken fetch failed')
|
||||
})
|
||||
.finally(() => {
|
||||
tcTokenFetchingJids.delete(tcTokenJid)
|
||||
}
|
||||
} else {
|
||||
// Fire-and-forget for non-carousel
|
||||
getPrivacyTokens([destinationJid])
|
||||
.then(async fetchResult => {
|
||||
await storeTcTokensFromIqResult({
|
||||
result: fetchResult,
|
||||
fallbackJid: destinationJid,
|
||||
keys: authState.keys,
|
||||
getLIDForPN
|
||||
})
|
||||
})
|
||||
.catch(err => {
|
||||
logger.debug({ jid: destinationJid, err: err?.message }, 'fire-and-forget tctoken fetch failed')
|
||||
})
|
||||
.finally(() => {
|
||||
tcTokenFetchingJids.delete(tcTokenJid)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (tcTokenBuffer?.length) {
|
||||
@@ -1740,7 +1525,8 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
||||
logger.debug({ msgId }, `sending message to ${participants.length} devices`)
|
||||
|
||||
// ======= PROTOBUF ROUNDTRIP TEST: Verify encoding preserves carousel =======
|
||||
if (isCarousel) {
|
||||
// Only runs at debug level to avoid performance overhead in production
|
||||
if (isCarousel && logger.level === 'debug') {
|
||||
try {
|
||||
const encoded = proto.Message.encode(message).finish()
|
||||
const decoded = proto.Message.decode(encoded)
|
||||
@@ -1749,19 +1535,15 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
||||
const card0 = decodedInteractive?.carouselMessage?.cards?.[0]
|
||||
const card0Header = card0?.header
|
||||
|
||||
logger.info(
|
||||
logger.debug(
|
||||
{
|
||||
msgId,
|
||||
encodedSize: encoded.length,
|
||||
messageKeys: Object.keys(message),
|
||||
hasInteractive: !!message.interactiveMessage,
|
||||
hasViewOnce: !!message.viewOnceMessage,
|
||||
hasCarouselAfterDecode: !!decodedInteractive?.carouselMessage,
|
||||
cardsCount,
|
||||
card0Title: card0Header?.title,
|
||||
card0HasImage: !!card0Header?.imageMessage,
|
||||
card0Buttons: card0?.nativeFlowMessage?.buttons?.length || 0,
|
||||
messageVersion: decodedInteractive?.carouselMessage?.messageVersion
|
||||
card0Buttons: card0?.nativeFlowMessage?.buttons?.length || 0
|
||||
},
|
||||
'[ROUNDTRIP] Protobuf encode→decode verification'
|
||||
)
|
||||
@@ -1771,7 +1553,8 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
||||
}
|
||||
|
||||
// ======= PROTOCOL INTERCEPTOR: Dump complete stanza for debugging =======
|
||||
if (buttonType || isCarousel) {
|
||||
// Only runs at debug level to avoid logging sensitive content in production
|
||||
if ((buttonType || isCarousel) && logger.level === 'debug') {
|
||||
const dumpBinaryNode = (node: BinaryNode, indent = 0): string => {
|
||||
if (!node) return ''
|
||||
const pad = ' '.repeat(indent)
|
||||
@@ -1924,15 +1707,6 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
||||
}
|
||||
|
||||
const getMediaType = (message: proto.IMessage) => {
|
||||
// For view-once media, unwrap the viewOnceMessage wrapper before checking media type
|
||||
const inner =
|
||||
message.viewOnceMessage?.message ||
|
||||
message.viewOnceMessageV2?.message ||
|
||||
message.viewOnceMessageV2Extension?.message
|
||||
if (inner) {
|
||||
return getMediaType(inner)
|
||||
}
|
||||
|
||||
if (message.imageMessage) {
|
||||
return 'image'
|
||||
} else if (message.videoMessage) {
|
||||
|
||||
@@ -123,11 +123,11 @@ export const makeNewsletterSocket = (config: SocketConfig) => {
|
||||
},
|
||||
|
||||
newsletterMute: (jid: string) => {
|
||||
return executeWMexQuery({ input: { newsletter_id: jid, type: 'MUTE_ADMIN_ACTIVITY', value: 'OFF' } }, QueryIds.MUTE, XWAPaths.xwa2_newsletter_mute_v2)
|
||||
return executeWMexQuery({ newsletter_id: jid }, QueryIds.MUTE, XWAPaths.xwa2_newsletter_mute_v2)
|
||||
},
|
||||
|
||||
newsletterUnmute: (jid: string) => {
|
||||
return executeWMexQuery({ input: { newsletter_id: jid, type: 'MUTE_ADMIN_ACTIVITY', value: 'ON' } }, QueryIds.UNMUTE, XWAPaths.xwa2_newsletter_unmute_v2)
|
||||
return executeWMexQuery({ newsletter_id: jid }, QueryIds.UNMUTE, XWAPaths.xwa2_newsletter_unmute_v2)
|
||||
},
|
||||
|
||||
newsletterUpdateName: async (jid: string, name: string) => {
|
||||
|
||||
+8
-28
@@ -701,12 +701,10 @@ export const makeSocket = (config: SocketConfig) => {
|
||||
}
|
||||
}
|
||||
|
||||
// Prevent multiple concurrent uploads — if one is already running, wait for it and return:
|
||||
// the concurrent upload already replenished the pool, so there is nothing left to do.
|
||||
// Prevent multiple concurrent uploads
|
||||
if (uploadPreKeysPromise) {
|
||||
logger.debug('Pre-key upload already in progress, waiting for completion')
|
||||
await uploadPreKeysPromise
|
||||
return
|
||||
}
|
||||
|
||||
const uploadLogic = async () => {
|
||||
@@ -786,15 +784,14 @@ export const makeSocket = (config: SocketConfig) => {
|
||||
try {
|
||||
let count = 0
|
||||
const preKeyCount = await getAvailablePreKeysOnServer()
|
||||
// How many to upload: top-up to INITIAL_PREKEY_COUNT from whatever remains on server
|
||||
count = Math.max(0, INITIAL_PREKEY_COUNT - preKeyCount)
|
||||
if (preKeyCount === 0) count = INITIAL_PREKEY_COUNT
|
||||
else count = MIN_PREKEY_COUNT
|
||||
const { exists: currentPreKeyExists, currentPreKeyId } = await verifyCurrentPreKeyExists()
|
||||
|
||||
logger.info(`${preKeyCount} pre-keys found on server`)
|
||||
logger.info(`Current prekey ID: ${currentPreKeyId}, exists in storage: ${currentPreKeyExists}`)
|
||||
|
||||
// Trigger upload when below the replenishment threshold, not when count < topUp amount
|
||||
const lowServerCount = preKeyCount < MIN_PREKEY_COUNT
|
||||
const lowServerCount = preKeyCount <= count
|
||||
const missingCurrentPreKey = !currentPreKeyExists && currentPreKeyId > 0
|
||||
|
||||
const shouldUpload = lowServerCount || missingCurrentPreKey
|
||||
@@ -1154,7 +1151,7 @@ export const makeSocket = (config: SocketConfig) => {
|
||||
// Decrement active connections
|
||||
decrementActiveConnections()
|
||||
|
||||
clearTimeout(keepAliveReq)
|
||||
clearInterval(keepAliveReq)
|
||||
clearTimeout(qrTimer)
|
||||
|
||||
// Clear offline-buffer safety timer so its callback cannot call ev.flush()
|
||||
@@ -1265,16 +1262,8 @@ export const makeSocket = (config: SocketConfig) => {
|
||||
})
|
||||
}
|
||||
|
||||
const startKeepAliveRequest = () => {
|
||||
// Use recursive setTimeout with ±15% jitter to match WA Desktop behaviour
|
||||
// (WA Business Desktop: ~25-30s intervals with natural variance)
|
||||
const scheduleNextKeepAlive = () => {
|
||||
const jitter = keepAliveIntervalMs * 0.15
|
||||
const delay = keepAliveIntervalMs + Math.floor((Math.random() * 2 - 1) * jitter)
|
||||
keepAliveReq = setTimeout(onKeepAliveTick, delay)
|
||||
}
|
||||
|
||||
const onKeepAliveTick = () => {
|
||||
const startKeepAliveRequest = () =>
|
||||
(keepAliveReq = setInterval(() => {
|
||||
if (!lastDateRecv) {
|
||||
lastDateRecv = new Date()
|
||||
}
|
||||
@@ -1286,7 +1275,6 @@ export const makeSocket = (config: SocketConfig) => {
|
||||
*/
|
||||
if (diff > keepAliveIntervalMs + 5000) {
|
||||
void end(new Boom('Connection was lost', { statusCode: DisconnectReason.connectionLost }))
|
||||
return // connection closing — do not reschedule
|
||||
} else if (ws.isOpen) {
|
||||
// Send keep-alive ping via sendNode() (fire-and-forget) instead of query().
|
||||
// query() wraps the ping in the query circuit breaker — when that breaker is
|
||||
@@ -1309,15 +1297,7 @@ export const makeSocket = (config: SocketConfig) => {
|
||||
} else {
|
||||
logger.warn('keep alive called when WS not open')
|
||||
}
|
||||
|
||||
// Do not reschedule once shutdown has started (closed set by end() on any concurrent path)
|
||||
if (!closed) {
|
||||
scheduleNextKeepAlive()
|
||||
}
|
||||
}
|
||||
|
||||
scheduleNextKeepAlive()
|
||||
}
|
||||
}, keepAliveIntervalMs))
|
||||
/** i have no idea why this exists. pls enlighten me */
|
||||
const sendPassiveIq = (tag: 'passive' | 'active') =>
|
||||
query({
|
||||
|
||||
@@ -27,8 +27,6 @@ export type BaileysEventMap = {
|
||||
chats: Chat[]
|
||||
contacts: Contact[]
|
||||
messages: WAMessage[]
|
||||
/** Past participants for group chats (people who left/were removed). userJid is always a phone number (PN), never a LID. */
|
||||
pastParticipants?: proto.IPastParticipants[] | null
|
||||
isLatest?: boolean
|
||||
progress?: number | null
|
||||
syncType?: proto.HistorySync.HistorySyncType | null
|
||||
@@ -187,8 +185,6 @@ export type BufferedEventData = {
|
||||
chats: { [jid: string]: Chat }
|
||||
contacts: { [jid: string]: Contact }
|
||||
messages: { [uqId: string]: WAMessage }
|
||||
/** Keyed by groupJid for O(1) deduplication across chunks */
|
||||
pastParticipants: { [groupJid: string]: proto.IPastParticipant[] }
|
||||
empty: boolean
|
||||
isLatest: boolean
|
||||
progress?: number | null
|
||||
|
||||
@@ -4,10 +4,10 @@ export enum XWAPaths {
|
||||
xwa2_newsletter_view = 'xwa2_newsletter_view',
|
||||
xwa2_newsletter_metadata = 'xwa2_newsletter',
|
||||
xwa2_newsletter_admin_count = 'xwa2_newsletter_admin',
|
||||
xwa2_newsletter_mute_v2 = 'xwa2_newsletter_update_user_setting',
|
||||
xwa2_newsletter_unmute_v2 = 'xwa2_newsletter_update_user_setting',
|
||||
xwa2_newsletter_follow = 'xwa2_newsletter_join_v2',
|
||||
xwa2_newsletter_unfollow = 'xwa2_newsletter_leave_v2',
|
||||
xwa2_newsletter_mute_v2 = 'xwa2_newsletter_mute_v2',
|
||||
xwa2_newsletter_unmute_v2 = 'xwa2_newsletter_unmute_v2',
|
||||
xwa2_newsletter_follow = 'xwa2_newsletter_follow',
|
||||
xwa2_newsletter_unfollow = 'xwa2_newsletter_unfollow',
|
||||
xwa2_newsletter_change_owner = 'xwa2_newsletter_change_owner',
|
||||
xwa2_newsletter_demote = 'xwa2_newsletter_demote',
|
||||
xwa2_newsletter_delete_v2 = 'xwa2_newsletter_delete_v2'
|
||||
@@ -17,10 +17,10 @@ export enum QueryIds {
|
||||
UPDATE_METADATA = '24250201037901610',
|
||||
METADATA = '6563316087068696',
|
||||
SUBSCRIBERS = '9783111038412085',
|
||||
FOLLOW = '24404358912487870',
|
||||
UNFOLLOW = '9767147403369991',
|
||||
MUTE = '31938993655691868',
|
||||
UNMUTE = '31938993655691868',
|
||||
FOLLOW = '7871414976211147',
|
||||
UNFOLLOW = '7238632346214362',
|
||||
MUTE = '29766401636284406',
|
||||
UNMUTE = '9864994326891137',
|
||||
ADMIN_COUNT = '7130823597031706',
|
||||
CHANGE_OWNER = '7341777602580933',
|
||||
DEMOTE = '6551828931592903',
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
isJidStatusBroadcast,
|
||||
isLidUser,
|
||||
isPnUser,
|
||||
jidDecode
|
||||
// transferDevice
|
||||
} from '../WABinary'
|
||||
import { unpadRandomMax16 } from './generics'
|
||||
@@ -392,23 +393,6 @@ export const decryptMessageNode = (
|
||||
} else {
|
||||
fullMessage.message = msg
|
||||
}
|
||||
|
||||
// Detect view-once media on stanza 1 received by linked device.
|
||||
// viewOnceMessage wrapper is also used for interactive messages
|
||||
// (interactiveMessage, listMessage, nativeFlowMessage) -- those do NOT have
|
||||
// imageMessage.viewOnce / videoMessage.viewOnce / audioMessage.viewOnce = true.
|
||||
// Only real view-once media carries viewOnce: true on the inner media message.
|
||||
const viewOnceInner =
|
||||
msg.viewOnceMessage?.message ||
|
||||
msg.viewOnceMessageV2?.message ||
|
||||
msg.viewOnceMessageV2Extension?.message
|
||||
if (
|
||||
viewOnceInner?.imageMessage?.viewOnce ||
|
||||
viewOnceInner?.videoMessage?.viewOnce ||
|
||||
viewOnceInner?.audioMessage?.viewOnce
|
||||
) {
|
||||
fullMessage.key.isViewOnce = true
|
||||
}
|
||||
} catch (err: any) {
|
||||
// Check if this is a final failure after all retries exhausted
|
||||
const isRetryExhausted = err instanceof RetryExhaustedError
|
||||
@@ -504,9 +488,8 @@ export function isCorruptedSessionError(error: any): boolean {
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up corrupted session for a specific device JID.
|
||||
* WABA behavior: DELETE sessions WHERE recipient_id=? AND device_id=?
|
||||
* Only deletes the exact device that was corrupted, not all devices.
|
||||
* Clean up corrupted session by deleting all device sessions for a JID.
|
||||
* Signal Protocol will automatically recreate the session on next message.
|
||||
*
|
||||
* NOTE: This should NOT be called on every Bad MAC error (hot path).
|
||||
* Instead, let the retry+pkmsg flow handle recovery naturally (like WhatsApp does).
|
||||
@@ -517,7 +500,45 @@ export async function cleanupCorruptedSession(
|
||||
repository: SignalRepositoryWithLIDStore,
|
||||
logger: ILogger
|
||||
): Promise<number> {
|
||||
await repository.deleteSession([jid])
|
||||
logger.info({ jid }, 'Cleaned up corrupted session for specific device')
|
||||
return 1
|
||||
const { user, device } = jidDecode(jid) || {}
|
||||
if (!user) {
|
||||
logger.warn({ jid }, 'Cannot cleanup session - invalid JID')
|
||||
return 0
|
||||
}
|
||||
|
||||
// Build list of JIDs to delete (primary + secondary devices)
|
||||
const jidsToDelete: string[] = []
|
||||
|
||||
// Determine domain type correctly (handle hosted JIDs)
|
||||
// JID formats:
|
||||
// - PN: user@s.whatsapp.net
|
||||
// - LID: user@lid
|
||||
// - Hosted PN: user@hosted
|
||||
// - Hosted LID: user@hosted.lid
|
||||
const isLID = jid.endsWith('@lid') || jid.endsWith('@hosted.lid')
|
||||
const isHosted = jid.includes('@hosted')
|
||||
|
||||
let domain: string
|
||||
if (isLID) {
|
||||
domain = isHosted ? 'hosted.lid' : 'lid'
|
||||
} else {
|
||||
domain = isHosted ? 'hosted' : 's.whatsapp.net'
|
||||
}
|
||||
|
||||
// Primary device (0)
|
||||
jidsToDelete.push(`${user}@${domain}`)
|
||||
|
||||
// Secondary devices (1-5 common range for Web/Desktop/etc)
|
||||
for (let i = 1; i <= 5; i++) {
|
||||
jidsToDelete.push(`${user}:${i}@${domain}`)
|
||||
}
|
||||
|
||||
// If specific device was identified and > 5, ensure it's included
|
||||
if (device !== undefined && device > 5) {
|
||||
jidsToDelete.push(`${user}:${device}@${domain}`)
|
||||
}
|
||||
|
||||
await repository.deleteSession(jidsToDelete)
|
||||
|
||||
return jidsToDelete.length
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import EventEmitter from 'events'
|
||||
import { proto } from '../../WAProto/index.js'
|
||||
import type {
|
||||
BaileysEvent,
|
||||
BaileysEventEmitter,
|
||||
@@ -891,7 +890,6 @@ const makeBufferData = (): BufferedEventData => {
|
||||
chats: {},
|
||||
messages: {},
|
||||
contacts: {},
|
||||
pastParticipants: {},
|
||||
isLatest: false,
|
||||
empty: true
|
||||
},
|
||||
@@ -969,28 +967,6 @@ function append<E extends BufferableEvent>(
|
||||
}
|
||||
}
|
||||
|
||||
// Merge pastParticipants with deduplication by groupJid and by userJid within each group.
|
||||
// Multiple HistorySync chunks can carry the same group -- we merge rather than concatenate
|
||||
// to avoid duplicate entries in the final event delivered to the consumer.
|
||||
for (const group of (eventData.pastParticipants ?? []) as proto.IPastParticipants[]) {
|
||||
const groupJid = group.groupJid
|
||||
if (!groupJid) continue
|
||||
|
||||
if (!data.historySets.pastParticipants[groupJid]) {
|
||||
data.historySets.pastParticipants[groupJid] = []
|
||||
}
|
||||
|
||||
const existing = data.historySets.pastParticipants[groupJid]
|
||||
const seenJids = new Set(existing.map(p => p.userJid).filter(Boolean))
|
||||
|
||||
for (const participant of (group.pastParticipants ?? []) as proto.IPastParticipant[]) {
|
||||
if (participant.userJid && !seenJids.has(participant.userJid)) {
|
||||
existing.push(participant)
|
||||
seenJids.add(participant.userJid)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data.historySets.empty = false
|
||||
data.historySets.syncType = eventData.syncType
|
||||
data.historySets.progress = eventData.progress
|
||||
@@ -1316,10 +1292,6 @@ function consolidateEvents(data: BufferedEventData) {
|
||||
chats: Object.values(data.historySets.chats),
|
||||
messages: Object.values(data.historySets.messages),
|
||||
contacts: Object.values(data.historySets.contacts),
|
||||
// Convert dedup map back to array. Each entry has groupJid + participants (all unique userJids).
|
||||
pastParticipants: Object.entries(data.historySets.pastParticipants).map(
|
||||
([groupJid, participants]) => ({ groupJid, pastParticipants: participants })
|
||||
),
|
||||
syncType: data.historySets.syncType,
|
||||
progress: data.historySets.progress,
|
||||
isLatest: data.historySets.isLatest,
|
||||
|
||||
+2
-34
@@ -15,8 +15,7 @@ import {
|
||||
import { toNumber } from './generics'
|
||||
import type { ILogger } from './logger.js'
|
||||
import { normalizeMessageContent } from './messages'
|
||||
import { DEFAULT_ORIGIN } from '../Defaults'
|
||||
import { downloadContentFromMessage, getUrlFromDirectPath } from './messages-media'
|
||||
import { downloadContentFromMessage } from './messages-media'
|
||||
|
||||
const inflatePromise = promisify(inflate)
|
||||
|
||||
@@ -375,25 +374,10 @@ export const processHistoryMessage = (item: proto.IHistorySync, logger?: ILogger
|
||||
// Convert Map back to array for return
|
||||
const lidPnMappings = Array.from(lidPnMap.values())
|
||||
|
||||
// Normalize pastParticipants: resolve LID userJids → PN so the consumer always
|
||||
// receives a phone number, never an opaque LID identifier.
|
||||
// Uses the lidPnMap built above (populated from phoneNumberToLidMappings + conversations).
|
||||
// If a LID cannot be resolved, the original value is kept rather than dropping the participant.
|
||||
const pastParticipants: proto.IPastParticipants[] = (item.pastParticipants ?? []).map(group => ({
|
||||
groupJid: group.groupJid,
|
||||
pastParticipants: (group.pastParticipants ?? []).map(participant => {
|
||||
const userJid = participant.userJid
|
||||
if (!userJid || !isAnyLidUser(userJid)) return participant
|
||||
const mapping = lidPnMap.get(jidNormalizedUser(userJid))
|
||||
return mapping?.pn ? { ...participant, userJid: mapping.pn } : participant
|
||||
})
|
||||
}))
|
||||
|
||||
return {
|
||||
chats,
|
||||
contacts,
|
||||
messages,
|
||||
pastParticipants,
|
||||
lidPnMappings,
|
||||
syncType: item.syncType,
|
||||
progress: item.progress
|
||||
@@ -424,23 +408,7 @@ export const downloadAndProcessHistorySyncNotification = async (
|
||||
historyMsg = await downloadHistory(msg, options)
|
||||
}
|
||||
|
||||
const result = processHistoryMessage(historyMsg, logger)
|
||||
|
||||
// Mirror WA Desktop behaviour: DELETE the CDN blob only after processing succeeds.
|
||||
// Doing this earlier (e.g. inside downloadHistory) risks permanent history loss if
|
||||
// processing throws — the server copy would be gone and retry after reconnect would fail.
|
||||
if (msg.directPath) {
|
||||
const cdnUrl = getUrlFromDirectPath(msg.directPath)
|
||||
fetch(cdnUrl, {
|
||||
...options,
|
||||
method: 'DELETE',
|
||||
headers: { ...((options as RequestInit).headers ?? {}), Origin: DEFAULT_ORIGIN }
|
||||
}).catch(() => {
|
||||
// non-fatal — server will expire it anyway
|
||||
})
|
||||
}
|
||||
|
||||
return result
|
||||
return processHistoryMessage(historyMsg, logger)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -218,7 +218,7 @@ export class MessageRetryManager {
|
||||
if (errorCode !== undefined && MAC_ERROR_CODES.has(errorCode)) {
|
||||
const now = Date.now()
|
||||
const prevTime = this.sessionRecreateHistory.get(jid)
|
||||
const MAC_ERROR_COOLDOWN_MS = 1_000 // 1 second — WABA recovers faster
|
||||
const MAC_ERROR_COOLDOWN_MS = 10_000 // 10 seconds
|
||||
|
||||
if (prevTime && now - prevTime < MAC_ERROR_COOLDOWN_MS) {
|
||||
const reasonName = RetryReason[errorCode] || `code_${errorCode}`
|
||||
|
||||
@@ -160,7 +160,7 @@ export const extractImageThumb = async (bufferOrFilePath: Readable | Buffer | st
|
||||
height: dimensions.height
|
||||
}
|
||||
}
|
||||
} else if ('jimp' in lib && typeof lib.jimp?.Jimp === 'function') {
|
||||
} else if ('jimp' in lib && typeof lib.jimp?.Jimp === 'object') {
|
||||
const jimp = await (lib.jimp.Jimp as any).read(bufferOrFilePath)
|
||||
const dimensions = {
|
||||
width: jimp.width,
|
||||
|
||||
+1
-62
@@ -41,11 +41,9 @@ import type { ILogger } from './logger'
|
||||
import {
|
||||
downloadContentFromMessage,
|
||||
encryptedStream,
|
||||
extractImageThumb,
|
||||
generateThumbnail,
|
||||
getAudioDuration,
|
||||
getAudioWaveform,
|
||||
getStream,
|
||||
getRawMediaUploadData,
|
||||
type MediaDownloadOptions
|
||||
} from './messages-media'
|
||||
@@ -635,59 +633,6 @@ export const generateCarouselMessage = async (
|
||||
)
|
||||
}
|
||||
|
||||
const recoverCarouselImageMetadata = async (
|
||||
imageMessage: proto.Message.IImageMessage | null | undefined,
|
||||
cardImage: WAMediaUpload,
|
||||
cardTitle: string | undefined,
|
||||
uploadOptions: MessageContentGenerationOptions
|
||||
) => {
|
||||
if (!imageMessage) {
|
||||
return
|
||||
}
|
||||
|
||||
const missingThumbnail = !imageMessage.jpegThumbnail
|
||||
const missingWidth = !imageMessage.width
|
||||
const missingHeight = !imageMessage.height
|
||||
if (!missingThumbnail && !missingWidth && !missingHeight) {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const { stream } = await getStream(cardImage, uploadOptions.options)
|
||||
const { buffer, original } = await extractImageThumb(stream)
|
||||
|
||||
if (missingThumbnail) {
|
||||
imageMessage.jpegThumbnail = buffer.toString('base64')
|
||||
}
|
||||
|
||||
if (missingWidth && original.width) {
|
||||
imageMessage.width = original.width
|
||||
}
|
||||
|
||||
if (missingHeight && original.height) {
|
||||
imageMessage.height = original.height
|
||||
}
|
||||
|
||||
uploadOptions.logger?.info(
|
||||
{
|
||||
cardTitle,
|
||||
recoveredThumbnail: !!imageMessage.jpegThumbnail,
|
||||
width: imageMessage.width,
|
||||
height: imageMessage.height
|
||||
},
|
||||
'[CAROUSEL] Recovered image metadata from source media'
|
||||
)
|
||||
} catch (error) {
|
||||
uploadOptions.logger?.warn(
|
||||
{
|
||||
cardTitle,
|
||||
trace: error instanceof Error ? error.stack : String(error)
|
||||
},
|
||||
'[CAROUSEL] Failed source-media thumbnail fallback'
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// Map cards to the carousel format (processing media)
|
||||
const carouselCards = await Promise.all(
|
||||
cards.map(async card => {
|
||||
@@ -703,11 +648,6 @@ export const generateCarouselMessage = async (
|
||||
if (hasMedia && mediaOptions) {
|
||||
if (card.image) {
|
||||
const { imageMessage } = await prepareWAMessageMedia({ image: card.image }, mediaOptions)
|
||||
|
||||
// Mirror the working Pastorini-style result: every carousel image card should
|
||||
// carry a jpegThumbnail and dimensions before it reaches the Web live renderer.
|
||||
await recoverCarouselImageMetadata(imageMessage, card.image, card.title, mediaOptions)
|
||||
|
||||
// Validate image fields needed for WhatsApp rendering
|
||||
if (imageMessage && !imageMessage.jpegThumbnail) {
|
||||
mediaOptions.logger?.warn(
|
||||
@@ -1299,8 +1239,7 @@ export const generateWAMessageContent = async (
|
||||
}
|
||||
// Pass options for media processing if cards have images/videos
|
||||
const generated = await generateCarouselMessage(carouselOptions, options)
|
||||
// Frida capture shows interactiveMessage DIRECT (field 45) in DSM — no viewOnceMessage wrapper
|
||||
// Testing without wrapper: biz node + quality_control already match Pastorini CDP stanza
|
||||
// Direct interactiveMessage — no viewOnceMessage wrapper, no root header/body/footer
|
||||
m.interactiveMessage = generated.interactiveMessage
|
||||
return m
|
||||
}
|
||||
|
||||
+12
-20
@@ -154,26 +154,18 @@ export async function storeTcTokensFromIqResult({
|
||||
continue
|
||||
}
|
||||
|
||||
const tokenEntry = {
|
||||
...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
|
||||
}
|
||||
|
||||
// Store under resolved storageJid AND under fallbackJid (PN) for reliable lookup
|
||||
// The read path may resolve to a different LID than the store path
|
||||
const normalizedFallback = jidNormalizedUser(fallbackJid)
|
||||
const keysToStore: Record<string, typeof tokenEntry | null> = {
|
||||
[storageJid]: tokenEntry
|
||||
}
|
||||
if (normalizedFallback !== storageJid) {
|
||||
keysToStore[normalizedFallback] = tokenEntry
|
||||
}
|
||||
|
||||
await keys.set({ tctoken: keysToStore })
|
||||
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
|
||||
}
|
||||
}
|
||||
})
|
||||
onNewJidStored?.(storageJid)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,19 +14,24 @@ 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.WEB,
|
||||
platform: proto.ClientPayload.UserAgent.Platform.MACOS,
|
||||
releaseChannel: proto.ClientPayload.UserAgent.ReleaseChannel.RELEASE,
|
||||
osVersion: '0.1',
|
||||
device: 'Desktop',
|
||||
osBuildNumber: '0.1',
|
||||
localeLanguageIso6391: 'en',
|
||||
|
||||
mnc: '000',
|
||||
mcc: '000',
|
||||
localeCountryIso31661Alpha2: config.countryCode
|
||||
@@ -55,16 +60,20 @@ const getClientPayload = (config: SocketConfig) => {
|
||||
const payload: proto.IClientPayload = {
|
||||
connectType: proto.ClientPayload.ConnectType.WIFI_UNKNOWN,
|
||||
connectReason: proto.ClientPayload.ConnectReason.USER_ACTIVATED,
|
||||
userAgent: getUserAgent(config)
|
||||
userAgent: getUserAgent(config),
|
||||
webInfo: getWebInfo(config)
|
||||
}
|
||||
|
||||
payload.webInfo = getWebInfo(config)
|
||||
|
||||
return payload
|
||||
}
|
||||
|
||||
export const generateLoginNode = (userJid: string, config: SocketConfig): proto.IClientPayload => {
|
||||
const { user, device } = jidDecode(userJid)!
|
||||
const decoded = jidDecode(userJid)
|
||||
if (!decoded) {
|
||||
throw new Boom('Invalid user JID', { statusCode: 400 })
|
||||
}
|
||||
|
||||
const { user, device } = decoded
|
||||
const payload: proto.IClientPayload = {
|
||||
...getClientPayload(config),
|
||||
passive: true,
|
||||
@@ -79,6 +88,10 @@ 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
|
||||
@@ -153,6 +166,9 @@ 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')
|
||||
|
||||
@@ -168,42 +184,51 @@ 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 = {
|
||||
@@ -211,7 +236,7 @@ export const configureSuccessfulPairing = (
|
||||
attrs: {
|
||||
to: S_WHATSAPP_NET,
|
||||
type: 'result',
|
||||
id: msgId!
|
||||
id: msgId
|
||||
},
|
||||
content: [
|
||||
{
|
||||
@@ -230,7 +255,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
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
} from './Protocols'
|
||||
import { USyncUser } from './USyncUser'
|
||||
|
||||
export type USyncQueryResultList = { [protocol: string]: unknown; id: string; rawId?: number }
|
||||
export type USyncQueryResultList = { [protocol: string]: unknown; id: string }
|
||||
|
||||
export type USyncQueryResult = {
|
||||
list: USyncQueryResultList[]
|
||||
@@ -68,8 +68,10 @@ export class USyncQuery {
|
||||
//TODO: see if there are any errors in the result node
|
||||
//const resultNode = getBinaryNodeChild(usyncNode, 'result')
|
||||
|
||||
const parseNodeList = (content: BinaryNode[]): USyncQueryResultList[] =>
|
||||
content.reduce((acc: USyncQueryResultList[], node) => {
|
||||
const listNode = usyncNode ? getBinaryNodeChild(usyncNode, 'list') : undefined
|
||||
|
||||
if (listNode?.content && Array.isArray(listNode.content)) {
|
||||
queryResult.list = listNode.content.reduce((acc: USyncQueryResultList[], node) => {
|
||||
const id = node?.attrs.jid
|
||||
if (id) {
|
||||
const data = Array.isArray(node?.content)
|
||||
@@ -87,24 +89,15 @@ export class USyncQuery {
|
||||
.filter(([, b]) => b !== null) as [string, unknown][]
|
||||
)
|
||||
: {}
|
||||
const rawIdAttr = node?.attrs?.['raw_id']
|
||||
const rawId = rawIdAttr !== undefined ? Number(rawIdAttr) : undefined
|
||||
acc.push({ ...data, id, ...(rawId !== undefined && !isNaN(rawId) ? { rawId } : {}) })
|
||||
acc.push({ ...data, id })
|
||||
}
|
||||
|
||||
return acc
|
||||
}, [])
|
||||
|
||||
const listNode = usyncNode ? getBinaryNodeChild(usyncNode, 'list') : undefined
|
||||
if (listNode?.content && Array.isArray(listNode.content)) {
|
||||
queryResult.list = parseNodeList(listNode.content)
|
||||
}
|
||||
|
||||
const sideListNode = usyncNode ? getBinaryNodeChild(usyncNode, 'side_list') : undefined
|
||||
if (sideListNode?.content && Array.isArray(sideListNode.content)) {
|
||||
queryResult.sideList = parseNodeList(sideListNode.content)
|
||||
}
|
||||
|
||||
//TODO: implement side list
|
||||
//const sideListNode = getBinaryNodeChild(usyncNode, 'side_list')
|
||||
return queryResult
|
||||
}
|
||||
|
||||
|
||||
@@ -388,13 +388,6 @@ __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"
|
||||
@@ -3112,7 +3105,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.3"
|
||||
music-metadata: "npm:^11.12.0"
|
||||
open: "npm:^11.0.0"
|
||||
p-queue: "npm:^9.0.0"
|
||||
pino: "npm:^10.3.1"
|
||||
@@ -4563,15 +4556,15 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"file-type@npm:^21.3.1":
|
||||
version: 21.3.1
|
||||
resolution: "file-type@npm:21.3.1"
|
||||
"file-type@npm:^21.3.0":
|
||||
version: 21.3.0
|
||||
resolution: "file-type@npm:21.3.0"
|
||||
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/66a8eda781c803c6fc372464abba88cee564cfe30f029716f06909da1564bc51d0a4e8d34654b881dc751cdb0513338b3c0747e06a608cee0dd5c5499b018d47
|
||||
checksum: 10c0/1b1fa909e6063044a6da1d2ea348ee4d747ed9286382d3f0d4d6532c11fb2ea9f2e7e67b2bc7d745d1bc937e05dee1aa8cb912c64250933bcb393a3744f4e284
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -6511,21 +6504,21 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"music-metadata@npm:^11.12.3":
|
||||
version: 11.12.3
|
||||
resolution: "music-metadata@npm:11.12.3"
|
||||
"music-metadata@npm:^11.12.0":
|
||||
version: 11.12.0
|
||||
resolution: "music-metadata@npm:11.12.0"
|
||||
dependencies:
|
||||
"@borewit/text-codec": "npm:^0.2.2"
|
||||
"@borewit/text-codec": "npm:^0.2.1"
|
||||
"@tokenizer/token": "npm:^0.3.0"
|
||||
content-type: "npm:^1.0.5"
|
||||
debug: "npm:^4.4.3"
|
||||
file-type: "npm:^21.3.1"
|
||||
file-type: "npm:^21.3.0"
|
||||
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/57df905f51ec792e5b4c994645eab64d47d5608b9de11151f54b26fbd5f563598ec04d8aed7f244ef1479030d78ddab8af1ee84dfcee40a93b3241941b50999d
|
||||
checksum: 10c0/014a120b8941ab80452171def0ec3cba013041ba4b94f8061ad493a037d3423e6d316131a13fb0433404685ebd3c8e3ae2255c1bafaeb20673fcd73af2df0148
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
||||
Reference in New Issue
Block a user