amiudmodz 6.1.3 → 6.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@ import { proto } from '../../WAProto/index.js';
2
2
  import { makeLibSignalRepository } from '../Signal/libsignal.js';
3
3
  import { Browsers } from '../Utils/browser-utils.js';
4
4
  import logger from '../Utils/logger.js';
5
- const version = [2, 3000, 1043545460];
5
+ const version = [2, 3000, 1043857760];
6
6
  export const UNAUTHORIZED_CODES = [401, 403, 419];
7
7
  export const DEFAULT_ORIGIN = 'https://web.whatsapp.com';
8
8
  export const CALL_VIDEO_PREFIX = 'https://call.whatsapp.com/video/';
@@ -20,7 +20,7 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
20
20
  updateCoverPhoto: (photo: WAMediaUpload) => Promise<number>;
21
21
  removeCoverPhoto: (id: string) => Promise<any>;
22
22
  sendMessageAck: (node: BinaryNode, errorCode?: number) => Promise<void>;
23
- sendRetryRequest: (node: BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
23
+ sendRetryRequest: (node: BinaryNode, forceIncludeKeys?: boolean, decryptionError?: string) => Promise<void>;
24
24
  rejectCall: (callId: string, callFrom: string) => Promise<void>;
25
25
  fetchMessageHistory: (count: number, oldestMsgKey: import("../index.js").WAMessageKey, oldestMsgTimestamp: number | import("long").default) => Promise<string>;
26
26
  requestPlaceholderResend: (messageKey: import("../index.js").WAMessageKey, msgData?: Partial<import("../index.js").WAMessage>) => Promise<string | undefined>;
@@ -75,7 +75,7 @@ export declare const makeCommunitiesSocket: (config: SocketConfig) => {
75
75
  updateCoverPhoto: (photo: import("../Types/index.js").WAMediaUpload) => Promise<number>;
76
76
  removeCoverPhoto: (id: string) => Promise<any>;
77
77
  sendMessageAck: (node: BinaryNode, errorCode?: number) => Promise<void>;
78
- sendRetryRequest: (node: BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
78
+ sendRetryRequest: (node: BinaryNode, forceIncludeKeys?: boolean, decryptionError?: string) => Promise<void>;
79
79
  rejectCall: (callId: string, callFrom: string) => Promise<void>;
80
80
  fetchMessageHistory: (count: number, oldestMsgKey: WAMessageKey, oldestMsgTimestamp: number | import("long").default) => Promise<string>;
81
81
  requestPlaceholderResend: (messageKey: WAMessageKey, msgData?: Partial<import("../Types/index.js").WAMessage>) => Promise<string | undefined>;
@@ -1,264 +1,5 @@
1
1
  import type { UserFacingSocketConfig } from '../Types/index.js';
2
- declare const makeWASocket: (config: UserFacingSocketConfig) => {
3
- communityMetadata: (jid: string) => Promise<import("../index.js").GroupMetadata>;
4
- communityCreate: (subject: string, body: string) => Promise<import("../index.js").GroupMetadata | null>;
5
- communityCreateGroup: (subject: string, participants: string[], parentCommunityJid: string) => Promise<import("../index.js").GroupMetadata | null>;
6
- communityLeave: (id: string) => Promise<void>;
7
- communityUpdateSubject: (jid: string, subject: string) => Promise<void>;
8
- communityLinkGroup: (groupJid: string, parentCommunityJid: string) => Promise<void>;
9
- communityUnlinkGroup: (groupJid: string, parentCommunityJid: string) => Promise<void>;
10
- communityFetchLinkedGroups: (jid: string) => Promise<{
11
- communityJid: string;
12
- isCommunity: boolean;
13
- linkedGroups: {
14
- id: string | undefined;
15
- subject: string;
16
- creation: number | undefined;
17
- owner: string | undefined;
18
- size: number | undefined;
19
- }[];
20
- }>;
21
- communityRequestParticipantsList: (jid: string) => Promise<{
22
- [key: string]: string;
23
- }[]>;
24
- communityRequestParticipantsUpdate: (jid: string, participants: string[], action: "approve" | "reject") => Promise<{
25
- status: string;
26
- jid: string | undefined;
27
- }[]>;
28
- communityParticipantsUpdate: (jid: string, participants: string[], action: import("../index.js").ParticipantAction) => Promise<{
29
- status: string;
30
- jid: string | undefined;
31
- content: import("../index.js").BinaryNode;
32
- }[]>;
33
- communityUpdateDescription: (jid: string, description?: string) => Promise<void>;
34
- communityInviteCode: (jid: string) => Promise<string | undefined>;
35
- communityRevokeInvite: (jid: string) => Promise<string | undefined>;
36
- communityAcceptInvite: (code: string) => Promise<string | undefined>;
37
- communityRevokeInviteV4: (communityJid: string, invitedJid: string) => Promise<boolean>;
38
- communityAcceptInviteV4: (key: string | import("../index.js").WAMessageKey, inviteMessage: import("../index.js").proto.Message.IGroupInviteMessage) => Promise<any>;
39
- communityGetInviteInfo: (code: string) => Promise<import("../index.js").GroupMetadata>;
40
- communityToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
41
- communitySettingUpdate: (jid: string, setting: "announcement" | "not_announcement" | "locked" | "unlocked") => Promise<void>;
42
- communityMemberAddMode: (jid: string, mode: "admin_add" | "all_member_add") => Promise<void>;
43
- communityJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
44
- communityFetchAllParticipating: () => Promise<{
45
- [_: string]: import("../index.js").GroupMetadata;
46
- }>;
47
- logger: import("../Utils/logger.js").ILogger;
48
- getOrderDetails: (orderId: string, tokenBase64: string) => Promise<import("../index.js").OrderDetails>;
49
- getCatalog: ({ jid, limit, cursor }: import("../index.js").GetCatalogOptions) => Promise<{
50
- products: import("../index.js").Product[];
51
- nextPageCursor: string | undefined;
52
- }>;
53
- getCollections: (jid?: string, limit?: number) => Promise<{
54
- collections: import("../index.js").CatalogCollection[];
55
- }>;
56
- productCreate: (create: import("../index.js").ProductCreate) => Promise<import("../index.js").Product>;
57
- productDelete: (productIds: string[]) => Promise<{
58
- deleted: number;
59
- }>;
60
- productUpdate: (productId: string, update: import("../index.js").ProductUpdate) => Promise<import("../index.js").Product>;
61
- updateBussinesProfile: (args: import("../Types/Bussines.js").UpdateBussinesProfileProps) => Promise<any>;
62
- updateCoverPhoto: (photo: import("../index.js").WAMediaUpload) => Promise<number>;
63
- removeCoverPhoto: (id: string) => Promise<any>;
64
- sendMessageAck: (node: import("../index.js").BinaryNode, errorCode?: number) => Promise<void>;
65
- sendRetryRequest: (node: import("../index.js").BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
66
- rejectCall: (callId: string, callFrom: string) => Promise<void>;
67
- fetchMessageHistory: (count: number, oldestMsgKey: import("../index.js").WAMessageKey, oldestMsgTimestamp: number | import("long").default) => Promise<string>;
68
- requestPlaceholderResend: (messageKey: import("../index.js").WAMessageKey, msgData?: Partial<import("../index.js").WAMessage>) => Promise<string | undefined>;
69
- messageRetryManager: import("../index.js").MessageRetryManager | null;
70
- userDevicesCache: import("../index.js").PossiblyExtendedCacheStore | import("@cacheable/node-cache").NodeCache<import("../index.js").JidWithDevice[]>;
71
- devicesMutex: {
72
- mutex<T>(code: () => Promise<T> | T): Promise<T>;
73
- };
74
- issuePrivacyTokens: (jids: string[], timestamp?: number) => Promise<any>;
75
- assertSessions: (jids: string[], force?: boolean) => Promise<boolean>;
76
- relayMessage: (jid: string, message: import("../index.js").proto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, useCachedGroupMetadata, statusJidList, addBizAttributes }: import("../index.js").MessageRelayOptions & {
77
- addBizAttributes?: boolean;
78
- }) => Promise<string>;
79
- sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../index.js").MessageReceiptType) => Promise<void>;
80
- sendReceipts: (keys: import("../index.js").WAMessageKey[], type: import("../index.js").MessageReceiptType) => Promise<void>;
81
- readMessages: (keys: import("../index.js").WAMessageKey[]) => Promise<void>;
82
- refreshMediaConn: (forceGet?: boolean) => Promise<import("../index.js").MediaConnInfo>;
83
- getMediaHost: () => string;
84
- waUploadToServer: import("../index.js").WAMediaUploadFunction;
85
- fetchPrivacySettings: (force?: boolean) => Promise<{
86
- [_: string]: string;
87
- }>;
88
- sendPeerDataOperationMessage: (pdoMessage: import("../index.js").proto.Message.IPeerDataOperationRequestMessage) => Promise<string>;
89
- createParticipantNodes: (recipientJids: string[], message: import("../index.js").proto.IMessage, extraAttrs?: import("../index.js").BinaryNode["attrs"], dsmMessage?: import("../index.js").proto.IMessage) => Promise<{
90
- nodes: import("../index.js").BinaryNode[];
91
- shouldIncludeDeviceIdentity: boolean;
92
- }>;
93
- getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<(import("../index.js").JidWithDevice & {
94
- jid: string;
95
- })[]>;
96
- updateMemberLabel: (jid: string, memberLabel: string) => Promise<string>;
97
- updateMediaMessage: (message: import("../index.js").WAMessage) => Promise<import("../index.js").WAMessage>;
98
- sendMessage: (jid: string, content: import("../index.js").AnyMessageContent, options?: import("../index.js").MiscMessageGenerationOptions) => Promise<import("../index.js").WAMessage | undefined>;
99
- newsletterCreate: (name: string, description?: string) => Promise<import("../index.js").NewsletterMetadata>;
100
- newsletterUpdate: (jid: string, updates: import("../index.js").NewsletterUpdate) => Promise<unknown>;
101
- newsletterSubscribers: (jid: string) => Promise<{
102
- subscribers: number;
103
- }>;
104
- newsletterSubscribed: () => Promise<unknown>;
105
- newsletterMetadata: (type: "invite" | "jid", key: string) => Promise<import("../index.js").NewsletterMetadata | null>;
106
- newsletterFollow: (jid: string) => Promise<unknown>;
107
- newsletterUnfollow: (jid: string) => Promise<unknown>;
108
- newsletterMute: (jid: string) => Promise<unknown>;
109
- newsletterUnmute: (jid: string) => Promise<unknown>;
110
- newsletterUpdateName: (jid: string, name: string) => Promise<unknown>;
111
- newsletterUpdateDescription: (jid: string, description: string) => Promise<unknown>;
112
- newsletterUpdatePicture: (jid: string, content: import("../index.js").WAMediaUpload) => Promise<unknown>;
113
- newsletterRemovePicture: (jid: string) => Promise<unknown>;
114
- newsletterReactMessage: (jid: string, serverId: string, reaction?: string) => Promise<void>;
115
- newsletterFetchMessages: (type: "jid" | "key", key: string, count: number, after?: number, before?: number) => Promise<import("../index.js").proto.IWebMessageInfo[]>;
116
- subscribeNewsletterUpdates: (jid: string) => Promise<{
117
- duration: string;
118
- } | null>;
119
- newsletterAdminCount: (jid: string) => Promise<number>;
120
- newsletterChangeOwner: (jid: string, newOwnerJid: string) => Promise<void>;
121
- newsletterDemote: (jid: string, userJid: string) => Promise<void>;
122
- newsletterDelete: (jid: string) => Promise<void>;
123
- groupMetadata: (jid: string) => Promise<import("../index.js").GroupMetadata>;
124
- groupCreate: (subject: string, participants: string[]) => Promise<import("../index.js").GroupMetadata>;
125
- groupLeave: (id: string) => Promise<void>;
126
- groupUpdateSubject: (jid: string, subject: string) => Promise<void>;
127
- groupRequestParticipantsList: (jid: string) => Promise<{
128
- [key: string]: string;
129
- }[]>;
130
- groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "approve" | "reject") => Promise<{
131
- status: string;
132
- jid: string | undefined;
133
- }[]>;
134
- groupParticipantsUpdate: (jid: string, participants: string[], action: import("../index.js").ParticipantAction) => Promise<{
135
- status: string;
136
- jid: string | undefined;
137
- content: import("../index.js").BinaryNode;
138
- }[]>;
139
- groupUpdateDescription: (jid: string, description?: string) => Promise<void>;
140
- groupInviteCode: (jid: string) => Promise<string | undefined>;
141
- groupRevokeInvite: (jid: string) => Promise<string | undefined>;
142
- groupAcceptInvite: (code: string) => Promise<string | undefined>;
143
- groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>;
144
- groupAcceptInviteV4: (key: string | import("../index.js").WAMessageKey, inviteMessage: import("../index.js").proto.Message.IGroupInviteMessage) => Promise<any>;
145
- groupGetInviteInfo: (code: string) => Promise<import("../index.js").GroupMetadata>;
146
- groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
147
- groupSettingUpdate: (jid: string, setting: "announcement" | "not_announcement" | "locked" | "unlocked") => Promise<void>;
148
- groupMemberAddMode: (jid: string, mode: "admin_add" | "all_member_add") => Promise<void>;
149
- groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
150
- groupFetchAllParticipating: () => Promise<{
151
- [_: string]: import("../index.js").GroupMetadata;
152
- }>;
153
- serverProps: {
154
- privacyTokenOn1to1: boolean;
155
- profilePicPrivacyToken: boolean;
156
- lidTrustedTokenIssueToLid: boolean;
157
- };
158
- createCallLink: (type: "audio" | "video", event?: {
159
- startTime: number;
160
- }, timeoutMs?: number) => Promise<string | undefined>;
161
- getBotListV2: () => Promise<import("../index.js").BotListInfo[]>;
162
- messageMutex: {
163
- mutex<T>(code: () => Promise<T> | T): Promise<T>;
164
- };
165
- receiptMutex: {
166
- mutex<T>(code: () => Promise<T> | T): Promise<T>;
167
- };
168
- appStatePatchMutex: {
169
- mutex<T>(code: () => Promise<T> | T): Promise<T>;
170
- };
171
- notificationMutex: {
172
- mutex<T>(code: () => Promise<T> | T): Promise<T>;
173
- };
174
- upsertMessage: (msg: import("../index.js").WAMessage, type: import("../index.js").MessageUpsertType) => Promise<void>;
175
- appPatch: (patchCreate: import("../index.js").WAPatchCreate) => Promise<void>;
176
- sendPresenceUpdate: (type: import("../index.js").WAPresence, toJid?: string) => Promise<void>;
177
- presenceSubscribe: (toJid: string) => Promise<void>;
178
- profilePictureUrl: (jid: string, type?: "preview" | "image", timeoutMs?: number) => Promise<string | undefined>;
179
- fetchBlocklist: () => Promise<(string | undefined)[]>;
180
- fetchStatus: (...jids: string[]) => Promise<import("../index.js").USyncQueryResultList[] | undefined>;
181
- fetchDisappearingDuration: (...jids: string[]) => Promise<import("../index.js").USyncQueryResultList[] | undefined>;
182
- updateProfilePicture: (jid: string, content: import("../index.js").WAMediaUpload, dimensions?: {
183
- width: number;
184
- height: number;
185
- }) => Promise<void>;
186
- removeProfilePicture: (jid: string) => Promise<void>;
187
- updateProfileStatus: (status: string) => Promise<void>;
188
- updateProfileName: (name: string) => Promise<void>;
189
- updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
190
- updateDisableLinkPreviewsPrivacy: (isPreviewsDisabled: boolean) => Promise<void>;
191
- updateCallPrivacy: (value: import("../index.js").WAPrivacyCallValue) => Promise<void>;
192
- updateMessagesPrivacy: (value: import("../index.js").WAPrivacyMessagesValue) => Promise<void>;
193
- updateLastSeenPrivacy: (value: import("../index.js").WAPrivacyValue) => Promise<void>;
194
- updateOnlinePrivacy: (value: import("../index.js").WAPrivacyOnlineValue) => Promise<void>;
195
- updateProfilePicturePrivacy: (value: import("../index.js").WAPrivacyValue) => Promise<void>;
196
- updateStatusPrivacy: (value: import("../index.js").WAPrivacyValue) => Promise<void>;
197
- updateReadReceiptsPrivacy: (value: import("../index.js").WAReadReceiptsValue) => Promise<void>;
198
- updateGroupsAddPrivacy: (value: import("../index.js").WAPrivacyGroupAddValue) => Promise<void>;
199
- updateDefaultDisappearingMode: (duration: number) => Promise<void>;
200
- getBusinessProfile: (jid: string) => Promise<import("../index.js").WABusinessProfile | void>;
201
- resyncAppState: (collections: readonly ("critical_unblock_low" | "regular_high" | "regular_low" | "critical_block" | "regular")[], isInitialSync: boolean) => Promise<void>;
202
- chatModify: (mod: import("../index.js").ChatModification, jid: string) => Promise<void>;
203
- cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
204
- addOrEditContact: (jid: string, contact: import("../index.js").proto.SyncActionValue.IContactAction) => Promise<void>;
205
- removeContact: (jid: string) => Promise<void>;
206
- saveContact: (name: string, phoneNumber: string) => Promise<void>;
207
- placeholderResendCache: import("../index.js").CacheStore;
208
- addLabel: (jid: string, labels: import("../Types/Label.js").LabelActionBody) => Promise<void>;
209
- addChatLabel: (jid: string, labelId: string) => Promise<void>;
210
- removeChatLabel: (jid: string, labelId: string) => Promise<void>;
211
- addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
212
- removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
213
- star: (jid: string, messages: {
214
- id: string;
215
- fromMe?: boolean;
216
- }[], star: boolean) => Promise<void>;
217
- addOrEditQuickReply: (quickReply: import("../Types/Bussines.js").QuickReplyAction) => Promise<void>;
218
- removeQuickReply: (timestamp: string) => Promise<void>;
219
- type: "md";
220
- ws: import("./Client/index.js").WebSocketClient;
221
- ev: import("../index.js").BaileysEventEmitter & {
222
- process(handler: (events: Partial<import("../index.js").BaileysEventMap>) => void | Promise<void>): () => void;
223
- buffer(): void;
224
- createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): (...args: A) => Promise<T>;
225
- flush(): boolean;
226
- isBuffering(): boolean;
227
- destroy(): void;
228
- };
229
- authState: {
230
- creds: import("../index.js").AuthenticationCreds;
231
- keys: import("../index.js").SignalKeyStoreWithTransaction;
232
- };
233
- signalRepository: import("../index.js").SignalRepositoryWithLIDStore;
234
- user: import("../index.js").Contact | undefined;
235
- generateMessageTag: () => string;
236
- query: (node: import("../index.js").BinaryNode, timeoutMs?: number) => Promise<any>;
237
- waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<T | undefined>;
238
- waitForSocketOpen: () => Promise<void>;
239
- sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
240
- sendNode: (frame: import("../index.js").BinaryNode) => Promise<void>;
241
- logout: (msg?: string) => Promise<void>;
242
- end: (error: Error | undefined) => Promise<void>;
243
- registerSocketEndHandler: (handler: (error: Error | undefined) => void | Promise<void>) => void;
244
- onUnexpectedError: (err: Error | import("@hapi/boom").Boom, msg: string) => void;
245
- uploadPreKeys: (count?: number) => Promise<void>;
246
- uploadPreKeysToServerIfRequired: () => Promise<void>;
247
- digestKeyBundle: () => Promise<void>;
248
- rotateSignedPreKey: () => Promise<void>;
249
- requestPairingCode: (phoneNumber: string, customPairingCode?: string) => Promise<string>;
250
- updateServerTimeOffset: ({ attrs }: import("../index.js").BinaryNode) => void;
251
- sendUnifiedSession: () => Promise<void>;
252
- wamBuffer: import("../index.js").BinaryInfo;
253
- waitForConnectionUpdate: (check: (u: Partial<import("../index.js").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
254
- sendWAMBuffer: (wamBuffer: Buffer) => Promise<any>;
255
- executeUSyncQuery: (usyncQuery: import("../index.js").USyncQuery) => Promise<import("../index.js").USyncQueryResult | undefined>;
256
- onWhatsApp: (...phoneNumber: string[]) => Promise<{
257
- jid: string;
258
- exists: boolean;
259
- }[] | undefined>;
260
- fetchAccountReachoutTimelock: () => Promise<import("../index.js").ReachoutTimelockState>;
261
- fetchNewChatMessageCap: () => Promise<import("../index.js").NewChatMessageCapInfo>;
262
- };
2
+ import { makeCommunitiesSocket } from './communities.js';
3
+ declare const makeWASocket: (config: UserFacingSocketConfig) => ReturnType<typeof makeCommunitiesSocket>;
263
4
  export default makeWASocket;
264
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Socket/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAItD,QAAA,MAAM,YAAY,GAAI,QAAQ,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAUozhB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAm2X,CAAC;;;;;;;;;0DAAp62B,GAAG,0BAA0B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAHx0C,CAAA;AAED,eAAe,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Socket/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAIrD,QAAA,MAAM,YAAY,GAAI,QAAQ,sBAAsB,KAAG,UAAU,CAAC,OAAO,qBAAqB,CAc7F,CAAA;AAED,eAAe,YAAY,CAAA"}
@@ -1,12 +1,18 @@
1
1
  import { DEFAULT_CONNECTION_CONFIG } from '../Defaults/index.js';
2
2
  import { makeCommunitiesSocket } from './communities.js';
3
+ import { wrapSocket } from 'baileys-antiban';
3
4
  // export the last socket layer
4
5
  const makeWASocket = (config) => {
5
6
  const newConfig = {
6
7
  ...DEFAULT_CONNECTION_CONFIG,
7
8
  ...config
8
9
  };
9
- return makeCommunitiesSocket(newConfig);
10
+ const sock = makeCommunitiesSocket(newConfig);
11
+ if (config.antiban !== false) {
12
+ const antibanConfig = typeof config.antiban === 'object' ? config.antiban : undefined;
13
+ return wrapSocket(sock, antibanConfig);
14
+ }
15
+ return sock;
10
16
  };
11
17
  export default makeWASocket;
12
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Socket/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAEvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAErD,+BAA+B;AAC/B,MAAM,YAAY,GAAG,CAAC,MAA8B,EAAE,EAAE;IACvD,MAAM,SAAS,GAAG;QACjB,GAAG,yBAAyB;QAC5B,GAAG,MAAM;KACT,CAAA;IAED,OAAO,qBAAqB,CAAC,SAAS,CAAC,CAAA;AACxC,CAAC,CAAA;AAED,eAAe,YAAY,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Socket/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAEvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,+BAA+B;AAC/B,MAAM,YAAY,GAAG,CAAC,MAA8B,EAA4C,EAAE;IACjG,MAAM,SAAS,GAAG;QACjB,GAAG,yBAAyB;QAC5B,GAAG,MAAM;KACT,CAAA;IAED,MAAM,IAAI,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAA;IAE7C,IAAI,MAAM,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;QAC9B,MAAM,aAAa,GAAG,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAA;QACrF,OAAO,UAAU,CAAC,IAAW,EAAE,aAAa,CAAQ,CAAA;IACrD,CAAC;IAED,OAAO,IAAI,CAAA;AACZ,CAAC,CAAA;AAED,eAAe,YAAY,CAAA"}
@@ -6,7 +6,7 @@ import type { MessageReceiptType, MessageRelayOptions, NewChatMessageCapInfo, So
6
6
  import { type BinaryNode, type JidWithDevice } from '../WABinary/index.js';
7
7
  export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
8
8
  sendMessageAck: (node: BinaryNode, errorCode?: number) => Promise<void>;
9
- sendRetryRequest: (node: BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
9
+ sendRetryRequest: (node: BinaryNode, forceIncludeKeys?: boolean, decryptionError?: string) => Promise<void>;
10
10
  rejectCall: (callId: string, callFrom: string) => Promise<void>;
11
11
  fetchMessageHistory: (count: number, oldestMsgKey: WAMessageKey, oldestMsgTimestamp: number | Long) => Promise<string>;
12
12
  requestPlaceholderResend: (messageKey: WAMessageKey, msgData?: Partial<WAMessage>) => Promise<string | undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"messages-recv.d.ts","sourceRoot":"","sources":["../../src/Socket/messages-recv.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,uBAAuB,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAEjC,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAQ9C,OAAO,KAAK,EAGX,kBAAkB,EAClB,mBAAmB,EAEnB,qBAAqB,EACrB,YAAY,EAEZ,SAAS,EACT,YAAY,EAEZ,MAAM,UAAU,CAAA;AA4CjB,OAAO,EAEN,KAAK,UAAU,EAgBf,KAAK,aAAa,EAElB,MAAM,aAAa,CAAA;AAwBpB,eAAO,MAAM,sBAAsB,GAAI,QAAQ,YAAY;2BAkctB,UAAU,cAAc,MAAM;6BA4B5B,UAAU;yBAtBd,MAAM,YAAY,MAAM;iCAnYlD,MAAM,gBACC,YAAY,sBACN,MAAM,GAAG,IAAI,KAC/B,OAAO,CAAC,MAAM,CAAC;2CAoBL,YAAY,YACd,OAAO,CAAC,SAAS,CAAC,KAC1B,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;;;;;;;;;wBAuYoB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA6V5B,CAAC;;;;;;;;;0DA52BnB,GAAG,0BACO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4oElB,CAAA"}
1
+ {"version":3,"file":"messages-recv.d.ts","sourceRoot":"","sources":["../../src/Socket/messages-recv.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,uBAAuB,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAEjC,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAQ9C,OAAO,KAAK,EAGX,kBAAkB,EAClB,mBAAmB,EAEnB,qBAAqB,EACrB,YAAY,EAEZ,SAAS,EACT,YAAY,EAEZ,MAAM,UAAU,CAAA;AA4CjB,OAAO,EAEN,KAAK,UAAU,EAgBf,KAAK,aAAa,EAElB,MAAM,aAAa,CAAA;AAwBpB,eAAO,MAAM,sBAAsB,GAAI,QAAQ,YAAY;2BAkctB,UAAU,cAAc,MAAM;6BA4B5B,UAAU,gDAA8C,MAAM;yBAtBlE,MAAM,YAAY,MAAM;iCAnYlD,MAAM,gBACC,YAAY,sBACN,MAAM,GAAG,IAAI,KAC/B,OAAO,CAAC,MAAM,CAAC;2CAoBL,YAAY,YACd,OAAO,CAAC,SAAS,CAAC,KAC1B,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;;;;;;;;;wBAuYN,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA6VD,CAAA;;;;;;;;;0DA52BnB,GAAG,0BACO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2pElB,CAAA"}
@@ -398,7 +398,7 @@ export const makeMessagesRecvSocket = (config) => {
398
398
  };
399
399
  await query(stanza);
400
400
  };
401
- const sendRetryRequest = async (node, forceIncludeKeys = false) => {
401
+ const sendRetryRequest = async (node, forceIncludeKeys = false, decryptionError) => {
402
402
  const { fullMessage } = decodeMessageNode(node, authState.creds.me.id, authState.creds.me.lid || '');
403
403
  const { key: msgKey } = fullMessage;
404
404
  const msgId = msgKey.id;
@@ -434,23 +434,34 @@ export const makeMessagesRecvSocket = (config) => {
434
434
  // Check if we should recreate the session
435
435
  let shouldRecreateSession = false;
436
436
  let recreateReason = '';
437
- if (enableAutoSessionRecreation && messageRetryManager && retryCount > 1) {
438
- try {
439
- // Check if we have a session with this JID
440
- const sessionId = signalRepository.jidToSignalProtocolAddress(fromJid);
441
- const hasSession = await signalRepository.validateSession(fromJid);
442
- const result = messageRetryManager.shouldRecreateSession(fromJid, hasSession.exists);
443
- shouldRecreateSession = result.recreate;
444
- recreateReason = result.reason;
445
- if (shouldRecreateSession) {
446
- logger.debug({ fromJid, retryCount, reason: recreateReason }, 'recreating session for retry');
447
- // Delete existing session to force recreation
448
- await authState.keys.set({ session: { [sessionId]: null } });
449
- forceIncludeKeys = true;
437
+ const isSessionCorrupted = !!(decryptionError && (decryptionError.toLowerCase().includes('session') ||
438
+ decryptionError.toLowerCase().includes('key') ||
439
+ decryptionError.toLowerCase().includes('signature') ||
440
+ decryptionError.toLowerCase().includes('mac') ||
441
+ decryptionError.toLowerCase().includes('decrypt')));
442
+ if (enableAutoSessionRecreation) {
443
+ if (retryCount > 1 || isSessionCorrupted) {
444
+ try {
445
+ // Check if we have a session with this JID
446
+ const sessionId = signalRepository.jidToSignalProtocolAddress(fromJid);
447
+ const hasSession = await signalRepository.validateSession(fromJid);
448
+ const result = messageRetryManager
449
+ ? messageRetryManager.shouldRecreateSession(fromJid, hasSession.exists)
450
+ : { recreate: true, reason: 'No messageRetryManager' };
451
+ shouldRecreateSession = result.recreate || isSessionCorrupted;
452
+ recreateReason = isSessionCorrupted
453
+ ? `proactive session repair on decryption error: ${decryptionError}`
454
+ : result.reason;
455
+ if (shouldRecreateSession) {
456
+ logger.debug({ fromJid, retryCount, reason: recreateReason }, 'recreating session for retry');
457
+ // Delete existing session to force recreation
458
+ await authState.keys.set({ session: { [sessionId]: null } });
459
+ forceIncludeKeys = true;
460
+ }
461
+ }
462
+ catch (error) {
463
+ logger.warn({ error, fromJid }, 'failed to check session recreation');
450
464
  }
451
- }
452
- catch (error) {
453
- logger.warn({ error, fromJid }, 'failed to check session recreation');
454
465
  }
455
466
  }
456
467
  if (retryCount <= 2) {
@@ -1417,7 +1428,7 @@ export const makeMessagesRecvSocket = (config) => {
1417
1428
  return;
1418
1429
  }
1419
1430
  const encNode = getBinaryNodeChild(node, 'enc');
1420
- await sendRetryRequest(node, !encNode);
1431
+ await sendRetryRequest(node, !encNode, msg.messageStubParameters?.[0]);
1421
1432
  if (retryRequestDelayMs) {
1422
1433
  await delay(retryRequestDelayMs);
1423
1434
  }