Compare commits
55 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3f4e83a8af | |||
| d870ffb2a3 | |||
| f6c72530a2 | |||
| a4e7422487 | |||
| c6511d3034 | |||
| d2db4cec97 | |||
| be44c5fdb0 | |||
| f63f0a766f | |||
| fbefa6a0ad | |||
| 9c4cdc3e02 | |||
| ba1c1b0fdb | |||
| 876af2e96c | |||
| 5bb18da6bf | |||
| 52d8ddae32 | |||
| 8c8c5a312e | |||
| 52756fb50d | |||
| bd8465d9b8 | |||
| 6c52b01ea7 | |||
| a9e926b907 | |||
| 71fe69fd21 | |||
| eecf6df2a2 | |||
| d04a3e1af8 | |||
| 21462c26d5 | |||
| fc2122b11a | |||
| 11eed3aedc | |||
| dbc6dd6aed | |||
| e152aee740 | |||
| ff9b84c561 | |||
| 50c13398c4 | |||
| d991d0212d | |||
| 7c095c84a5 | |||
| a25e6740fd | |||
| 986ac588a9 | |||
| 64c73faab2 | |||
| b5464bec73 | |||
| 9f8f74fc7a | |||
| aaf3bd83eb | |||
| 8fe71b03d5 | |||
| c2c156d707 | |||
| e46b9750c2 | |||
| 542b7a278d | |||
| 6d7e0d7b35 | |||
| 9daee4d8fd | |||
| d7b2ceb161 | |||
| 2236ef83a9 | |||
| 07f775dd18 | |||
| ad81d1535d | |||
| 7ecfaefcfa | |||
| ad4f676e2b | |||
| 54d6a023a4 | |||
| 935484c790 | |||
| f2c14f9ad6 | |||
| ac2acf3d87 | |||
| 0b527b0855 | |||
| 9f8b603e28 |
+89
-3
@@ -1,7 +1,7 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
package proto;
|
package proto;
|
||||||
|
|
||||||
/// WhatsApp Version: 2.3000.1034621774
|
/// WhatsApp Version: 2.3000.1035577069
|
||||||
|
|
||||||
message ADVDeviceIdentity {
|
message ADVDeviceIdentity {
|
||||||
optional uint32 rawId = 1;
|
optional uint32 rawId = 1;
|
||||||
@@ -345,6 +345,14 @@ message BotAgeCollectionMetadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message BotAgentDeepLinkMetadata {
|
||||||
|
optional string token = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message BotAgentMetadata {
|
||||||
|
optional BotAgentDeepLinkMetadata deepLinkMetadata = 1;
|
||||||
|
}
|
||||||
|
|
||||||
message BotCapabilityMetadata {
|
message BotCapabilityMetadata {
|
||||||
repeated BotCapabilityType capabilities = 1;
|
repeated BotCapabilityType capabilities = 1;
|
||||||
enum BotCapabilityType {
|
enum BotCapabilityType {
|
||||||
@@ -407,6 +415,9 @@ message BotCapabilityMetadata {
|
|||||||
RICH_RESPONSE_INLINE_LINKS_ENABLED = 56;
|
RICH_RESPONSE_INLINE_LINKS_ENABLED = 56;
|
||||||
RICH_RESPONSE_UR_IMAGINE_VIDEO = 57;
|
RICH_RESPONSE_UR_IMAGINE_VIDEO = 57;
|
||||||
JSON_PATCH_STREAMING = 58;
|
JSON_PATCH_STREAMING = 58;
|
||||||
|
AI_TAB_FORCE_CLIPPY = 59;
|
||||||
|
UNIFIED_RESPONSE_EMBEDDED_SCREENS = 60;
|
||||||
|
AI_SUBSCRIPTION_ENABLED = 61;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1074,6 +1085,7 @@ message ClientPairingProps {
|
|||||||
optional bool isSyncdPureLidSession = 2;
|
optional bool isSyncdPureLidSession = 2;
|
||||||
optional bool isSyncdSnapshotRecoveryEnabled = 3;
|
optional bool isSyncdSnapshotRecoveryEnabled = 3;
|
||||||
optional bool isHsThumbnailSyncEnabled = 4;
|
optional bool isHsThumbnailSyncEnabled = 4;
|
||||||
|
optional bytes subscriptionSyncPayload = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ClientPayload {
|
message ClientPayload {
|
||||||
@@ -1454,6 +1466,7 @@ message ContextInfo {
|
|||||||
optional AdType adType = 25;
|
optional AdType adType = 25;
|
||||||
optional string wtwaWebsiteUrl = 26;
|
optional string wtwaWebsiteUrl = 26;
|
||||||
optional string adPreviewUrl = 27;
|
optional string adPreviewUrl = 27;
|
||||||
|
optional bool containsCtwaFlowsAutoReply = 28;
|
||||||
enum AdType {
|
enum AdType {
|
||||||
CTWA = 0;
|
CTWA = 0;
|
||||||
CAWC = 1;
|
CAWC = 1;
|
||||||
@@ -1608,6 +1621,8 @@ message Conversation {
|
|||||||
optional bool limitSharingInitiatedByMe = 53;
|
optional bool limitSharingInitiatedByMe = 53;
|
||||||
optional bool maibaAiThreadEnabled = 54;
|
optional bool maibaAiThreadEnabled = 54;
|
||||||
optional bool isMarketingMessageThread = 55;
|
optional bool isMarketingMessageThread = 55;
|
||||||
|
optional bool isSenderNewAccount = 56;
|
||||||
|
optional uint32 afterReadDuration = 57;
|
||||||
enum EndOfHistoryTransferType {
|
enum EndOfHistoryTransferType {
|
||||||
COMPLETE_BUT_MORE_MESSAGES_REMAIN_ON_PRIMARY = 0;
|
COMPLETE_BUT_MORE_MESSAGES_REMAIN_ON_PRIMARY = 0;
|
||||||
COMPLETE_AND_NO_MORE_MESSAGE_REMAIN_ON_PRIMARY = 1;
|
COMPLETE_AND_NO_MORE_MESSAGE_REMAIN_ON_PRIMARY = 1;
|
||||||
@@ -1635,6 +1650,8 @@ message DeviceCapabilities {
|
|||||||
message BusinessBroadcast {
|
message BusinessBroadcast {
|
||||||
optional bool importListEnabled = 1;
|
optional bool importListEnabled = 1;
|
||||||
optional bool companionSupportEnabled = 2;
|
optional bool companionSupportEnabled = 2;
|
||||||
|
optional bool campaignSyncEnabled = 3;
|
||||||
|
optional bool insightsSyncEnabled = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ChatLockSupportLevel {
|
enum ChatLockSupportLevel {
|
||||||
@@ -1904,6 +1921,8 @@ message HandshakeMessage {
|
|||||||
optional bytes static = 1;
|
optional bytes static = 1;
|
||||||
optional bytes payload = 2;
|
optional bytes payload = 2;
|
||||||
optional bytes extendedCiphertext = 3;
|
optional bytes extendedCiphertext = 3;
|
||||||
|
optional bytes paddedBytes = 4;
|
||||||
|
optional bool simulateXxkemFs = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ClientHello {
|
message ClientHello {
|
||||||
@@ -1912,13 +1931,29 @@ message HandshakeMessage {
|
|||||||
optional bytes payload = 3;
|
optional bytes payload = 3;
|
||||||
optional bool useExtended = 4;
|
optional bool useExtended = 4;
|
||||||
optional bytes extendedCiphertext = 5;
|
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 {
|
message ServerHello {
|
||||||
optional bytes ephemeral = 1;
|
optional bytes ephemeral = 1;
|
||||||
optional bytes static = 2;
|
optional bytes static = 2;
|
||||||
optional bytes payload = 3;
|
optional bytes payload = 3;
|
||||||
optional bytes extendedStatic = 4;
|
optional bytes extendedStatic = 4;
|
||||||
|
optional bytes paddingBytes = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2114,7 +2149,6 @@ message LimitSharing {
|
|||||||
CHAT_SETTING = 1;
|
CHAT_SETTING = 1;
|
||||||
BIZ_SUPPORTS_FB_HOSTING = 2;
|
BIZ_SUPPORTS_FB_HOSTING = 2;
|
||||||
UNKNOWN_GROUP = 3;
|
UNKNOWN_GROUP = 3;
|
||||||
DEPRECATION = 4;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2275,6 +2309,7 @@ message Message {
|
|||||||
optional PollCreationMessage pollCreationMessageV6 = 119;
|
optional PollCreationMessage pollCreationMessageV6 = 119;
|
||||||
optional ConditionalRevealMessage conditionalRevealMessage = 120;
|
optional ConditionalRevealMessage conditionalRevealMessage = 120;
|
||||||
optional PollAddOptionMessage pollAddOptionMessage = 121;
|
optional PollAddOptionMessage pollAddOptionMessage = 121;
|
||||||
|
optional EventInviteMessage eventInviteMessage = 122;
|
||||||
message AlbumMessage {
|
message AlbumMessage {
|
||||||
optional uint32 expectedImageCount = 2;
|
optional uint32 expectedImageCount = 2;
|
||||||
optional uint32 expectedVideoCount = 3;
|
optional uint32 expectedVideoCount = 3;
|
||||||
@@ -2555,6 +2590,16 @@ message Message {
|
|||||||
optional bytes encIv = 3;
|
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 {
|
message EventMessage {
|
||||||
optional ContextInfo contextInfo = 1;
|
optional ContextInfo contextInfo = 1;
|
||||||
optional bool isCanceled = 2;
|
optional bool isCanceled = 2;
|
||||||
@@ -3081,9 +3126,10 @@ message Message {
|
|||||||
|
|
||||||
message MessageHistoryMetadata {
|
message MessageHistoryMetadata {
|
||||||
repeated string historyReceivers = 1;
|
repeated string historyReceivers = 1;
|
||||||
optional int64 oldestMessageTimestamp = 2;
|
optional int64 oldestMessageTimestampInWindow = 2;
|
||||||
optional int64 messageCount = 3;
|
optional int64 messageCount = 3;
|
||||||
repeated string nonHistoryReceivers = 4;
|
repeated string nonHistoryReceivers = 4;
|
||||||
|
optional int64 oldestMessageTimestampInBundle = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
message MessageHistoryNotice {
|
message MessageHistoryNotice {
|
||||||
@@ -3144,6 +3190,11 @@ message Message {
|
|||||||
optional int64 expiryTimestamp = 2;
|
optional int64 expiryTimestamp = 2;
|
||||||
optional bool incentiveEligible = 3;
|
optional bool incentiveEligible = 3;
|
||||||
optional string referralId = 4;
|
optional string referralId = 4;
|
||||||
|
optional InviteType inviteType = 5;
|
||||||
|
enum InviteType {
|
||||||
|
DEFAULT = 0;
|
||||||
|
MAPPER = 1;
|
||||||
|
}
|
||||||
enum ServiceType {
|
enum ServiceType {
|
||||||
UNKNOWN = 0;
|
UNKNOWN = 0;
|
||||||
FBPAY = 1;
|
FBPAY = 1;
|
||||||
@@ -3565,6 +3616,7 @@ message Message {
|
|||||||
GROUP_MEMBER_LABEL_CHANGE = 30;
|
GROUP_MEMBER_LABEL_CHANGE = 30;
|
||||||
AI_MEDIA_COLLECTION_MESSAGE = 31;
|
AI_MEDIA_COLLECTION_MESSAGE = 31;
|
||||||
MESSAGE_UNSCHEDULE = 32;
|
MESSAGE_UNSCHEDULE = 32;
|
||||||
|
BOT_UNLINK_MESSAGE = 33;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3597,6 +3649,7 @@ message Message {
|
|||||||
message RequestWelcomeMessageMetadata {
|
message RequestWelcomeMessageMetadata {
|
||||||
optional LocalChatState localChatState = 1;
|
optional LocalChatState localChatState = 1;
|
||||||
optional WelcomeTrigger welcomeTrigger = 2;
|
optional WelcomeTrigger welcomeTrigger = 2;
|
||||||
|
optional BotAgentMetadata botAgentMetadata = 3;
|
||||||
enum LocalChatState {
|
enum LocalChatState {
|
||||||
EMPTY = 0;
|
EMPTY = 0;
|
||||||
NON_EMPTY = 1;
|
NON_EMPTY = 1;
|
||||||
@@ -4124,6 +4177,8 @@ enum MutationProps {
|
|||||||
BUSINESS_BROADCAST_CAMPAIGN_ACTION = 81;
|
BUSINESS_BROADCAST_CAMPAIGN_ACTION = 81;
|
||||||
BUSINESS_BROADCAST_INSIGHTS_ACTION = 82;
|
BUSINESS_BROADCAST_INSIGHTS_ACTION = 82;
|
||||||
CUSTOMER_DATA_ACTION = 83;
|
CUSTOMER_DATA_ACTION = 83;
|
||||||
|
SUBSCRIPTIONS_SYNC_V2_ACTION = 84;
|
||||||
|
THREAD_PIN_ACTION = 85;
|
||||||
SHARE_OWN_PN = 10001;
|
SHARE_OWN_PN = 10001;
|
||||||
BUSINESS_BROADCAST_ACTION = 10002;
|
BUSINESS_BROADCAST_ACTION = 10002;
|
||||||
AI_THREAD_DELETE_ACTION = 10003;
|
AI_THREAD_DELETE_ACTION = 10003;
|
||||||
@@ -4592,6 +4647,7 @@ message StatusAttribution {
|
|||||||
APPLE_MUSIC = 8;
|
APPLE_MUSIC = 8;
|
||||||
SHARECHAT = 9;
|
SHARECHAT = 9;
|
||||||
GOOGLE_PHOTOS = 10;
|
GOOGLE_PHOTOS = 10;
|
||||||
|
SOUNDCLOUD = 11;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4760,6 +4816,8 @@ message SyncActionValue {
|
|||||||
optional BusinessBroadcastCampaignAction businessBroadcastCampaignAction = 81;
|
optional BusinessBroadcastCampaignAction businessBroadcastCampaignAction = 81;
|
||||||
optional BusinessBroadcastInsightsAction businessBroadcastInsightsAction = 82;
|
optional BusinessBroadcastInsightsAction businessBroadcastInsightsAction = 82;
|
||||||
optional CustomerDataAction customerDataAction = 83;
|
optional CustomerDataAction customerDataAction = 83;
|
||||||
|
optional SubscriptionsSyncV2Action subscriptionsSyncV2Action = 84;
|
||||||
|
optional ThreadPinAction threadPinAction = 85;
|
||||||
message AgentAction {
|
message AgentAction {
|
||||||
optional string name = 1;
|
optional string name = 1;
|
||||||
optional int32 deviceID = 2;
|
optional int32 deviceID = 2;
|
||||||
@@ -4834,6 +4892,7 @@ message SyncActionValue {
|
|||||||
repeated SyncActionValue.BroadcastListParticipant participants = 2;
|
repeated SyncActionValue.BroadcastListParticipant participants = 2;
|
||||||
optional string listName = 3;
|
optional string listName = 3;
|
||||||
repeated string labelIds = 4;
|
repeated string labelIds = 4;
|
||||||
|
optional string audienceExpression = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
message CallLogAction {
|
message CallLogAction {
|
||||||
@@ -5275,6 +5334,29 @@ message SyncActionValue {
|
|||||||
optional int64 expirationDate = 3;
|
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 {
|
message SyncActionMessage {
|
||||||
optional MessageKey key = 1;
|
optional MessageKey key = 1;
|
||||||
optional int64 timestamp = 2;
|
optional int64 timestamp = 2;
|
||||||
@@ -5286,6 +5368,10 @@ message SyncActionValue {
|
|||||||
repeated SyncActionValue.SyncActionMessage messages = 3;
|
repeated SyncActionValue.SyncActionMessage messages = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message ThreadPinAction {
|
||||||
|
optional bool pinned = 1;
|
||||||
|
}
|
||||||
|
|
||||||
message TimeFormatAction {
|
message TimeFormatAction {
|
||||||
optional bool isTwentyFourHourFormatEnabled = 1;
|
optional bool isTwentyFourHourFormatEnabled = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+219
-7
@@ -981,6 +981,38 @@ export namespace proto {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface IBotAgentDeepLinkMetadata {
|
||||||
|
token?: (string|null);
|
||||||
|
}
|
||||||
|
|
||||||
|
class BotAgentDeepLinkMetadata implements IBotAgentDeepLinkMetadata {
|
||||||
|
constructor(p?: proto.IBotAgentDeepLinkMetadata);
|
||||||
|
public token?: (string|null);
|
||||||
|
public static create(properties?: proto.IBotAgentDeepLinkMetadata): proto.BotAgentDeepLinkMetadata;
|
||||||
|
public static encode(m: proto.IBotAgentDeepLinkMetadata, w?: $protobuf.Writer): $protobuf.Writer;
|
||||||
|
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.BotAgentDeepLinkMetadata;
|
||||||
|
public static fromObject(d: { [k: string]: any }): proto.BotAgentDeepLinkMetadata;
|
||||||
|
public static toObject(m: proto.BotAgentDeepLinkMetadata, o?: $protobuf.IConversionOptions): { [k: string]: any };
|
||||||
|
public toJSON(): { [k: string]: any };
|
||||||
|
public static getTypeUrl(typeUrlPrefix?: string): string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IBotAgentMetadata {
|
||||||
|
deepLinkMetadata?: (proto.IBotAgentDeepLinkMetadata|null);
|
||||||
|
}
|
||||||
|
|
||||||
|
class BotAgentMetadata implements IBotAgentMetadata {
|
||||||
|
constructor(p?: proto.IBotAgentMetadata);
|
||||||
|
public deepLinkMetadata?: (proto.IBotAgentDeepLinkMetadata|null);
|
||||||
|
public static create(properties?: proto.IBotAgentMetadata): proto.BotAgentMetadata;
|
||||||
|
public static encode(m: proto.IBotAgentMetadata, w?: $protobuf.Writer): $protobuf.Writer;
|
||||||
|
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.BotAgentMetadata;
|
||||||
|
public static fromObject(d: { [k: string]: any }): proto.BotAgentMetadata;
|
||||||
|
public static toObject(m: proto.BotAgentMetadata, o?: $protobuf.IConversionOptions): { [k: string]: any };
|
||||||
|
public toJSON(): { [k: string]: any };
|
||||||
|
public static getTypeUrl(typeUrlPrefix?: string): string;
|
||||||
|
}
|
||||||
|
|
||||||
interface IBotCapabilityMetadata {
|
interface IBotCapabilityMetadata {
|
||||||
capabilities?: (proto.BotCapabilityMetadata.BotCapabilityType[]|null);
|
capabilities?: (proto.BotCapabilityMetadata.BotCapabilityType[]|null);
|
||||||
}
|
}
|
||||||
@@ -1058,7 +1090,10 @@ export namespace proto {
|
|||||||
RICH_RESPONSE_UR_BLOKS_ENABLED = 55,
|
RICH_RESPONSE_UR_BLOKS_ENABLED = 55,
|
||||||
RICH_RESPONSE_INLINE_LINKS_ENABLED = 56,
|
RICH_RESPONSE_INLINE_LINKS_ENABLED = 56,
|
||||||
RICH_RESPONSE_UR_IMAGINE_VIDEO = 57,
|
RICH_RESPONSE_UR_IMAGINE_VIDEO = 57,
|
||||||
JSON_PATCH_STREAMING = 58
|
JSON_PATCH_STREAMING = 58,
|
||||||
|
AI_TAB_FORCE_CLIPPY = 59,
|
||||||
|
UNIFIED_RESPONSE_EMBEDDED_SCREENS = 60,
|
||||||
|
AI_SUBSCRIPTION_ENABLED = 61
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2769,6 +2804,7 @@ export namespace proto {
|
|||||||
isSyncdPureLidSession?: (boolean|null);
|
isSyncdPureLidSession?: (boolean|null);
|
||||||
isSyncdSnapshotRecoveryEnabled?: (boolean|null);
|
isSyncdSnapshotRecoveryEnabled?: (boolean|null);
|
||||||
isHsThumbnailSyncEnabled?: (boolean|null);
|
isHsThumbnailSyncEnabled?: (boolean|null);
|
||||||
|
subscriptionSyncPayload?: (Uint8Array|null);
|
||||||
}
|
}
|
||||||
|
|
||||||
class ClientPairingProps implements IClientPairingProps {
|
class ClientPairingProps implements IClientPairingProps {
|
||||||
@@ -2777,6 +2813,7 @@ export namespace proto {
|
|||||||
public isSyncdPureLidSession?: (boolean|null);
|
public isSyncdPureLidSession?: (boolean|null);
|
||||||
public isSyncdSnapshotRecoveryEnabled?: (boolean|null);
|
public isSyncdSnapshotRecoveryEnabled?: (boolean|null);
|
||||||
public isHsThumbnailSyncEnabled?: (boolean|null);
|
public isHsThumbnailSyncEnabled?: (boolean|null);
|
||||||
|
public subscriptionSyncPayload?: (Uint8Array|null);
|
||||||
public static create(properties?: proto.IClientPairingProps): proto.ClientPairingProps;
|
public static create(properties?: proto.IClientPairingProps): proto.ClientPairingProps;
|
||||||
public static encode(m: proto.IClientPairingProps, w?: $protobuf.Writer): $protobuf.Writer;
|
public static encode(m: proto.IClientPairingProps, w?: $protobuf.Writer): $protobuf.Writer;
|
||||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.ClientPairingProps;
|
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.ClientPairingProps;
|
||||||
@@ -3554,6 +3591,7 @@ export namespace proto {
|
|||||||
adType?: (proto.ContextInfo.ExternalAdReplyInfo.AdType|null);
|
adType?: (proto.ContextInfo.ExternalAdReplyInfo.AdType|null);
|
||||||
wtwaWebsiteUrl?: (string|null);
|
wtwaWebsiteUrl?: (string|null);
|
||||||
adPreviewUrl?: (string|null);
|
adPreviewUrl?: (string|null);
|
||||||
|
containsCtwaFlowsAutoReply?: (boolean|null);
|
||||||
}
|
}
|
||||||
|
|
||||||
class ExternalAdReplyInfo implements IExternalAdReplyInfo {
|
class ExternalAdReplyInfo implements IExternalAdReplyInfo {
|
||||||
@@ -3585,6 +3623,7 @@ export namespace proto {
|
|||||||
public adType?: (proto.ContextInfo.ExternalAdReplyInfo.AdType|null);
|
public adType?: (proto.ContextInfo.ExternalAdReplyInfo.AdType|null);
|
||||||
public wtwaWebsiteUrl?: (string|null);
|
public wtwaWebsiteUrl?: (string|null);
|
||||||
public adPreviewUrl?: (string|null);
|
public adPreviewUrl?: (string|null);
|
||||||
|
public containsCtwaFlowsAutoReply?: (boolean|null);
|
||||||
public static create(properties?: proto.ContextInfo.IExternalAdReplyInfo): proto.ContextInfo.ExternalAdReplyInfo;
|
public static create(properties?: proto.ContextInfo.IExternalAdReplyInfo): proto.ContextInfo.ExternalAdReplyInfo;
|
||||||
public static encode(m: proto.ContextInfo.IExternalAdReplyInfo, w?: $protobuf.Writer): $protobuf.Writer;
|
public static encode(m: proto.ContextInfo.IExternalAdReplyInfo, w?: $protobuf.Writer): $protobuf.Writer;
|
||||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.ContextInfo.ExternalAdReplyInfo;
|
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.ContextInfo.ExternalAdReplyInfo;
|
||||||
@@ -3849,6 +3888,8 @@ export namespace proto {
|
|||||||
limitSharingInitiatedByMe?: (boolean|null);
|
limitSharingInitiatedByMe?: (boolean|null);
|
||||||
maibaAiThreadEnabled?: (boolean|null);
|
maibaAiThreadEnabled?: (boolean|null);
|
||||||
isMarketingMessageThread?: (boolean|null);
|
isMarketingMessageThread?: (boolean|null);
|
||||||
|
isSenderNewAccount?: (boolean|null);
|
||||||
|
afterReadDuration?: (number|null);
|
||||||
}
|
}
|
||||||
|
|
||||||
class Conversation implements IConversation {
|
class Conversation implements IConversation {
|
||||||
@@ -3908,6 +3949,8 @@ export namespace proto {
|
|||||||
public limitSharingInitiatedByMe?: (boolean|null);
|
public limitSharingInitiatedByMe?: (boolean|null);
|
||||||
public maibaAiThreadEnabled?: (boolean|null);
|
public maibaAiThreadEnabled?: (boolean|null);
|
||||||
public isMarketingMessageThread?: (boolean|null);
|
public isMarketingMessageThread?: (boolean|null);
|
||||||
|
public isSenderNewAccount?: (boolean|null);
|
||||||
|
public afterReadDuration?: (number|null);
|
||||||
public static create(properties?: proto.IConversation): proto.Conversation;
|
public static create(properties?: proto.IConversation): proto.Conversation;
|
||||||
public static encode(m: proto.IConversation, w?: $protobuf.Writer): $protobuf.Writer;
|
public static encode(m: proto.IConversation, w?: $protobuf.Writer): $protobuf.Writer;
|
||||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.Conversation;
|
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.Conversation;
|
||||||
@@ -3983,12 +4026,16 @@ export namespace proto {
|
|||||||
interface IBusinessBroadcast {
|
interface IBusinessBroadcast {
|
||||||
importListEnabled?: (boolean|null);
|
importListEnabled?: (boolean|null);
|
||||||
companionSupportEnabled?: (boolean|null);
|
companionSupportEnabled?: (boolean|null);
|
||||||
|
campaignSyncEnabled?: (boolean|null);
|
||||||
|
insightsSyncEnabled?: (boolean|null);
|
||||||
}
|
}
|
||||||
|
|
||||||
class BusinessBroadcast implements IBusinessBroadcast {
|
class BusinessBroadcast implements IBusinessBroadcast {
|
||||||
constructor(p?: proto.DeviceCapabilities.IBusinessBroadcast);
|
constructor(p?: proto.DeviceCapabilities.IBusinessBroadcast);
|
||||||
public importListEnabled?: (boolean|null);
|
public importListEnabled?: (boolean|null);
|
||||||
public companionSupportEnabled?: (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 create(properties?: proto.DeviceCapabilities.IBusinessBroadcast): proto.DeviceCapabilities.BusinessBroadcast;
|
||||||
public static encode(m: proto.DeviceCapabilities.IBusinessBroadcast, w?: $protobuf.Writer): $protobuf.Writer;
|
public static encode(m: proto.DeviceCapabilities.IBusinessBroadcast, w?: $protobuf.Writer): $protobuf.Writer;
|
||||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.DeviceCapabilities.BusinessBroadcast;
|
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.DeviceCapabilities.BusinessBroadcast;
|
||||||
@@ -4684,6 +4731,8 @@ export namespace proto {
|
|||||||
"static"?: (Uint8Array|null);
|
"static"?: (Uint8Array|null);
|
||||||
payload?: (Uint8Array|null);
|
payload?: (Uint8Array|null);
|
||||||
extendedCiphertext?: (Uint8Array|null);
|
extendedCiphertext?: (Uint8Array|null);
|
||||||
|
paddedBytes?: (Uint8Array|null);
|
||||||
|
simulateXxkemFs?: (boolean|null);
|
||||||
}
|
}
|
||||||
|
|
||||||
class ClientFinish implements IClientFinish {
|
class ClientFinish implements IClientFinish {
|
||||||
@@ -4691,6 +4740,8 @@ export namespace proto {
|
|||||||
public static?: (Uint8Array|null);
|
public static?: (Uint8Array|null);
|
||||||
public payload?: (Uint8Array|null);
|
public payload?: (Uint8Array|null);
|
||||||
public extendedCiphertext?: (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 create(properties?: proto.HandshakeMessage.IClientFinish): proto.HandshakeMessage.ClientFinish;
|
||||||
public static encode(m: proto.HandshakeMessage.IClientFinish, w?: $protobuf.Writer): $protobuf.Writer;
|
public static encode(m: proto.HandshakeMessage.IClientFinish, w?: $protobuf.Writer): $protobuf.Writer;
|
||||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.HandshakeMessage.ClientFinish;
|
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.HandshakeMessage.ClientFinish;
|
||||||
@@ -4706,6 +4757,10 @@ export namespace proto {
|
|||||||
payload?: (Uint8Array|null);
|
payload?: (Uint8Array|null);
|
||||||
useExtended?: (boolean|null);
|
useExtended?: (boolean|null);
|
||||||
extendedCiphertext?: (Uint8Array|null);
|
extendedCiphertext?: (Uint8Array|null);
|
||||||
|
paddedBytes?: (Uint8Array|null);
|
||||||
|
sendServerHelloPaddedBytes?: (boolean|null);
|
||||||
|
simulateXxkemFs?: (boolean|null);
|
||||||
|
pqMode?: (proto.HandshakeMessage.HandshakePqMode|null);
|
||||||
}
|
}
|
||||||
|
|
||||||
class ClientHello implements IClientHello {
|
class ClientHello implements IClientHello {
|
||||||
@@ -4715,6 +4770,10 @@ export namespace proto {
|
|||||||
public payload?: (Uint8Array|null);
|
public payload?: (Uint8Array|null);
|
||||||
public useExtended?: (boolean|null);
|
public useExtended?: (boolean|null);
|
||||||
public extendedCiphertext?: (Uint8Array|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 create(properties?: proto.HandshakeMessage.IClientHello): proto.HandshakeMessage.ClientHello;
|
||||||
public static encode(m: proto.HandshakeMessage.IClientHello, w?: $protobuf.Writer): $protobuf.Writer;
|
public static encode(m: proto.HandshakeMessage.IClientHello, w?: $protobuf.Writer): $protobuf.Writer;
|
||||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.HandshakeMessage.ClientHello;
|
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.HandshakeMessage.ClientHello;
|
||||||
@@ -4724,11 +4783,24 @@ export namespace proto {
|
|||||||
public static getTypeUrl(typeUrlPrefix?: string): string;
|
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 {
|
interface IServerHello {
|
||||||
ephemeral?: (Uint8Array|null);
|
ephemeral?: (Uint8Array|null);
|
||||||
"static"?: (Uint8Array|null);
|
"static"?: (Uint8Array|null);
|
||||||
payload?: (Uint8Array|null);
|
payload?: (Uint8Array|null);
|
||||||
extendedStatic?: (Uint8Array|null);
|
extendedStatic?: (Uint8Array|null);
|
||||||
|
paddingBytes?: (Uint8Array|null);
|
||||||
}
|
}
|
||||||
|
|
||||||
class ServerHello implements IServerHello {
|
class ServerHello implements IServerHello {
|
||||||
@@ -4737,6 +4809,7 @@ export namespace proto {
|
|||||||
public static?: (Uint8Array|null);
|
public static?: (Uint8Array|null);
|
||||||
public payload?: (Uint8Array|null);
|
public payload?: (Uint8Array|null);
|
||||||
public extendedStatic?: (Uint8Array|null);
|
public extendedStatic?: (Uint8Array|null);
|
||||||
|
public paddingBytes?: (Uint8Array|null);
|
||||||
public static create(properties?: proto.HandshakeMessage.IServerHello): proto.HandshakeMessage.ServerHello;
|
public static create(properties?: proto.HandshakeMessage.IServerHello): proto.HandshakeMessage.ServerHello;
|
||||||
public static encode(m: proto.HandshakeMessage.IServerHello, w?: $protobuf.Writer): $protobuf.Writer;
|
public static encode(m: proto.HandshakeMessage.IServerHello, w?: $protobuf.Writer): $protobuf.Writer;
|
||||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.HandshakeMessage.ServerHello;
|
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.HandshakeMessage.ServerHello;
|
||||||
@@ -5283,8 +5356,7 @@ export namespace proto {
|
|||||||
UNKNOWN = 0,
|
UNKNOWN = 0,
|
||||||
CHAT_SETTING = 1,
|
CHAT_SETTING = 1,
|
||||||
BIZ_SUPPORTS_FB_HOSTING = 2,
|
BIZ_SUPPORTS_FB_HOSTING = 2,
|
||||||
UNKNOWN_GROUP = 3,
|
UNKNOWN_GROUP = 3
|
||||||
DEPRECATION = 4
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5546,6 +5618,7 @@ export namespace proto {
|
|||||||
pollCreationMessageV6?: (proto.Message.IPollCreationMessage|null);
|
pollCreationMessageV6?: (proto.Message.IPollCreationMessage|null);
|
||||||
conditionalRevealMessage?: (proto.Message.IConditionalRevealMessage|null);
|
conditionalRevealMessage?: (proto.Message.IConditionalRevealMessage|null);
|
||||||
pollAddOptionMessage?: (proto.Message.IPollAddOptionMessage|null);
|
pollAddOptionMessage?: (proto.Message.IPollAddOptionMessage|null);
|
||||||
|
eventInviteMessage?: (proto.Message.IEventInviteMessage|null);
|
||||||
}
|
}
|
||||||
|
|
||||||
class Message implements IMessage {
|
class Message implements IMessage {
|
||||||
@@ -5651,6 +5724,7 @@ export namespace proto {
|
|||||||
public pollCreationMessageV6?: (proto.Message.IPollCreationMessage|null);
|
public pollCreationMessageV6?: (proto.Message.IPollCreationMessage|null);
|
||||||
public conditionalRevealMessage?: (proto.Message.IConditionalRevealMessage|null);
|
public conditionalRevealMessage?: (proto.Message.IConditionalRevealMessage|null);
|
||||||
public pollAddOptionMessage?: (proto.Message.IPollAddOptionMessage|null);
|
public pollAddOptionMessage?: (proto.Message.IPollAddOptionMessage|null);
|
||||||
|
public eventInviteMessage?: (proto.Message.IEventInviteMessage|null);
|
||||||
public static create(properties?: proto.IMessage): proto.Message;
|
public static create(properties?: proto.IMessage): proto.Message;
|
||||||
public static encode(m: proto.IMessage, w?: $protobuf.Writer): $protobuf.Writer;
|
public static encode(m: proto.IMessage, w?: $protobuf.Writer): $protobuf.Writer;
|
||||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.Message;
|
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.Message;
|
||||||
@@ -6454,6 +6528,34 @@ export namespace proto {
|
|||||||
public static getTypeUrl(typeUrlPrefix?: string): string;
|
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 {
|
interface IEventMessage {
|
||||||
contextInfo?: (proto.IContextInfo|null);
|
contextInfo?: (proto.IContextInfo|null);
|
||||||
isCanceled?: (boolean|null);
|
isCanceled?: (boolean|null);
|
||||||
@@ -7818,17 +7920,19 @@ export namespace proto {
|
|||||||
|
|
||||||
interface IMessageHistoryMetadata {
|
interface IMessageHistoryMetadata {
|
||||||
historyReceivers?: (string[]|null);
|
historyReceivers?: (string[]|null);
|
||||||
oldestMessageTimestamp?: (number|Long|null);
|
oldestMessageTimestampInWindow?: (number|Long|null);
|
||||||
messageCount?: (number|Long|null);
|
messageCount?: (number|Long|null);
|
||||||
nonHistoryReceivers?: (string[]|null);
|
nonHistoryReceivers?: (string[]|null);
|
||||||
|
oldestMessageTimestampInBundle?: (number|Long|null);
|
||||||
}
|
}
|
||||||
|
|
||||||
class MessageHistoryMetadata implements IMessageHistoryMetadata {
|
class MessageHistoryMetadata implements IMessageHistoryMetadata {
|
||||||
constructor(p?: proto.Message.IMessageHistoryMetadata);
|
constructor(p?: proto.Message.IMessageHistoryMetadata);
|
||||||
public historyReceivers: string[];
|
public historyReceivers: string[];
|
||||||
public oldestMessageTimestamp?: (number|Long|null);
|
public oldestMessageTimestampInWindow?: (number|Long|null);
|
||||||
public messageCount?: (number|Long|null);
|
public messageCount?: (number|Long|null);
|
||||||
public nonHistoryReceivers: string[];
|
public nonHistoryReceivers: string[];
|
||||||
|
public oldestMessageTimestampInBundle?: (number|Long|null);
|
||||||
public static create(properties?: proto.Message.IMessageHistoryMetadata): proto.Message.MessageHistoryMetadata;
|
public static create(properties?: proto.Message.IMessageHistoryMetadata): proto.Message.MessageHistoryMetadata;
|
||||||
public static encode(m: proto.Message.IMessageHistoryMetadata, w?: $protobuf.Writer): $protobuf.Writer;
|
public static encode(m: proto.Message.IMessageHistoryMetadata, w?: $protobuf.Writer): $protobuf.Writer;
|
||||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.Message.MessageHistoryMetadata;
|
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.Message.MessageHistoryMetadata;
|
||||||
@@ -7986,6 +8090,7 @@ export namespace proto {
|
|||||||
expiryTimestamp?: (number|Long|null);
|
expiryTimestamp?: (number|Long|null);
|
||||||
incentiveEligible?: (boolean|null);
|
incentiveEligible?: (boolean|null);
|
||||||
referralId?: (string|null);
|
referralId?: (string|null);
|
||||||
|
inviteType?: (proto.Message.PaymentInviteMessage.InviteType|null);
|
||||||
}
|
}
|
||||||
|
|
||||||
class PaymentInviteMessage implements IPaymentInviteMessage {
|
class PaymentInviteMessage implements IPaymentInviteMessage {
|
||||||
@@ -7994,6 +8099,7 @@ export namespace proto {
|
|||||||
public expiryTimestamp?: (number|Long|null);
|
public expiryTimestamp?: (number|Long|null);
|
||||||
public incentiveEligible?: (boolean|null);
|
public incentiveEligible?: (boolean|null);
|
||||||
public referralId?: (string|null);
|
public referralId?: (string|null);
|
||||||
|
public inviteType?: (proto.Message.PaymentInviteMessage.InviteType|null);
|
||||||
public static create(properties?: proto.Message.IPaymentInviteMessage): proto.Message.PaymentInviteMessage;
|
public static create(properties?: proto.Message.IPaymentInviteMessage): proto.Message.PaymentInviteMessage;
|
||||||
public static encode(m: proto.Message.IPaymentInviteMessage, w?: $protobuf.Writer): $protobuf.Writer;
|
public static encode(m: proto.Message.IPaymentInviteMessage, w?: $protobuf.Writer): $protobuf.Writer;
|
||||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.Message.PaymentInviteMessage;
|
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.Message.PaymentInviteMessage;
|
||||||
@@ -8005,6 +8111,11 @@ export namespace proto {
|
|||||||
|
|
||||||
namespace PaymentInviteMessage {
|
namespace PaymentInviteMessage {
|
||||||
|
|
||||||
|
enum InviteType {
|
||||||
|
DEFAULT = 0,
|
||||||
|
MAPPER = 1
|
||||||
|
}
|
||||||
|
|
||||||
enum ServiceType {
|
enum ServiceType {
|
||||||
UNKNOWN = 0,
|
UNKNOWN = 0,
|
||||||
FBPAY = 1,
|
FBPAY = 1,
|
||||||
@@ -9170,7 +9281,8 @@ export namespace proto {
|
|||||||
AI_QUERY_FANOUT = 29,
|
AI_QUERY_FANOUT = 29,
|
||||||
GROUP_MEMBER_LABEL_CHANGE = 30,
|
GROUP_MEMBER_LABEL_CHANGE = 30,
|
||||||
AI_MEDIA_COLLECTION_MESSAGE = 31,
|
AI_MEDIA_COLLECTION_MESSAGE = 31,
|
||||||
MESSAGE_UNSCHEDULE = 32
|
MESSAGE_UNSCHEDULE = 32,
|
||||||
|
BOT_UNLINK_MESSAGE = 33
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9261,12 +9373,14 @@ export namespace proto {
|
|||||||
interface IRequestWelcomeMessageMetadata {
|
interface IRequestWelcomeMessageMetadata {
|
||||||
localChatState?: (proto.Message.RequestWelcomeMessageMetadata.LocalChatState|null);
|
localChatState?: (proto.Message.RequestWelcomeMessageMetadata.LocalChatState|null);
|
||||||
welcomeTrigger?: (proto.Message.RequestWelcomeMessageMetadata.WelcomeTrigger|null);
|
welcomeTrigger?: (proto.Message.RequestWelcomeMessageMetadata.WelcomeTrigger|null);
|
||||||
|
botAgentMetadata?: (proto.IBotAgentMetadata|null);
|
||||||
}
|
}
|
||||||
|
|
||||||
class RequestWelcomeMessageMetadata implements IRequestWelcomeMessageMetadata {
|
class RequestWelcomeMessageMetadata implements IRequestWelcomeMessageMetadata {
|
||||||
constructor(p?: proto.Message.IRequestWelcomeMessageMetadata);
|
constructor(p?: proto.Message.IRequestWelcomeMessageMetadata);
|
||||||
public localChatState?: (proto.Message.RequestWelcomeMessageMetadata.LocalChatState|null);
|
public localChatState?: (proto.Message.RequestWelcomeMessageMetadata.LocalChatState|null);
|
||||||
public welcomeTrigger?: (proto.Message.RequestWelcomeMessageMetadata.WelcomeTrigger|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 create(properties?: proto.Message.IRequestWelcomeMessageMetadata): proto.Message.RequestWelcomeMessageMetadata;
|
||||||
public static encode(m: proto.Message.IRequestWelcomeMessageMetadata, w?: $protobuf.Writer): $protobuf.Writer;
|
public static encode(m: proto.Message.IRequestWelcomeMessageMetadata, w?: $protobuf.Writer): $protobuf.Writer;
|
||||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.Message.RequestWelcomeMessageMetadata;
|
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.Message.RequestWelcomeMessageMetadata;
|
||||||
@@ -10462,6 +10576,8 @@ export namespace proto {
|
|||||||
BUSINESS_BROADCAST_CAMPAIGN_ACTION = 81,
|
BUSINESS_BROADCAST_CAMPAIGN_ACTION = 81,
|
||||||
BUSINESS_BROADCAST_INSIGHTS_ACTION = 82,
|
BUSINESS_BROADCAST_INSIGHTS_ACTION = 82,
|
||||||
CUSTOMER_DATA_ACTION = 83,
|
CUSTOMER_DATA_ACTION = 83,
|
||||||
|
SUBSCRIPTIONS_SYNC_V2_ACTION = 84,
|
||||||
|
THREAD_PIN_ACTION = 85,
|
||||||
SHARE_OWN_PN = 10001,
|
SHARE_OWN_PN = 10001,
|
||||||
BUSINESS_BROADCAST_ACTION = 10002,
|
BUSINESS_BROADCAST_ACTION = 10002,
|
||||||
AI_THREAD_DELETE_ACTION = 10003
|
AI_THREAD_DELETE_ACTION = 10003
|
||||||
@@ -11745,7 +11861,8 @@ export namespace proto {
|
|||||||
THREADS = 7,
|
THREADS = 7,
|
||||||
APPLE_MUSIC = 8,
|
APPLE_MUSIC = 8,
|
||||||
SHARECHAT = 9,
|
SHARECHAT = 9,
|
||||||
GOOGLE_PHOTOS = 10
|
GOOGLE_PHOTOS = 10,
|
||||||
|
SOUNDCLOUD = 11
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -12056,6 +12173,8 @@ export namespace proto {
|
|||||||
businessBroadcastCampaignAction?: (proto.SyncActionValue.IBusinessBroadcastCampaignAction|null);
|
businessBroadcastCampaignAction?: (proto.SyncActionValue.IBusinessBroadcastCampaignAction|null);
|
||||||
businessBroadcastInsightsAction?: (proto.SyncActionValue.IBusinessBroadcastInsightsAction|null);
|
businessBroadcastInsightsAction?: (proto.SyncActionValue.IBusinessBroadcastInsightsAction|null);
|
||||||
customerDataAction?: (proto.SyncActionValue.ICustomerDataAction|null);
|
customerDataAction?: (proto.SyncActionValue.ICustomerDataAction|null);
|
||||||
|
subscriptionsSyncV2Action?: (proto.SyncActionValue.ISubscriptionsSyncV2Action|null);
|
||||||
|
threadPinAction?: (proto.SyncActionValue.IThreadPinAction|null);
|
||||||
}
|
}
|
||||||
|
|
||||||
class SyncActionValue implements ISyncActionValue {
|
class SyncActionValue implements ISyncActionValue {
|
||||||
@@ -12134,6 +12253,8 @@ export namespace proto {
|
|||||||
public businessBroadcastCampaignAction?: (proto.SyncActionValue.IBusinessBroadcastCampaignAction|null);
|
public businessBroadcastCampaignAction?: (proto.SyncActionValue.IBusinessBroadcastCampaignAction|null);
|
||||||
public businessBroadcastInsightsAction?: (proto.SyncActionValue.IBusinessBroadcastInsightsAction|null);
|
public businessBroadcastInsightsAction?: (proto.SyncActionValue.IBusinessBroadcastInsightsAction|null);
|
||||||
public customerDataAction?: (proto.SyncActionValue.ICustomerDataAction|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 create(properties?: proto.ISyncActionValue): proto.SyncActionValue;
|
||||||
public static encode(m: proto.ISyncActionValue, w?: $protobuf.Writer): $protobuf.Writer;
|
public static encode(m: proto.ISyncActionValue, w?: $protobuf.Writer): $protobuf.Writer;
|
||||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.SyncActionValue;
|
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.SyncActionValue;
|
||||||
@@ -12361,6 +12482,7 @@ export namespace proto {
|
|||||||
participants?: (proto.SyncActionValue.IBroadcastListParticipant[]|null);
|
participants?: (proto.SyncActionValue.IBroadcastListParticipant[]|null);
|
||||||
listName?: (string|null);
|
listName?: (string|null);
|
||||||
labelIds?: (string[]|null);
|
labelIds?: (string[]|null);
|
||||||
|
audienceExpression?: (string|null);
|
||||||
}
|
}
|
||||||
|
|
||||||
class BusinessBroadcastListAction implements IBusinessBroadcastListAction {
|
class BusinessBroadcastListAction implements IBusinessBroadcastListAction {
|
||||||
@@ -12369,6 +12491,7 @@ export namespace proto {
|
|||||||
public participants: proto.SyncActionValue.IBroadcastListParticipant[];
|
public participants: proto.SyncActionValue.IBroadcastListParticipant[];
|
||||||
public listName?: (string|null);
|
public listName?: (string|null);
|
||||||
public labelIds: string[];
|
public labelIds: string[];
|
||||||
|
public audienceExpression?: (string|null);
|
||||||
public static create(properties?: proto.SyncActionValue.IBusinessBroadcastListAction): proto.SyncActionValue.BusinessBroadcastListAction;
|
public static create(properties?: proto.SyncActionValue.IBusinessBroadcastListAction): proto.SyncActionValue.BusinessBroadcastListAction;
|
||||||
public static encode(m: proto.SyncActionValue.IBusinessBroadcastListAction, w?: $protobuf.Writer): $protobuf.Writer;
|
public static encode(m: proto.SyncActionValue.IBusinessBroadcastListAction, w?: $protobuf.Writer): $protobuf.Writer;
|
||||||
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.SyncActionValue.BusinessBroadcastListAction;
|
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): proto.SyncActionValue.BusinessBroadcastListAction;
|
||||||
@@ -13666,6 +13789,79 @@ export namespace proto {
|
|||||||
public static getTypeUrl(typeUrlPrefix?: string): string;
|
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 {
|
interface ISyncActionMessage {
|
||||||
key?: (proto.IMessageKey|null);
|
key?: (proto.IMessageKey|null);
|
||||||
timestamp?: (number|Long|null);
|
timestamp?: (number|Long|null);
|
||||||
@@ -13704,6 +13900,22 @@ export namespace proto {
|
|||||||
public static getTypeUrl(typeUrlPrefix?: string): string;
|
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 {
|
interface ITimeFormatAction {
|
||||||
isTwentyFourHourFormatEnabled?: (boolean|null);
|
isTwentyFourHourFormatEnabled?: (boolean|null);
|
||||||
}
|
}
|
||||||
|
|||||||
+1617
-28
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -47,7 +47,7 @@
|
|||||||
"fflate": "^0.8.2",
|
"fflate": "^0.8.2",
|
||||||
"libsignal": "github:whiskeysockets/libsignal-node",
|
"libsignal": "github:whiskeysockets/libsignal-node",
|
||||||
"lru-cache": "^11.2.6",
|
"lru-cache": "^11.2.6",
|
||||||
"music-metadata": "^11.12.0",
|
"music-metadata": "^11.12.3",
|
||||||
"p-queue": "^9.0.0",
|
"p-queue": "^9.0.0",
|
||||||
"pino": "^10.3.1",
|
"pino": "^10.3.1",
|
||||||
"prom-client": "^15.1.3",
|
"prom-client": "^15.1.3",
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":[2,3000,1034641024]}
|
{"version":[2,3000,1035595667]}
|
||||||
|
|||||||
@@ -188,10 +188,12 @@ 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) */
|
/** 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
|
export const HISTORY_SYNC_PAUSED_TIMEOUT_MS = 120_000
|
||||||
|
|
||||||
export const MIN_PREKEY_COUNT = 5
|
// Replenishment threshold: when server count drops below this, top-up back to INITIAL_PREKEY_COUNT
|
||||||
|
export const MIN_PREKEY_COUNT = 200
|
||||||
|
|
||||||
// Moderate prekey count (upstream uses 812, reduced to balance rate limiting and availability)
|
// Initial pool size matching WA Business (CDP IDB capture: prekey-store = 812 on registration)
|
||||||
export const INITIAL_PREKEY_COUNT = 200
|
// Rounded to 800 for cleanliness; replenishment always tops up to this value
|
||||||
|
export const INITIAL_PREKEY_COUNT = 800
|
||||||
|
|
||||||
export const UPLOAD_TIMEOUT = 30000 // 30 seconds
|
export const UPLOAD_TIMEOUT = 30000 // 30 seconds
|
||||||
// Moderate upload interval to balance rate limiting and responsiveness (was 5000)
|
// Moderate upload interval to balance rate limiting and responsiveness (was 5000)
|
||||||
|
|||||||
+44
-40
@@ -7,6 +7,7 @@ import { proto } from '../../WAProto/index.js'
|
|||||||
import {
|
import {
|
||||||
DEFAULT_CACHE_TTLS,
|
DEFAULT_CACHE_TTLS,
|
||||||
DEFAULT_SESSION_CLEANUP_CONFIG,
|
DEFAULT_SESSION_CLEANUP_CONFIG,
|
||||||
|
INITIAL_PREKEY_COUNT,
|
||||||
KEY_BUNDLE_TYPE,
|
KEY_BUNDLE_TYPE,
|
||||||
MIN_PREKEY_COUNT,
|
MIN_PREKEY_COUNT,
|
||||||
PLACEHOLDER_MAX_AGE_SECONDS,
|
PLACEHOLDER_MAX_AGE_SECONDS,
|
||||||
@@ -48,9 +49,12 @@ import {
|
|||||||
getStatusFromReceiptType,
|
getStatusFromReceiptType,
|
||||||
handleIdentityChange,
|
handleIdentityChange,
|
||||||
hkdf,
|
hkdf,
|
||||||
|
BAD_MAC_ERROR_TEXT,
|
||||||
|
DECRYPTION_RETRY_CONFIG,
|
||||||
MISSING_KEYS_ERROR_TEXT,
|
MISSING_KEYS_ERROR_TEXT,
|
||||||
NACK_REASONS,
|
NACK_REASONS,
|
||||||
NO_MESSAGE_FOUND_ERROR_TEXT,
|
NO_MESSAGE_FOUND_ERROR_TEXT,
|
||||||
|
RetryReason,
|
||||||
normalizeKeyLidToPn,
|
normalizeKeyLidToPn,
|
||||||
normalizeMessageJids,
|
normalizeMessageJids,
|
||||||
resolveLidToPn,
|
resolveLidToPn,
|
||||||
@@ -1212,7 +1216,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
|||||||
return await query(stanza)
|
return await query(stanza)
|
||||||
}
|
}
|
||||||
|
|
||||||
const sendRetryRequest = async (node: BinaryNode, forceIncludeKeys = false) => {
|
const sendRetryRequest = async (node: BinaryNode, forceIncludeKeys = false, decryptionError?: string) => {
|
||||||
const { fullMessage } = decodeMessageNode(node, authState.creds.me!.id, authState.creds.me!.lid || '')
|
const { fullMessage } = decodeMessageNode(node, authState.creds.me!.id, authState.creds.me!.lid || '')
|
||||||
const { key: msgKey } = fullMessage
|
const { key: msgKey } = fullMessage
|
||||||
const msgId = msgKey.id!
|
const msgId = msgKey.id!
|
||||||
@@ -1310,39 +1314,39 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
|||||||
const { account, signedPreKey, signedIdentityKey: identityKey } = authState.creds
|
const { account, signedPreKey, signedIdentityKey: identityKey } = authState.creds
|
||||||
const fromJid = node.attrs.from!
|
const fromJid = node.attrs.from!
|
||||||
|
|
||||||
// Check if we should recreate the session
|
// Derive the Signal error code from the actual decryption failure message.
|
||||||
let shouldRecreateSession = false
|
// Sent in the retry receipt so the peer (even another InfiniteAPI instance)
|
||||||
let recreateReason = ''
|
// knows the exact failure type and can recreate the session immediately
|
||||||
|
// instead of falling back to the 1-hour timeout.
|
||||||
if (enableAutoSessionRecreation && messageRetryManager && retryCount >= 1) {
|
//
|
||||||
try {
|
// Codes mirror RetryReason enum in message-retry-manager.ts:
|
||||||
// Check if we have a session with this JID
|
// 0 = UnknownError | 1 = NoSession | 2 = InvalidKey
|
||||||
const sessionId = signalRepository.jidToSignalProtocolAddress(fromJid)
|
// 3 = InvalidKeyId | 4 = InvalidMessage | 7 = BadMac
|
||||||
const hasSession = await signalRepository.validateSession(fromJid)
|
//
|
||||||
|
// Uses DECRYPTION_RETRY_CONFIG error lists (single source of truth in
|
||||||
// Extract error code from retry node if present (for MAC error detection)
|
// decode-wa-message.ts) so additions to those lists are picked up here
|
||||||
const retryNode = getBinaryNodeChild(node, 'retry')
|
// automatically.
|
||||||
const errorAttr = retryNode?.attrs?.error
|
//
|
||||||
const errorCode = messageRetryManager.parseRetryErrorCode(errorAttr)
|
// NOTE: We do NOT delete the session here (receiver side). The Signal Protocol
|
||||||
|
// recovers automatically when the sender's pkmsg arrives — it overwrites the
|
||||||
const result = messageRetryManager.shouldRecreateSession(fromJid, hasSession.exists, errorCode)
|
// corrupted session. Deleting prematurely creates a race window where no session
|
||||||
shouldRecreateSession = result.recreate
|
// exists, which can cause "No Session" errors on concurrent messages.
|
||||||
recreateReason = result.reason
|
const retryErrorCode = (() => {
|
||||||
|
if (!decryptionError) return RetryReason.UnknownError
|
||||||
if (shouldRecreateSession) {
|
// Bad MAC must be checked first — it is also in corruptedSessionErrors
|
||||||
logger.debug({ fromJid, retryCount, reason: recreateReason, errorCode }, 'recreating session for retry')
|
// but warrants the more specific code 7 over the generic code 4.
|
||||||
// Delete existing session to force recreation
|
if (decryptionError.includes(BAD_MAC_ERROR_TEXT)) return RetryReason.SignalErrorBadMac
|
||||||
// CRITICAL: Use same transaction key as encrypt/decrypt operations to prevent race
|
// MessageCounterError and other corrupted-session variants
|
||||||
// Using meId ensures this delete serializes with sendMessage() and other session operations
|
if (DECRYPTION_RETRY_CONFIG.corruptedSessionErrors.some(e => decryptionError.includes(e))) return RetryReason.SignalErrorInvalidMessage
|
||||||
await authState.keys.transaction(async () => {
|
// Missing / invalid session record
|
||||||
await authState.keys.set({ session: { [sessionId]: null } })
|
if (DECRYPTION_RETRY_CONFIG.sessionRecordErrors.some(e => decryptionError.includes(e)) ||
|
||||||
}, authState.creds.me?.id || 'session-operation')
|
/no\s+(open\s+)?sessions?/i.test(decryptionError)) return RetryReason.SignalErrorNoSession
|
||||||
forceIncludeKeys = true
|
// PreKey / key-id errors
|
||||||
}
|
if (/pre\s*key/i.test(decryptionError)) return RetryReason.SignalErrorInvalidKeyId
|
||||||
} catch (error) {
|
// Identity / key errors
|
||||||
logger.warn({ error, fromJid }, 'failed to check session recreation')
|
if (/invalid\s*key|untrusted\s*identity/i.test(decryptionError)) return RetryReason.SignalErrorInvalidKey
|
||||||
}
|
return RetryReason.UnknownError
|
||||||
}
|
})()
|
||||||
|
|
||||||
if (retryCount <= 2) {
|
if (retryCount <= 2) {
|
||||||
// Use new retry manager for phone requests if available
|
// Use new retry manager for phone requests if available
|
||||||
@@ -1383,8 +1387,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
|||||||
id: node.attrs.id!,
|
id: node.attrs.id!,
|
||||||
t: node.attrs.t!,
|
t: node.attrs.t!,
|
||||||
v: '1',
|
v: '1',
|
||||||
// ADD ERROR FIELD
|
error: retryErrorCode.toString()
|
||||||
error: '0'
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1403,7 +1406,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
|||||||
receipt.attrs.participant = node.attrs.participant
|
receipt.attrs.participant = node.attrs.participant
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retryCount > 1 || forceIncludeKeys || shouldRecreateSession) {
|
if (retryCount > 1 || forceIncludeKeys) {
|
||||||
const { update, preKeys } = await getNextPreKeys(authState, 1)
|
const { update, preKeys } = await getNextPreKeys(authState, 1)
|
||||||
|
|
||||||
const [keyId] = Object.keys(preKeys)
|
const [keyId] = Object.keys(preKeys)
|
||||||
@@ -1440,7 +1443,8 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
|||||||
|
|
||||||
logger.debug({ count, shouldUploadMorePreKeys }, 'recv pre-key count')
|
logger.debug({ count, shouldUploadMorePreKeys }, 'recv pre-key count')
|
||||||
if (shouldUploadMorePreKeys) {
|
if (shouldUploadMorePreKeys) {
|
||||||
await uploadPreKeys()
|
// 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))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const result = await handleIdentityChange(node, {
|
const result = await handleIdentityChange(node, {
|
||||||
@@ -2505,7 +2509,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const encNode = getBinaryNodeChild(node, 'enc')
|
const encNode = getBinaryNodeChild(node, 'enc')
|
||||||
await sendRetryRequest(node, !encNode)
|
await sendRetryRequest(node, !encNode, errorMessage)
|
||||||
if (retryRequestDelayMs) {
|
if (retryRequestDelayMs) {
|
||||||
await delay(retryRequestDelayMs)
|
await delay(retryRequestDelayMs)
|
||||||
}
|
}
|
||||||
@@ -2514,7 +2518,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
|||||||
// Still attempt retry even if pre-key upload failed
|
// Still attempt retry even if pre-key upload failed
|
||||||
try {
|
try {
|
||||||
const encNode = getBinaryNodeChild(node, 'enc')
|
const encNode = getBinaryNodeChild(node, 'enc')
|
||||||
await sendRetryRequest(node, !encNode)
|
await sendRetryRequest(node, !encNode, errorMessage)
|
||||||
} catch (retryErr) {
|
} catch (retryErr) {
|
||||||
logger.error({ retryErr }, 'Failed to send retry after error handling')
|
logger.error({ retryErr }, 'Failed to send retry after error handling')
|
||||||
}
|
}
|
||||||
|
|||||||
+157
-52
@@ -9,6 +9,7 @@ import type {
|
|||||||
AlbumMessageOptions,
|
AlbumMessageOptions,
|
||||||
AlbumSendResult,
|
AlbumSendResult,
|
||||||
AnyMessageContent,
|
AnyMessageContent,
|
||||||
|
LIDMapping,
|
||||||
MediaConnInfo,
|
MediaConnInfo,
|
||||||
MessageReceiptType,
|
MessageReceiptType,
|
||||||
MessageRelayOptions,
|
MessageRelayOptions,
|
||||||
@@ -338,6 +339,33 @@ 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
|
const meId = authState.creds.me?.id
|
||||||
if (!meId) throw new Boom('Not authenticated', { statusCode: 401 })
|
if (!meId) throw new Boom('Not authenticated', { statusCode: 401 })
|
||||||
const meLid = authState.creds.me?.lid || ''
|
const meLid = authState.creds.me?.lid || ''
|
||||||
@@ -574,6 +602,82 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
|||||||
return msgId
|
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 (
|
const createParticipantNodes = async (
|
||||||
recipientJids: string[],
|
recipientJids: string[],
|
||||||
message: proto.IMessage,
|
message: proto.IMessage,
|
||||||
@@ -593,58 +697,23 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
|||||||
const meId = authState.creds.me?.id
|
const meId = authState.creds.me?.id
|
||||||
if (!meId) throw new Boom('Not authenticated', { statusCode: 401 })
|
if (!meId) throw new Boom('Not authenticated', { statusCode: 401 })
|
||||||
const meLid = authState.creds.me?.lid
|
const meLid = authState.creds.me?.lid
|
||||||
const meLidUser = meLid ? jidDecode(meLid)?.user : null
|
const meLidUser = meLid ? (jidDecode(meLid)?.user ?? null) : null
|
||||||
|
const onPkmsg = () => {
|
||||||
const encryptionPromises = (patchedMessages as { recipientJid: string; message: proto.IMessage }[]).map(
|
|
||||||
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
|
shouldIncludeDeviceIdentity = true
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
const encryptionPromises = (patchedMessages as { recipientJid: string; message: proto.IMessage }[]).map(
|
||||||
tag: 'to',
|
({ recipientJid: jid, message: patchedMessage }: { recipientJid: string; message: proto.IMessage }) =>
|
||||||
attrs: { jid },
|
encryptPatchedMessageForRecipient({
|
||||||
content: [
|
jid,
|
||||||
{
|
patchedMessage,
|
||||||
tag: 'enc',
|
dsmMessage,
|
||||||
attrs: { v: '2', type, ...(extraAttrs || {}) },
|
meId,
|
||||||
content: ciphertext
|
meLid,
|
||||||
}
|
meLidUser,
|
||||||
]
|
extraAttrs,
|
||||||
}
|
onPkmsg
|
||||||
})
|
})
|
||||||
|
|
||||||
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[]
|
const nodes = (await Promise.all(encryptionPromises)).filter(node => node !== null) as BinaryNode[]
|
||||||
@@ -1208,21 +1277,48 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
|||||||
: otherRecipients
|
: otherRecipients
|
||||||
const effectiveAllRecipients = [...effectiveMeRecipients, ...effectiveOtherRecipients]
|
const effectiveAllRecipients = [...effectiveMeRecipients, ...effectiveOtherRecipients]
|
||||||
|
|
||||||
await assertSessions(effectiveAllRecipients)
|
// 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])
|
||||||
|
|
||||||
const [
|
const [
|
||||||
{ nodes: meNodes, shouldIncludeDeviceIdentity: s1 },
|
{ nodes: meNodes, shouldIncludeDeviceIdentity: s1 },
|
||||||
{ nodes: otherNodes, shouldIncludeDeviceIdentity: s2 }
|
{ nodes: otherNodes, shouldIncludeDeviceIdentity: s2 }
|
||||||
] = await Promise.all([
|
] = await Promise.all([
|
||||||
// For own devices: use DSM (deviceSentMessage) wrapper
|
// For own devices: use DSM (deviceSentMessage) wrapper
|
||||||
createParticipantNodes(effectiveMeRecipients, meMsg || message, extraAttrs),
|
createParticipantNodes(viewOnceMeRecipients, meMsg || message, extraAttrs),
|
||||||
createParticipantNodes(effectiveOtherRecipients, message, extraAttrs)
|
createParticipantNodes(effectiveOtherRecipients, message, extraAttrs)
|
||||||
])
|
])
|
||||||
participants.push(...meNodes)
|
participants.push(...meNodes)
|
||||||
participants.push(...otherNodes)
|
participants.push(...otherNodes)
|
||||||
|
|
||||||
if (effectiveMeRecipients.length > 0 || effectiveOtherRecipients.length > 0) {
|
const phashRecipients = isViewOnceMsg
|
||||||
extraAttrs['phash'] = generateParticipantHashV2(effectiveAllRecipients)
|
? [...viewOnceMeRecipients, ...effectiveOtherRecipients]
|
||||||
|
: effectiveAllRecipients
|
||||||
|
if (phashRecipients.length > 0) {
|
||||||
|
extraAttrs['phash'] = generateParticipantHashV2(phashRecipients)
|
||||||
}
|
}
|
||||||
|
|
||||||
shouldIncludeDeviceIdentity = shouldIncludeDeviceIdentity || s1 || s2
|
shouldIncludeDeviceIdentity = shouldIncludeDeviceIdentity || s1 || s2
|
||||||
@@ -1828,6 +1924,15 @@ export const makeMessagesSocket = (config: SocketConfig) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const getMediaType = (message: proto.IMessage) => {
|
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) {
|
if (message.imageMessage) {
|
||||||
return 'image'
|
return 'image'
|
||||||
} else if (message.videoMessage) {
|
} else if (message.videoMessage) {
|
||||||
|
|||||||
@@ -123,11 +123,11 @@ export const makeNewsletterSocket = (config: SocketConfig) => {
|
|||||||
},
|
},
|
||||||
|
|
||||||
newsletterMute: (jid: string) => {
|
newsletterMute: (jid: string) => {
|
||||||
return executeWMexQuery({ newsletter_id: jid }, QueryIds.MUTE, XWAPaths.xwa2_newsletter_mute_v2)
|
return executeWMexQuery({ input: { newsletter_id: jid, type: 'MUTE_ADMIN_ACTIVITY', value: 'OFF' } }, QueryIds.MUTE, XWAPaths.xwa2_newsletter_mute_v2)
|
||||||
},
|
},
|
||||||
|
|
||||||
newsletterUnmute: (jid: string) => {
|
newsletterUnmute: (jid: string) => {
|
||||||
return executeWMexQuery({ newsletter_id: jid }, QueryIds.UNMUTE, XWAPaths.xwa2_newsletter_unmute_v2)
|
return executeWMexQuery({ input: { newsletter_id: jid, type: 'MUTE_ADMIN_ACTIVITY', value: 'ON' } }, QueryIds.UNMUTE, XWAPaths.xwa2_newsletter_unmute_v2)
|
||||||
},
|
},
|
||||||
|
|
||||||
newsletterUpdateName: async (jid: string, name: string) => {
|
newsletterUpdateName: async (jid: string, name: string) => {
|
||||||
|
|||||||
+28
-8
@@ -701,10 +701,12 @@ export const makeSocket = (config: SocketConfig) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent multiple concurrent uploads
|
// 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.
|
||||||
if (uploadPreKeysPromise) {
|
if (uploadPreKeysPromise) {
|
||||||
logger.debug('Pre-key upload already in progress, waiting for completion')
|
logger.debug('Pre-key upload already in progress, waiting for completion')
|
||||||
await uploadPreKeysPromise
|
await uploadPreKeysPromise
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const uploadLogic = async () => {
|
const uploadLogic = async () => {
|
||||||
@@ -784,14 +786,15 @@ export const makeSocket = (config: SocketConfig) => {
|
|||||||
try {
|
try {
|
||||||
let count = 0
|
let count = 0
|
||||||
const preKeyCount = await getAvailablePreKeysOnServer()
|
const preKeyCount = await getAvailablePreKeysOnServer()
|
||||||
if (preKeyCount === 0) count = INITIAL_PREKEY_COUNT
|
// How many to upload: top-up to INITIAL_PREKEY_COUNT from whatever remains on server
|
||||||
else count = MIN_PREKEY_COUNT
|
count = Math.max(0, INITIAL_PREKEY_COUNT - preKeyCount)
|
||||||
const { exists: currentPreKeyExists, currentPreKeyId } = await verifyCurrentPreKeyExists()
|
const { exists: currentPreKeyExists, currentPreKeyId } = await verifyCurrentPreKeyExists()
|
||||||
|
|
||||||
logger.info(`${preKeyCount} pre-keys found on server`)
|
logger.info(`${preKeyCount} pre-keys found on server`)
|
||||||
logger.info(`Current prekey ID: ${currentPreKeyId}, exists in storage: ${currentPreKeyExists}`)
|
logger.info(`Current prekey ID: ${currentPreKeyId}, exists in storage: ${currentPreKeyExists}`)
|
||||||
|
|
||||||
const lowServerCount = preKeyCount <= count
|
// Trigger upload when below the replenishment threshold, not when count < topUp amount
|
||||||
|
const lowServerCount = preKeyCount < MIN_PREKEY_COUNT
|
||||||
const missingCurrentPreKey = !currentPreKeyExists && currentPreKeyId > 0
|
const missingCurrentPreKey = !currentPreKeyExists && currentPreKeyId > 0
|
||||||
|
|
||||||
const shouldUpload = lowServerCount || missingCurrentPreKey
|
const shouldUpload = lowServerCount || missingCurrentPreKey
|
||||||
@@ -1151,7 +1154,7 @@ export const makeSocket = (config: SocketConfig) => {
|
|||||||
// Decrement active connections
|
// Decrement active connections
|
||||||
decrementActiveConnections()
|
decrementActiveConnections()
|
||||||
|
|
||||||
clearInterval(keepAliveReq)
|
clearTimeout(keepAliveReq)
|
||||||
clearTimeout(qrTimer)
|
clearTimeout(qrTimer)
|
||||||
|
|
||||||
// Clear offline-buffer safety timer so its callback cannot call ev.flush()
|
// Clear offline-buffer safety timer so its callback cannot call ev.flush()
|
||||||
@@ -1262,8 +1265,16 @@ export const makeSocket = (config: SocketConfig) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const startKeepAliveRequest = () =>
|
const startKeepAliveRequest = () => {
|
||||||
(keepAliveReq = setInterval(() => {
|
// 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 = () => {
|
||||||
if (!lastDateRecv) {
|
if (!lastDateRecv) {
|
||||||
lastDateRecv = new Date()
|
lastDateRecv = new Date()
|
||||||
}
|
}
|
||||||
@@ -1275,6 +1286,7 @@ export const makeSocket = (config: SocketConfig) => {
|
|||||||
*/
|
*/
|
||||||
if (diff > keepAliveIntervalMs + 5000) {
|
if (diff > keepAliveIntervalMs + 5000) {
|
||||||
void end(new Boom('Connection was lost', { statusCode: DisconnectReason.connectionLost }))
|
void end(new Boom('Connection was lost', { statusCode: DisconnectReason.connectionLost }))
|
||||||
|
return // connection closing — do not reschedule
|
||||||
} else if (ws.isOpen) {
|
} else if (ws.isOpen) {
|
||||||
// Send keep-alive ping via sendNode() (fire-and-forget) instead of query().
|
// 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
|
// query() wraps the ping in the query circuit breaker — when that breaker is
|
||||||
@@ -1297,7 +1309,15 @@ export const makeSocket = (config: SocketConfig) => {
|
|||||||
} else {
|
} else {
|
||||||
logger.warn('keep alive called when WS not open')
|
logger.warn('keep alive called when WS not open')
|
||||||
}
|
}
|
||||||
}, keepAliveIntervalMs))
|
|
||||||
|
// Do not reschedule once shutdown has started (closed set by end() on any concurrent path)
|
||||||
|
if (!closed) {
|
||||||
|
scheduleNextKeepAlive()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
scheduleNextKeepAlive()
|
||||||
|
}
|
||||||
/** i have no idea why this exists. pls enlighten me */
|
/** i have no idea why this exists. pls enlighten me */
|
||||||
const sendPassiveIq = (tag: 'passive' | 'active') =>
|
const sendPassiveIq = (tag: 'passive' | 'active') =>
|
||||||
query({
|
query({
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ export type BaileysEventMap = {
|
|||||||
chats: Chat[]
|
chats: Chat[]
|
||||||
contacts: Contact[]
|
contacts: Contact[]
|
||||||
messages: WAMessage[]
|
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
|
isLatest?: boolean
|
||||||
progress?: number | null
|
progress?: number | null
|
||||||
syncType?: proto.HistorySync.HistorySyncType | null
|
syncType?: proto.HistorySync.HistorySyncType | null
|
||||||
@@ -185,6 +187,8 @@ export type BufferedEventData = {
|
|||||||
chats: { [jid: string]: Chat }
|
chats: { [jid: string]: Chat }
|
||||||
contacts: { [jid: string]: Contact }
|
contacts: { [jid: string]: Contact }
|
||||||
messages: { [uqId: string]: WAMessage }
|
messages: { [uqId: string]: WAMessage }
|
||||||
|
/** Keyed by groupJid for O(1) deduplication across chunks */
|
||||||
|
pastParticipants: { [groupJid: string]: proto.IPastParticipant[] }
|
||||||
empty: boolean
|
empty: boolean
|
||||||
isLatest: boolean
|
isLatest: boolean
|
||||||
progress?: number | null
|
progress?: number | null
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ export enum XWAPaths {
|
|||||||
xwa2_newsletter_view = 'xwa2_newsletter_view',
|
xwa2_newsletter_view = 'xwa2_newsletter_view',
|
||||||
xwa2_newsletter_metadata = 'xwa2_newsletter',
|
xwa2_newsletter_metadata = 'xwa2_newsletter',
|
||||||
xwa2_newsletter_admin_count = 'xwa2_newsletter_admin',
|
xwa2_newsletter_admin_count = 'xwa2_newsletter_admin',
|
||||||
xwa2_newsletter_mute_v2 = 'xwa2_newsletter_mute_v2',
|
xwa2_newsletter_mute_v2 = 'xwa2_newsletter_update_user_setting',
|
||||||
xwa2_newsletter_unmute_v2 = 'xwa2_newsletter_unmute_v2',
|
xwa2_newsletter_unmute_v2 = 'xwa2_newsletter_update_user_setting',
|
||||||
xwa2_newsletter_follow = 'xwa2_newsletter_follow',
|
xwa2_newsletter_follow = 'xwa2_newsletter_join_v2',
|
||||||
xwa2_newsletter_unfollow = 'xwa2_newsletter_unfollow',
|
xwa2_newsletter_unfollow = 'xwa2_newsletter_leave_v2',
|
||||||
xwa2_newsletter_change_owner = 'xwa2_newsletter_change_owner',
|
xwa2_newsletter_change_owner = 'xwa2_newsletter_change_owner',
|
||||||
xwa2_newsletter_demote = 'xwa2_newsletter_demote',
|
xwa2_newsletter_demote = 'xwa2_newsletter_demote',
|
||||||
xwa2_newsletter_delete_v2 = 'xwa2_newsletter_delete_v2'
|
xwa2_newsletter_delete_v2 = 'xwa2_newsletter_delete_v2'
|
||||||
@@ -17,10 +17,10 @@ export enum QueryIds {
|
|||||||
UPDATE_METADATA = '24250201037901610',
|
UPDATE_METADATA = '24250201037901610',
|
||||||
METADATA = '6563316087068696',
|
METADATA = '6563316087068696',
|
||||||
SUBSCRIBERS = '9783111038412085',
|
SUBSCRIBERS = '9783111038412085',
|
||||||
FOLLOW = '7871414976211147',
|
FOLLOW = '24404358912487870',
|
||||||
UNFOLLOW = '7238632346214362',
|
UNFOLLOW = '9767147403369991',
|
||||||
MUTE = '29766401636284406',
|
MUTE = '31938993655691868',
|
||||||
UNMUTE = '9864994326891137',
|
UNMUTE = '31938993655691868',
|
||||||
ADMIN_COUNT = '7130823597031706',
|
ADMIN_COUNT = '7130823597031706',
|
||||||
CHANGE_OWNER = '7341777602580933',
|
CHANGE_OWNER = '7341777602580933',
|
||||||
DEMOTE = '6551828931592903',
|
DEMOTE = '6551828931592903',
|
||||||
|
|||||||
@@ -392,6 +392,23 @@ export const decryptMessageNode = (
|
|||||||
} else {
|
} else {
|
||||||
fullMessage.message = msg
|
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) {
|
} catch (err: any) {
|
||||||
// Check if this is a final failure after all retries exhausted
|
// Check if this is a final failure after all retries exhausted
|
||||||
const isRetryExhausted = err instanceof RetryExhaustedError
|
const isRetryExhausted = err instanceof RetryExhaustedError
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import EventEmitter from 'events'
|
import EventEmitter from 'events'
|
||||||
|
import { proto } from '../../WAProto/index.js'
|
||||||
import type {
|
import type {
|
||||||
BaileysEvent,
|
BaileysEvent,
|
||||||
BaileysEventEmitter,
|
BaileysEventEmitter,
|
||||||
@@ -890,6 +891,7 @@ const makeBufferData = (): BufferedEventData => {
|
|||||||
chats: {},
|
chats: {},
|
||||||
messages: {},
|
messages: {},
|
||||||
contacts: {},
|
contacts: {},
|
||||||
|
pastParticipants: {},
|
||||||
isLatest: false,
|
isLatest: false,
|
||||||
empty: true
|
empty: true
|
||||||
},
|
},
|
||||||
@@ -967,6 +969,28 @@ 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.empty = false
|
||||||
data.historySets.syncType = eventData.syncType
|
data.historySets.syncType = eventData.syncType
|
||||||
data.historySets.progress = eventData.progress
|
data.historySets.progress = eventData.progress
|
||||||
@@ -1292,6 +1316,10 @@ function consolidateEvents(data: BufferedEventData) {
|
|||||||
chats: Object.values(data.historySets.chats),
|
chats: Object.values(data.historySets.chats),
|
||||||
messages: Object.values(data.historySets.messages),
|
messages: Object.values(data.historySets.messages),
|
||||||
contacts: Object.values(data.historySets.contacts),
|
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,
|
syncType: data.historySets.syncType,
|
||||||
progress: data.historySets.progress,
|
progress: data.historySets.progress,
|
||||||
isLatest: data.historySets.isLatest,
|
isLatest: data.historySets.isLatest,
|
||||||
|
|||||||
+34
-2
@@ -15,7 +15,8 @@ import {
|
|||||||
import { toNumber } from './generics'
|
import { toNumber } from './generics'
|
||||||
import type { ILogger } from './logger.js'
|
import type { ILogger } from './logger.js'
|
||||||
import { normalizeMessageContent } from './messages'
|
import { normalizeMessageContent } from './messages'
|
||||||
import { downloadContentFromMessage } from './messages-media'
|
import { DEFAULT_ORIGIN } from '../Defaults'
|
||||||
|
import { downloadContentFromMessage, getUrlFromDirectPath } from './messages-media'
|
||||||
|
|
||||||
const inflatePromise = promisify(inflate)
|
const inflatePromise = promisify(inflate)
|
||||||
|
|
||||||
@@ -374,10 +375,25 @@ export const processHistoryMessage = (item: proto.IHistorySync, logger?: ILogger
|
|||||||
// Convert Map back to array for return
|
// Convert Map back to array for return
|
||||||
const lidPnMappings = Array.from(lidPnMap.values())
|
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 {
|
return {
|
||||||
chats,
|
chats,
|
||||||
contacts,
|
contacts,
|
||||||
messages,
|
messages,
|
||||||
|
pastParticipants,
|
||||||
lidPnMappings,
|
lidPnMappings,
|
||||||
syncType: item.syncType,
|
syncType: item.syncType,
|
||||||
progress: item.progress
|
progress: item.progress
|
||||||
@@ -408,7 +424,23 @@ export const downloadAndProcessHistorySyncNotification = async (
|
|||||||
historyMsg = await downloadHistory(msg, options)
|
historyMsg = await downloadHistory(msg, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
return processHistoryMessage(historyMsg, logger)
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+54
-36
@@ -635,6 +635,59 @@ 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)
|
// Map cards to the carousel format (processing media)
|
||||||
const carouselCards = await Promise.all(
|
const carouselCards = await Promise.all(
|
||||||
cards.map(async card => {
|
cards.map(async card => {
|
||||||
@@ -653,42 +706,7 @@ export const generateCarouselMessage = async (
|
|||||||
|
|
||||||
// Mirror the working Pastorini-style result: every carousel image card should
|
// Mirror the working Pastorini-style result: every carousel image card should
|
||||||
// carry a jpegThumbnail and dimensions before it reaches the Web live renderer.
|
// carry a jpegThumbnail and dimensions before it reaches the Web live renderer.
|
||||||
if (imageMessage && (!imageMessage.jpegThumbnail || !imageMessage.height || !imageMessage.width)) {
|
await recoverCarouselImageMetadata(imageMessage, card.image, card.title, mediaOptions)
|
||||||
try {
|
|
||||||
const { stream } = await getStream(card.image, mediaOptions.options)
|
|
||||||
const { buffer, original } = await extractImageThumb(stream)
|
|
||||||
|
|
||||||
if (!imageMessage.jpegThumbnail) {
|
|
||||||
imageMessage.jpegThumbnail = buffer.toString('base64')
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!imageMessage.width && original.width) {
|
|
||||||
imageMessage.width = original.width
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!imageMessage.height && original.height) {
|
|
||||||
imageMessage.height = original.height
|
|
||||||
}
|
|
||||||
|
|
||||||
mediaOptions.logger?.info(
|
|
||||||
{
|
|
||||||
cardTitle: card.title,
|
|
||||||
recoveredThumbnail: !!imageMessage.jpegThumbnail,
|
|
||||||
width: imageMessage.width,
|
|
||||||
height: imageMessage.height
|
|
||||||
},
|
|
||||||
'[CAROUSEL] Recovered image metadata from source media'
|
|
||||||
)
|
|
||||||
} catch (error) {
|
|
||||||
mediaOptions.logger?.warn(
|
|
||||||
{
|
|
||||||
cardTitle: card.title,
|
|
||||||
trace: error instanceof Error ? error.stack : String(error)
|
|
||||||
},
|
|
||||||
'[CAROUSEL] Failed source-media thumbnail fallback'
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Validate image fields needed for WhatsApp rendering
|
// Validate image fields needed for WhatsApp rendering
|
||||||
if (imageMessage && !imageMessage.jpegThumbnail) {
|
if (imageMessage && !imageMessage.jpegThumbnail) {
|
||||||
|
|||||||
@@ -14,24 +14,19 @@ import { encodeBigEndian } from './generics'
|
|||||||
import { createSignalIdentity } from './signal'
|
import { createSignalIdentity } from './signal'
|
||||||
|
|
||||||
const getUserAgent = (config: SocketConfig): proto.ClientPayload.IUserAgent => {
|
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 {
|
return {
|
||||||
appVersion: {
|
appVersion: {
|
||||||
primary: config.version[0],
|
primary: config.version[0],
|
||||||
secondary: config.version[1],
|
secondary: config.version[1],
|
||||||
tertiary: config.version[2]
|
tertiary: config.version[2]
|
||||||
},
|
},
|
||||||
platform: proto.ClientPayload.UserAgent.Platform.MACOS,
|
platform: proto.ClientPayload.UserAgent.Platform.WEB,
|
||||||
releaseChannel: proto.ClientPayload.UserAgent.ReleaseChannel.RELEASE,
|
releaseChannel: proto.ClientPayload.UserAgent.ReleaseChannel.RELEASE,
|
||||||
osVersion: '0.1',
|
osVersion: '0.1',
|
||||||
device: 'Desktop',
|
device: 'Desktop',
|
||||||
osBuildNumber: '0.1',
|
osBuildNumber: '0.1',
|
||||||
localeLanguageIso6391: 'en',
|
localeLanguageIso6391: 'en',
|
||||||
|
|
||||||
mnc: '000',
|
mnc: '000',
|
||||||
mcc: '000',
|
mcc: '000',
|
||||||
localeCountryIso31661Alpha2: config.countryCode
|
localeCountryIso31661Alpha2: config.countryCode
|
||||||
@@ -60,20 +55,16 @@ const getClientPayload = (config: SocketConfig) => {
|
|||||||
const payload: proto.IClientPayload = {
|
const payload: proto.IClientPayload = {
|
||||||
connectType: proto.ClientPayload.ConnectType.WIFI_UNKNOWN,
|
connectType: proto.ClientPayload.ConnectType.WIFI_UNKNOWN,
|
||||||
connectReason: proto.ClientPayload.ConnectReason.USER_ACTIVATED,
|
connectReason: proto.ClientPayload.ConnectReason.USER_ACTIVATED,
|
||||||
userAgent: getUserAgent(config),
|
userAgent: getUserAgent(config)
|
||||||
webInfo: getWebInfo(config)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
payload.webInfo = getWebInfo(config)
|
||||||
|
|
||||||
return payload
|
return payload
|
||||||
}
|
}
|
||||||
|
|
||||||
export const generateLoginNode = (userJid: string, config: SocketConfig): proto.IClientPayload => {
|
export const generateLoginNode = (userJid: string, config: SocketConfig): proto.IClientPayload => {
|
||||||
const decoded = jidDecode(userJid)
|
const { user, device } = jidDecode(userJid)!
|
||||||
if (!decoded) {
|
|
||||||
throw new Boom('Invalid user JID', { statusCode: 400 })
|
|
||||||
}
|
|
||||||
|
|
||||||
const { user, device } = decoded
|
|
||||||
const payload: proto.IClientPayload = {
|
const payload: proto.IClientPayload = {
|
||||||
...getClientPayload(config),
|
...getClientPayload(config),
|
||||||
passive: true,
|
passive: true,
|
||||||
@@ -88,10 +79,6 @@ export const generateLoginNode = (userJid: string, config: SocketConfig): proto.
|
|||||||
|
|
||||||
const getPlatformType = (platform: string): proto.DeviceProps.PlatformType => {
|
const getPlatformType = (platform: string): proto.DeviceProps.PlatformType => {
|
||||||
const platformType = platform.toUpperCase()
|
const platformType = platform.toUpperCase()
|
||||||
if (platformType === 'ANDROID') {
|
|
||||||
return proto.DeviceProps.PlatformType.ANDROID_PHONE
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
proto.DeviceProps.PlatformType[platformType as keyof typeof proto.DeviceProps.PlatformType] ||
|
proto.DeviceProps.PlatformType[platformType as keyof typeof proto.DeviceProps.PlatformType] ||
|
||||||
proto.DeviceProps.PlatformType.CHROME
|
proto.DeviceProps.PlatformType.CHROME
|
||||||
@@ -166,9 +153,6 @@ export const configureSuccessfulPairing = (
|
|||||||
}: Pick<AuthenticationCreds, 'advSecretKey' | 'signedIdentityKey' | 'signalIdentities'>
|
}: Pick<AuthenticationCreds, 'advSecretKey' | 'signedIdentityKey' | 'signalIdentities'>
|
||||||
) => {
|
) => {
|
||||||
const msgId = stanza.attrs.id
|
const msgId = stanza.attrs.id
|
||||||
if (!msgId) {
|
|
||||||
throw new Boom('Missing message ID', { statusCode: 400 })
|
|
||||||
}
|
|
||||||
|
|
||||||
const pairSuccessNode = getBinaryNodeChild(stanza, 'pair-success')
|
const pairSuccessNode = getBinaryNodeChild(stanza, 'pair-success')
|
||||||
|
|
||||||
@@ -184,51 +168,42 @@ export const configureSuccessfulPairing = (
|
|||||||
const bizName = businessNode?.attrs.name
|
const bizName = businessNode?.attrs.name
|
||||||
const jid = deviceNode.attrs.jid
|
const jid = deviceNode.attrs.jid
|
||||||
const lid = deviceNode.attrs.lid
|
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)
|
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([])
|
let hmacPrefix = Buffer.from([])
|
||||||
if (accountType !== undefined && accountType === proto.ADVEncryptionType.HOSTED) {
|
if (accountType !== undefined && accountType === proto.ADVEncryptionType.HOSTED) {
|
||||||
hmacPrefix = WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX
|
hmacPrefix = WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX
|
||||||
}
|
}
|
||||||
|
|
||||||
const advSign = hmacSign(Buffer.concat([hmacPrefix, details]), Buffer.from(advSecretKey, 'base64'))
|
const advSign = hmacSign(Buffer.concat([hmacPrefix, details!]), Buffer.from(advSecretKey, 'base64'))
|
||||||
if (Buffer.compare(hmac, advSign) !== 0) {
|
if (Buffer.compare(hmac!, advSign) !== 0) {
|
||||||
throw new Boom('Invalid account signature')
|
throw new Boom('Invalid account signature')
|
||||||
}
|
}
|
||||||
|
|
||||||
const account = proto.ADVSignedDeviceIdentity.decode(details)
|
const account = proto.ADVSignedDeviceIdentity.decode(details!)
|
||||||
const { accountSignatureKey, accountSignature, details: deviceDetails } = account
|
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 =
|
const accountSignaturePrefix =
|
||||||
deviceIdentity.deviceType === proto.ADVEncryptionType.HOSTED
|
deviceIdentity.deviceType === proto.ADVEncryptionType.HOSTED
|
||||||
? WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX
|
? WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX
|
||||||
: WA_ADV_ACCOUNT_SIG_PREFIX
|
: WA_ADV_ACCOUNT_SIG_PREFIX
|
||||||
const accountMsg = Buffer.concat([accountSignaturePrefix, deviceDetails, signedIdentityKey.public])
|
const accountMsg = Buffer.concat([accountSignaturePrefix, deviceDetails!, signedIdentityKey.public])
|
||||||
if (!Curve.verify(accountSignatureKey, accountMsg, accountSignature)) {
|
if (!Curve.verify(accountSignatureKey!, accountMsg, accountSignature!)) {
|
||||||
throw new Boom('Failed to verify account signature')
|
throw new Boom('Failed to verify account signature')
|
||||||
}
|
}
|
||||||
|
|
||||||
const deviceMsg = Buffer.concat([
|
const deviceMsg = Buffer.concat([
|
||||||
WA_ADV_DEVICE_SIG_PREFIX,
|
WA_ADV_DEVICE_SIG_PREFIX,
|
||||||
deviceDetails,
|
deviceDetails!,
|
||||||
signedIdentityKey.public,
|
signedIdentityKey.public,
|
||||||
accountSignatureKey
|
accountSignatureKey!
|
||||||
])
|
])
|
||||||
account.deviceSignature = Curve.sign(signedIdentityKey.private, deviceMsg)
|
account.deviceSignature = Curve.sign(signedIdentityKey.private, deviceMsg)
|
||||||
|
|
||||||
const identity = createSignalIdentity(lid, accountSignatureKey)
|
const identity = createSignalIdentity(lid!, accountSignatureKey!)
|
||||||
const accountEnc = encodeSignedDeviceIdentity(account, false)
|
const accountEnc = encodeSignedDeviceIdentity(account, false)
|
||||||
|
|
||||||
const reply: BinaryNode = {
|
const reply: BinaryNode = {
|
||||||
@@ -236,7 +211,7 @@ export const configureSuccessfulPairing = (
|
|||||||
attrs: {
|
attrs: {
|
||||||
to: S_WHATSAPP_NET,
|
to: S_WHATSAPP_NET,
|
||||||
type: 'result',
|
type: 'result',
|
||||||
id: msgId
|
id: msgId!
|
||||||
},
|
},
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
@@ -255,7 +230,7 @@ export const configureSuccessfulPairing = (
|
|||||||
|
|
||||||
const authUpdate: Partial<AuthenticationCreds> = {
|
const authUpdate: Partial<AuthenticationCreds> = {
|
||||||
account,
|
account,
|
||||||
me: { id: jid, name: bizName, lid },
|
me: { id: jid!, name: bizName, lid },
|
||||||
signalIdentities: [...(signalIdentities || []), identity],
|
signalIdentities: [...(signalIdentities || []), identity],
|
||||||
platform: platformNode?.attrs.name
|
platform: platformNode?.attrs.name
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
} from './Protocols'
|
} from './Protocols'
|
||||||
import { USyncUser } from './USyncUser'
|
import { USyncUser } from './USyncUser'
|
||||||
|
|
||||||
export type USyncQueryResultList = { [protocol: string]: unknown; id: string }
|
export type USyncQueryResultList = { [protocol: string]: unknown; id: string; rawId?: number }
|
||||||
|
|
||||||
export type USyncQueryResult = {
|
export type USyncQueryResult = {
|
||||||
list: USyncQueryResultList[]
|
list: USyncQueryResultList[]
|
||||||
@@ -68,10 +68,8 @@ export class USyncQuery {
|
|||||||
//TODO: see if there are any errors in the result node
|
//TODO: see if there are any errors in the result node
|
||||||
//const resultNode = getBinaryNodeChild(usyncNode, 'result')
|
//const resultNode = getBinaryNodeChild(usyncNode, 'result')
|
||||||
|
|
||||||
const listNode = usyncNode ? getBinaryNodeChild(usyncNode, 'list') : undefined
|
const parseNodeList = (content: BinaryNode[]): USyncQueryResultList[] =>
|
||||||
|
content.reduce((acc: USyncQueryResultList[], node) => {
|
||||||
if (listNode?.content && Array.isArray(listNode.content)) {
|
|
||||||
queryResult.list = listNode.content.reduce((acc: USyncQueryResultList[], node) => {
|
|
||||||
const id = node?.attrs.jid
|
const id = node?.attrs.jid
|
||||||
if (id) {
|
if (id) {
|
||||||
const data = Array.isArray(node?.content)
|
const data = Array.isArray(node?.content)
|
||||||
@@ -89,15 +87,24 @@ export class USyncQuery {
|
|||||||
.filter(([, b]) => b !== null) as [string, unknown][]
|
.filter(([, b]) => b !== null) as [string, unknown][]
|
||||||
)
|
)
|
||||||
: {}
|
: {}
|
||||||
acc.push({ ...data, id })
|
const rawIdAttr = node?.attrs?.['raw_id']
|
||||||
|
const rawId = rawIdAttr !== undefined ? Number(rawIdAttr) : undefined
|
||||||
|
acc.push({ ...data, id, ...(rawId !== undefined && !isNaN(rawId) ? { rawId } : {}) })
|
||||||
}
|
}
|
||||||
|
|
||||||
return acc
|
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
|
return queryResult
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -388,6 +388,13 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
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":
|
"@cacheable/node-cache@npm:^2.0.1":
|
||||||
version: 2.0.1
|
version: 2.0.1
|
||||||
resolution: "@cacheable/node-cache@npm:2.0.1"
|
resolution: "@cacheable/node-cache@npm:2.0.1"
|
||||||
@@ -3105,7 +3112,7 @@ __metadata:
|
|||||||
libsignal: "github:whiskeysockets/libsignal-node"
|
libsignal: "github:whiskeysockets/libsignal-node"
|
||||||
link-preview-js: "npm:^4.0.0"
|
link-preview-js: "npm:^4.0.0"
|
||||||
lru-cache: "npm:^11.2.6"
|
lru-cache: "npm:^11.2.6"
|
||||||
music-metadata: "npm:^11.12.0"
|
music-metadata: "npm:^11.12.3"
|
||||||
open: "npm:^11.0.0"
|
open: "npm:^11.0.0"
|
||||||
p-queue: "npm:^9.0.0"
|
p-queue: "npm:^9.0.0"
|
||||||
pino: "npm:^10.3.1"
|
pino: "npm:^10.3.1"
|
||||||
@@ -4556,15 +4563,15 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"file-type@npm:^21.3.0":
|
"file-type@npm:^21.3.1":
|
||||||
version: 21.3.0
|
version: 21.3.1
|
||||||
resolution: "file-type@npm:21.3.0"
|
resolution: "file-type@npm:21.3.1"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@tokenizer/inflate": "npm:^0.4.1"
|
"@tokenizer/inflate": "npm:^0.4.1"
|
||||||
strtok3: "npm:^10.3.4"
|
strtok3: "npm:^10.3.4"
|
||||||
token-types: "npm:^6.1.1"
|
token-types: "npm:^6.1.1"
|
||||||
uint8array-extras: "npm:^1.4.0"
|
uint8array-extras: "npm:^1.4.0"
|
||||||
checksum: 10c0/1b1fa909e6063044a6da1d2ea348ee4d747ed9286382d3f0d4d6532c11fb2ea9f2e7e67b2bc7d745d1bc937e05dee1aa8cb912c64250933bcb393a3744f4e284
|
checksum: 10c0/66a8eda781c803c6fc372464abba88cee564cfe30f029716f06909da1564bc51d0a4e8d34654b881dc751cdb0513338b3c0747e06a608cee0dd5c5499b018d47
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@@ -6504,21 +6511,21 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"music-metadata@npm:^11.12.0":
|
"music-metadata@npm:^11.12.3":
|
||||||
version: 11.12.0
|
version: 11.12.3
|
||||||
resolution: "music-metadata@npm:11.12.0"
|
resolution: "music-metadata@npm:11.12.3"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@borewit/text-codec": "npm:^0.2.1"
|
"@borewit/text-codec": "npm:^0.2.2"
|
||||||
"@tokenizer/token": "npm:^0.3.0"
|
"@tokenizer/token": "npm:^0.3.0"
|
||||||
content-type: "npm:^1.0.5"
|
content-type: "npm:^1.0.5"
|
||||||
debug: "npm:^4.4.3"
|
debug: "npm:^4.4.3"
|
||||||
file-type: "npm:^21.3.0"
|
file-type: "npm:^21.3.1"
|
||||||
media-typer: "npm:^1.1.0"
|
media-typer: "npm:^1.1.0"
|
||||||
strtok3: "npm:^10.3.4"
|
strtok3: "npm:^10.3.4"
|
||||||
token-types: "npm:^6.1.2"
|
token-types: "npm:^6.1.2"
|
||||||
uint8array-extras: "npm:^1.5.0"
|
uint8array-extras: "npm:^1.5.0"
|
||||||
win-guid: "npm:^0.2.1"
|
win-guid: "npm:^0.2.1"
|
||||||
checksum: 10c0/014a120b8941ab80452171def0ec3cba013041ba4b94f8061ad493a037d3423e6d316131a13fb0433404685ebd3c8e3ae2255c1bafaeb20673fcd73af2df0148
|
checksum: 10c0/57df905f51ec792e5b4c994645eab64d47d5608b9de11151f54b26fbd5f563598ec04d8aed7f244ef1479030d78ddab8af1ee84dfcee40a93b3241941b50999d
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user