@genuxofficial/baileys 2.0.0 → 4.0.0

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.
Files changed (108) hide show
  1. package/WAProto/WAProto.proto +4451 -0
  2. package/WAProto/index.d.ts +219 -2233
  3. package/WAProto/index.js +525 -6773
  4. package/WAProto/shizo.x +1 -0
  5. package/engine-requirements.js +1 -1
  6. package/lib/Defaults/baileys-version.json +1 -1
  7. package/lib/Defaults/index.d.ts +236 -3
  8. package/lib/Defaults/index.js +24 -8
  9. package/lib/Defaults/phonenumber-mcc.json +223 -0
  10. package/lib/Signal/libsignal.js +9 -18
  11. package/lib/Socket/Client/{types.d.ts → abstract-socket-client.d.ts} +2 -0
  12. package/lib/Socket/Client/index.d.ts +3 -2
  13. package/lib/Socket/Client/index.js +3 -2
  14. package/lib/Socket/Client/mobile-socket-client.d.ts +13 -0
  15. package/lib/Socket/Client/mobile-socket-client.js +65 -0
  16. package/lib/Socket/Client/{websocket.d.ts → web-socket-client.d.ts} +1 -1
  17. package/lib/Socket/Client/{websocket.js → web-socket-client.js} +3 -3
  18. package/lib/Socket/business.d.ts +43 -43
  19. package/lib/Socket/chats.d.ts +17 -23
  20. package/lib/Socket/chats.js +9 -123
  21. package/lib/Socket/groups.d.ts +27 -32
  22. package/lib/Socket/groups.js +5 -18
  23. package/lib/Socket/index.d.ts +51 -49
  24. package/lib/Socket/index.js +2 -2
  25. package/lib/Socket/messages-recv.d.ts +41 -42
  26. package/lib/Socket/messages-recv.js +20 -39
  27. package/lib/Socket/messages-send.d.ts +33 -38
  28. package/lib/Socket/messages-send.js +16 -37
  29. package/lib/Socket/newsletter.d.ts +30 -35
  30. package/lib/Socket/newsletter.js +22 -26
  31. package/lib/Socket/registration.d.ts +271 -0
  32. package/lib/Socket/registration.js +166 -0
  33. package/lib/Socket/socket.d.ts +10 -9
  34. package/lib/Socket/socket.js +19 -16
  35. package/lib/Socket/usync.d.ts +12 -10
  36. package/lib/Socket/usync.js +15 -10
  37. package/lib/Store/index.d.ts +2 -1
  38. package/lib/Store/index.js +3 -1
  39. package/lib/Store/make-in-memory-store.d.ts +1 -1
  40. package/lib/Store/make-in-memory-store.js +10 -8
  41. package/lib/Store/make-ordered-dictionary.d.ts +1 -1
  42. package/lib/Store/make-ordered-dictionary.js +2 -2
  43. package/lib/Types/Auth.d.ts +8 -0
  44. package/lib/Types/Chat.d.ts +2 -12
  45. package/lib/Types/Contact.d.ts +1 -6
  46. package/lib/Types/GroupMetadata.d.ts +0 -7
  47. package/lib/Types/Label.d.ts +0 -11
  48. package/lib/Types/Label.js +1 -1
  49. package/lib/Types/LabelAssociation.js +1 -1
  50. package/lib/Types/Message.d.ts +8 -7
  51. package/lib/Types/Message.js +2 -0
  52. package/lib/Types/Newsletter.js +2 -2
  53. package/lib/Types/Socket.d.ts +6 -7
  54. package/lib/Types/index.js +1 -1
  55. package/lib/Utils/auth-utils.d.ts +1 -1
  56. package/lib/Utils/auth-utils.js +12 -5
  57. package/lib/Utils/business.js +2 -2
  58. package/lib/Utils/chat-utils.d.ts +13 -11
  59. package/lib/Utils/chat-utils.js +2 -28
  60. package/lib/Utils/crypto.d.ts +16 -14
  61. package/lib/Utils/crypto.js +22 -34
  62. package/lib/Utils/decode-wa-message.d.ts +2 -4
  63. package/lib/Utils/decode-wa-message.js +24 -160
  64. package/lib/Utils/event-buffer.js +6 -4
  65. package/lib/Utils/generics.d.ts +12 -40
  66. package/lib/Utils/generics.js +25 -103
  67. package/lib/Utils/link-preview.js +1 -34
  68. package/lib/Utils/lt-hash.d.ts +3 -3
  69. package/lib/Utils/lt-hash.js +45 -11
  70. package/lib/Utils/make-mutex.d.ts +2 -2
  71. package/lib/Utils/messages-media.d.ts +16 -26
  72. package/lib/Utils/messages-media.js +26 -102
  73. package/lib/Utils/messages.d.ts +8 -5
  74. package/lib/Utils/messages.js +15 -17
  75. package/lib/Utils/noise-handler.d.ts +8 -5
  76. package/lib/Utils/noise-handler.js +10 -5
  77. package/lib/Utils/process-message.js +2 -2
  78. package/lib/Utils/use-multi-file-auth-state.js +11 -48
  79. package/lib/Utils/validate-connection.d.ts +3 -2
  80. package/lib/Utils/validate-connection.js +44 -10
  81. package/lib/WABinary/constants.js +5 -5
  82. package/lib/WABinary/decode.d.ts +4 -2
  83. package/lib/WABinary/decode.js +7 -17
  84. package/lib/WABinary/encode.d.ts +3 -1
  85. package/lib/WABinary/encode.js +17 -40
  86. package/lib/WABinary/generic-utils.d.ts +3 -1
  87. package/lib/WABinary/generic-utils.js +2 -2
  88. package/lib/WABinary/jid-utils.d.ts +3 -8
  89. package/lib/WABinary/jid-utils.js +2 -23
  90. package/lib/WAM/BinaryInfo.d.ts +12 -2
  91. package/lib/WAM/constants.d.ts +2 -3
  92. package/lib/WAM/encode.d.ts +3 -1
  93. package/lib/WAM/encode.js +2 -2
  94. package/lib/WAUSync/Protocols/USyncContactProtocol.js +2 -2
  95. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +2 -2
  96. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +2 -2
  97. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +5 -5
  98. package/lib/WAUSync/USyncQuery.d.ts +0 -2
  99. package/lib/WAUSync/USyncQuery.js +13 -27
  100. package/lib/WAUSync/USyncUser.d.ts +0 -2
  101. package/lib/WAUSync/USyncUser.js +0 -4
  102. package/package.json +60 -55
  103. package/LICENSE +0 -21
  104. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +0 -25
  105. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +0 -53
  106. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +0 -8
  107. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +0 -24
  108. /package/lib/Socket/Client/{types.js → abstract-socket-client.js} +0 -0
@@ -19,7 +19,7 @@ const makeMessagesSocket = (config) => {
19
19
  const sock = (0, newsletter_1.makeNewsletterSocket)(config);
20
20
  const { ev, authState, processingMutex, signalRepository, upsertMessage, query, fetchPrivacySettings, sendNode, groupMetadata, groupToggleEphemeral, } = sock;
21
21
  const userDevicesCache = config.userDevicesCache || new node_cache_1.default({
22
- stdTTL: Defaults_1.DEFAULT_CACHE_TTLS.USER_DEVICES, // 5 minutes
22
+ stdTTL: Defaults_1.DEFAULT_CACHE_TTLS.USER_DEVICES,
23
23
  useClones: false
24
24
  });
25
25
  let mediaConn;
@@ -139,7 +139,9 @@ const makeMessagesSocket = (config) => {
139
139
  if (!toFetch.length) {
140
140
  return deviceResults;
141
141
  }
142
- const query = new WAUSync_1.USyncQuery().withContext('message').withDeviceProtocol();
142
+ const query = new WAUSync_1.USyncQuery()
143
+ .withContext('message')
144
+ .withDeviceProtocol();
143
145
  for (const jid of toFetch) {
144
146
  query.withUser(new WAUSync_1.USyncUser().withId(jid));
145
147
  }
@@ -156,7 +158,6 @@ const makeMessagesSocket = (config) => {
156
158
  userDevicesCache.set(key, deviceMap[key]);
157
159
  }
158
160
  }
159
- logger.debug(deviceResults);
160
161
  return deviceResults;
161
162
  };
162
163
  const assertSessions = async (jids, force) => {
@@ -225,17 +226,10 @@ const makeMessagesSocket = (config) => {
225
226
  return msgId;
226
227
  };
227
228
  const createParticipantNodes = async (jids, message, extraAttrs) => {
228
- let patched = await patchMessageBeforeSending(message, jids);
229
- if (!Array.isArray(patched)) {
230
- patched = jids ? jids.map(jid => ({ recipientJid: jid, ...patched })) : [patched];
231
- }
229
+ const patched = await patchMessageBeforeSending(message, jids);
230
+ const bytes = (0, Utils_1.encodeWAMessage)(patched);
232
231
  let shouldIncludeDeviceIdentity = false;
233
- const nodes = await Promise.all(patched.map(async (patchedMessageWithJid) => {
234
- const { recipientJid: jid, ...patchedMessage } = patchedMessageWithJid;
235
- if (!jid) {
236
- return {};
237
- }
238
- const bytes = (0, Utils_1.encodeWAMessage)(patchedMessage);
232
+ const nodes = await Promise.all(jids.map(async (jid) => {
239
233
  const { type, ciphertext } = await signalRepository
240
234
  .encryptMessage({ jid, data: bytes });
241
235
  if (type === 'pkmsg') {
@@ -265,7 +259,7 @@ const makeMessagesSocket = (config) => {
265
259
  const { user, server } = (0, WABinary_1.jidDecode)(jid);
266
260
  const statusJid = 'status@broadcast';
267
261
  const isGroup = server === 'g.us';
268
- const isNewsletter = server === 'newsletter';
262
+ const isNewsletter = server == 'newsletter';
269
263
  const isStatus = jid === statusJid;
270
264
  const isLid = server === 'lid';
271
265
  msgId = msgId || (0, Utils_1.generateMessageIDV2)((_a = sock.user) === null || _a === void 0 ? void 0 : _a.id);
@@ -326,20 +320,10 @@ const makeMessagesSocket = (config) => {
326
320
  if (isStatus && statusJidList) {
327
321
  participantsList.push(...statusJidList);
328
322
  }
329
- if (!isStatus) {
330
- additionalAttributes = {
331
- ...additionalAttributes,
332
- // eslint-disable-next-line camelcase
333
- addressing_mode: (groupData === null || groupData === void 0 ? void 0 : groupData.addressingMode) || 'pn'
334
- };
335
- }
336
323
  const additionalDevices = await getUSyncDevices(participantsList, !!useUserDevicesCache, false);
337
324
  devices.push(...additionalDevices);
338
325
  }
339
- const patched = await patchMessageBeforeSending(message);
340
- if (Array.isArray(patched)) {
341
- throw new boom_1.Boom('Per-jid patching is not supported in groups');
342
- }
326
+ const patched = await patchMessageBeforeSending(message, devices.map(d => (0, WABinary_1.jidEncode)(d.user, isLid ? 'lid' : 's.whatsapp.net', d.device)));
343
327
  const bytes = (0, Utils_1.encodeWAMessage)(patched);
344
328
  const { ciphertext, senderKeyDistributionMessage } = await signalRepository.encryptGroupMessage({
345
329
  group: destinationJid,
@@ -349,7 +333,7 @@ const makeMessagesSocket = (config) => {
349
333
  const senderKeyJids = [];
350
334
  // ensure a connection is established with every device
351
335
  for (const { user, device } of devices) {
352
- const jid = (0, WABinary_1.jidEncode)(user, (groupData === null || groupData === void 0 ? void 0 : groupData.addressingMode) === 'lid' ? 'lid' : 's.whatsapp.net', device);
336
+ const jid = (0, WABinary_1.jidEncode)(user, isLid ? 'lid' : 's.whatsapp.net', device);
353
337
  if (!senderKeyMap[jid] || !!participant) {
354
338
  senderKeyJids.push(jid);
355
339
  // store that this person has had the sender keys sent to them
@@ -390,9 +374,6 @@ const makeMessagesSocket = (config) => {
390
374
  message = {};
391
375
  }
392
376
  const patched = await patchMessageBeforeSending(message, []);
393
- if (Array.isArray(patched)) {
394
- throw new boom_1.Boom('Per-jid patching is not supported in channel');
395
- }
396
377
  const bytes = (0, Utils_1.encodeNewsletterMessage)(patched);
397
378
  binaryNodeContent.push({
398
379
  tag: 'plaintext',
@@ -401,13 +382,14 @@ const makeMessagesSocket = (config) => {
401
382
  });
402
383
  }
403
384
  else {
404
- const { user: meUser } = (0, WABinary_1.jidDecode)(meId);
385
+ const { user: meUser, device: meDevice } = (0, WABinary_1.jidDecode)(meId);
405
386
  if (!participant) {
406
387
  devices.push({ user });
407
- if (user !== meUser) {
408
- devices.push({ user: meUser });
409
- }
410
- if ((additionalAttributes === null || additionalAttributes === void 0 ? void 0 : additionalAttributes['category']) !== 'peer') {
388
+ // do not send message to self if the device is 0 (mobile)
389
+ if (!((additionalAttributes === null || additionalAttributes === void 0 ? void 0 : additionalAttributes['category']) === 'peer' && user === meUser)) {
390
+ if (meDevice !== undefined && meDevice !== 0) {
391
+ devices.push({ user: meUser });
392
+ }
411
393
  const additionalDevices = await getUSyncDevices([meId, jid], !!useUserDevicesCache, true);
412
394
  devices.push(...additionalDevices);
413
395
  }
@@ -740,9 +722,6 @@ const makeMessagesSocket = (config) => {
740
722
  await groupToggleEphemeral(jid, value);
741
723
  }
742
724
  else {
743
- if (jid.endsWith('@bot')) {
744
- jid = (0, WABinary_1.getBotJid)(jid);
745
- }
746
725
  let mediaHandle;
747
726
  const fullMsg = await (0, Utils_1.generateWAMessage)(jid, content, {
748
727
  logger,
@@ -1,3 +1,5 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
1
3
  import { SocketConfig, WAMediaUpload, NewsletterMetadata, NewsletterReactionMode, NewsletterViewRole, NewsletterFetchedUpdate } from '../Types';
2
4
  import { BinaryNode } from '../WABinary';
3
5
  export declare const makeNewsletterSocket: (config: SocketConfig) => {
@@ -13,8 +15,8 @@ export declare const makeNewsletterSocket: (config: SocketConfig) => {
13
15
  newsletterFollow: (jid: string) => Promise<void>;
14
16
  newsletterUnmute: (jid: string) => Promise<void>;
15
17
  newsletterMute: (jid: string) => Promise<void>;
16
- newsletterCreate: (name: string, description?: string, picture?: WAMediaUpload) => Promise<NewsletterMetadata>;
17
- newsletterMetadata: (type: "invite" | "jid", key: string, role?: NewsletterViewRole) => Promise<NewsletterMetadata>;
18
+ newsletterCreate: (name: string, description: string) => Promise<NewsletterMetadata>;
19
+ newsletterMetadata: (type: 'invite' | 'jid', key: string, role?: NewsletterViewRole) => Promise<NewsletterMetadata>;
18
20
  newsletterAdminCount: (jid: string) => Promise<number>;
19
21
  /**user is Lid, not Jid */
20
22
  newsletterChangeOwner: (jid: string, user: string) => Promise<void>;
@@ -23,7 +25,7 @@ export declare const makeNewsletterSocket: (config: SocketConfig) => {
23
25
  newsletterDelete: (jid: string) => Promise<void>;
24
26
  /**if code wasn't passed, the reaction will be removed (if is reacted) */
25
27
  newsletterReactMessage: (jid: string, server_id: string, code?: string) => Promise<void>;
26
- newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number) => Promise<NewsletterFetchedUpdate[]>;
28
+ newsletterFetchMessages: (type: 'invite' | 'jid', key: string, count: number, after?: number) => Promise<NewsletterFetchedUpdate[]>;
27
29
  newsletterFetchUpdates: (jid: string, count: number, after?: number, since?: number) => Promise<NewsletterFetchedUpdate[]>;
28
30
  groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>;
29
31
  groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>;
@@ -32,7 +34,7 @@ export declare const makeNewsletterSocket: (config: SocketConfig) => {
32
34
  groupRequestParticipantsList: (jid: string) => Promise<{
33
35
  [key: string]: string;
34
36
  }[]>;
35
- groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "approve" | "reject") => Promise<{
37
+ groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "reject" | "approve") => Promise<{
36
38
  status: string;
37
39
  jid: string;
38
40
  }[]>;
@@ -41,43 +43,39 @@ export declare const makeNewsletterSocket: (config: SocketConfig) => {
41
43
  jid: string;
42
44
  content: BinaryNode;
43
45
  }[]>;
44
- groupUpdateDescription: (jid: string, description?: string) => Promise<void>;
46
+ groupUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>;
45
47
  groupInviteCode: (jid: string) => Promise<string | undefined>;
46
48
  groupRevokeInvite: (jid: string) => Promise<string | undefined>;
47
49
  groupAcceptInvite: (code: string) => Promise<string | undefined>;
48
50
  groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>;
49
- groupAcceptInviteV4: (key: string | import("../Types").WAMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<any>;
51
+ groupAcceptInviteV4: (key: string | import("../Types").WAMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<string>;
50
52
  groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>;
51
53
  groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
52
- groupSettingUpdate: (jid: string, setting: "announcement" | "not_announcement" | "locked" | "unlocked") => Promise<void>;
53
- groupMemberAddMode: (jid: string, mode: "admin_add" | "all_member_add") => Promise<void>;
54
+ groupSettingUpdate: (jid: string, setting: "announcement" | "locked" | "not_announcement" | "unlocked") => Promise<void>;
55
+ groupMemberAddMode: (jid: string, mode: "all_member_add" | "admin_add") => Promise<void>;
54
56
  groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
55
57
  groupFetchAllParticipating: () => Promise<{
56
58
  [_: string]: import("../Types").GroupMetadata;
57
59
  }>;
58
- getBotListV2: () => Promise<import("../Types").BotListInfo[]>;
59
60
  processingMutex: {
60
- mutex<T>(code: () => Promise<T> | T): Promise<T>;
61
+ mutex<T>(code: () => T | Promise<T>): Promise<T>;
61
62
  };
62
63
  fetchPrivacySettings: (force?: boolean) => Promise<{
63
64
  [_: string]: string;
64
65
  }>;
65
66
  upsertMessage: (msg: import("../Types").WAProto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>;
66
67
  appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
67
- sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string) => Promise<void>;
68
- presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
69
- profilePictureUrl: (jid: string, type?: "preview" | "image", timeoutMs?: number) => Promise<string | undefined>;
68
+ sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string | undefined) => Promise<void>;
69
+ presenceSubscribe: (toJid: string, tcToken?: Buffer | undefined) => Promise<void>;
70
+ profilePictureUrl: (jid: string, type?: "image" | "preview", timeoutMs?: number | undefined) => Promise<string | undefined>;
70
71
  onWhatsApp: (...jids: string[]) => Promise<{
71
72
  jid: string;
72
73
  exists: unknown;
73
- lid: unknown;
74
74
  }[] | undefined>;
75
75
  fetchBlocklist: () => Promise<string[]>;
76
- fetchDisappearingDuration: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>;
77
- fetchStatus: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>;
76
+ fetchDisappearingDuration: (...jids: string[]) => Promise<import("../index").USyncQueryResultList[] | undefined>;
77
+ fetchStatus: (...jids: string[]) => Promise<import("../index").USyncQueryResultList[] | undefined>;
78
78
  updateProfilePicture: (jid: string, content: WAMediaUpload) => Promise<void>;
79
- updateProfilePictureFull: (jid: string, content: WAMediaUpload) => Promise<void>;
80
- updateProfilePictureFull2: (jid: string, content: WAMediaUpload) => Promise<void>;
81
79
  removeProfilePicture: (jid: string) => Promise<void>;
82
80
  updateProfileStatus: (status: string) => Promise<void>;
83
81
  updateProfileName: (name: string) => Promise<void>;
@@ -91,29 +89,26 @@ export declare const makeNewsletterSocket: (config: SocketConfig) => {
91
89
  updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
92
90
  updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyGroupAddValue) => Promise<void>;
93
91
  updateDefaultDisappearingMode: (duration: number) => Promise<void>;
94
- getBusinessProfile: (jid: string) => Promise<import("../Types").WABusinessProfile | void>;
92
+ getBusinessProfile: (jid: string) => Promise<void | import("../Types").WABusinessProfile>;
95
93
  resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
96
94
  chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
97
- cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
98
- addOrEditContact: (jid: string, contact: import("../Types").ContactAction) => Promise<void>;
99
- removeContact: (jid: string) => Promise<void>;
100
- addLabel: (jid: string, labels: import("../Types/Label").LabelActionBody) => Promise<void>;
95
+ cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>;
101
96
  addChatLabel: (jid: string, labelId: string) => Promise<void>;
102
97
  removeChatLabel: (jid: string, labelId: string) => Promise<void>;
103
98
  addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
104
99
  removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
105
100
  star: (jid: string, messages: {
106
101
  id: string;
107
- fromMe?: boolean;
102
+ fromMe?: boolean | undefined;
108
103
  }[], star: boolean) => Promise<void>;
109
- executeUSyncQuery: (usyncQuery: import("..").USyncQuery) => Promise<import("..").USyncQueryResult | undefined>;
104
+ executeUSyncQuery: (usyncQuery: import("../index").USyncQuery) => Promise<import("../index").USyncQueryResult | undefined>;
110
105
  type: "md";
111
- ws: import("./Client").WebSocketClient;
106
+ ws: any;
112
107
  ev: import("../Types").BaileysEventEmitter & {
113
- process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void);
108
+ process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
114
109
  buffer(): void;
115
- createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
116
- flush(force?: boolean): boolean;
110
+ createBufferedFunction<A extends any[], T_1>(work: (...args: A) => Promise<T_1>): (...args: A) => Promise<T_1>;
111
+ flush(force?: boolean | undefined): boolean;
117
112
  isBuffering(): boolean;
118
113
  };
119
114
  authState: {
@@ -123,18 +118,18 @@ export declare const makeNewsletterSocket: (config: SocketConfig) => {
123
118
  signalRepository: import("../Types").SignalRepository;
124
119
  user: import("../Types").Contact | undefined;
125
120
  generateMessageTag: () => string;
126
- query: (node: BinaryNode, timeoutMs?: number) => Promise<any>;
127
- waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<any>;
121
+ query: (node: BinaryNode, timeoutMs?: number | undefined) => Promise<BinaryNode>;
122
+ waitForMessage: <T_2>(msgId: string, timeoutMs?: number | undefined) => Promise<T_2>;
128
123
  waitForSocketOpen: () => Promise<void>;
129
124
  sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
130
125
  sendNode: (frame: BinaryNode) => Promise<void>;
131
- logout: (msg?: string) => Promise<void>;
126
+ logout: (msg?: string | undefined) => Promise<void>;
132
127
  end: (error: Error | undefined) => void;
133
- onUnexpectedError: (err: Error | import("@hapi/boom").Boom, msg: string) => void;
128
+ onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void;
134
129
  uploadPreKeys: (count?: number) => Promise<void>;
135
130
  uploadPreKeysToServerIfRequired: () => Promise<void>;
136
131
  requestPairingCode: (phoneNumber: string, pairCode: string) => Promise<string>;
137
- waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
138
- sendWAMBuffer: (wamBuffer: Buffer) => Promise<any>;
132
+ waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number | undefined) => Promise<void>;
133
+ sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>;
139
134
  };
140
135
  export declare const extractNewsletterMetadata: (node: BinaryNode, isCreate?: boolean) => NewsletterMetadata;
@@ -45,12 +45,7 @@ const makeNewsletterSocket = (config) => {
45
45
  {
46
46
  tag: 'query',
47
47
  attrs: { query_id },
48
- content: encoder.encode(JSON.stringify({
49
- variables: {
50
- 'newsletter_id': jid,
51
- ...content
52
- }
53
- }))
48
+ content: encoder.encode(JSON.stringify({ variables: { newsletter_id: jid, ...content } }))
54
49
  }
55
50
  ]
56
51
  }));
@@ -65,21 +60,30 @@ const makeNewsletterSocket = (config) => {
65
60
  return await Promise.all((0, WABinary_1.getAllBinaryNodeChildren)(child).map(async (messageNode) => {
66
61
  var _a, _b;
67
62
  messageNode.attrs.from = child === null || child === void 0 ? void 0 : child.attrs.jid;
68
- const views = parseInt(((_b = (_a = (0, WABinary_1.getBinaryNodeChild)(messageNode, 'views_count')) === null || _a === void 0 ? void 0 : _a.attrs) === null || _b === void 0 ? void 0 : _b.count) || '0');
63
+ const views = (_b = (_a = (0, WABinary_1.getBinaryNodeChild)(messageNode, 'views_count')) === null || _a === void 0 ? void 0 : _a.attrs) === null || _b === void 0 ? void 0 : _b.count;
69
64
  const reactionNode = (0, WABinary_1.getBinaryNodeChild)(messageNode, 'reactions');
70
65
  const reactions = (0, WABinary_1.getBinaryNodeChildren)(reactionNode, 'reaction')
71
66
  .map(({ attrs }) => ({ count: +attrs.count, code: attrs.code }));
72
- const data = {
73
- 'server_id': messageNode.attrs.server_id,
74
- views,
75
- reactions
76
- };
67
+ let data;
77
68
  if (type === 'messages') {
78
- const { fullMessage: message, decrypt } = await (0, Utils_1.decryptMessageNode)(messageNode, authState.creds.me.id, authState.creds.me.lid || '', signalRepository, config.logger, config.getMessage);
69
+ const { fullMessage: message, decrypt } = await (0, Utils_1.decryptMessageNode)(messageNode, authState.creds.me.id, authState.creds.me.lid || '', signalRepository, config.logger);
79
70
  await decrypt();
80
- data.message = message;
71
+ data = {
72
+ server_id: messageNode.attrs.server_id,
73
+ views: views ? +views : undefined,
74
+ reactions,
75
+ message
76
+ };
77
+ return data;
78
+ }
79
+ else {
80
+ data = {
81
+ server_id: messageNode.attrs.server_id,
82
+ views: views ? +views : undefined,
83
+ reactions
84
+ };
85
+ return data;
81
86
  }
82
- return data;
83
87
  }));
84
88
  };
85
89
  return {
@@ -127,7 +131,7 @@ const makeNewsletterSocket = (config) => {
127
131
  newsletterMute: async (jid) => {
128
132
  await newsletterWMexQuery(jid, QueryIds.MUTE);
129
133
  },
130
- newsletterCreate: async (name, description, picture) => {
134
+ newsletterCreate: async (name, description) => {
131
135
  await query({
132
136
  tag: 'iq',
133
137
  attrs: {
@@ -148,14 +152,7 @@ const makeNewsletterSocket = (config) => {
148
152
  ]
149
153
  });
150
154
  const result = await newsletterWMexQuery(undefined, QueryIds.CREATE, {
151
- input: {
152
- name,
153
- description: description !== null && description !== void 0 ? description : null,
154
- picture: picture ? (await (0, Utils_1.generateProfilePicture)(picture)).img.toString('base64') : null,
155
- settings: {
156
- reaction_codes: { value: 'ALL' }
157
- }
158
- }
155
+ input: { name, description }
159
156
  });
160
157
  return (0, exports.extractNewsletterMetadata)(result, true);
161
158
  },
@@ -205,11 +202,10 @@ const makeNewsletterSocket = (config) => {
205
202
  });
206
203
  },
207
204
  newsletterFetchMessages: async (type, key, count, after) => {
208
- const afterStr = after === null || after === void 0 ? void 0 : after.toString();
209
205
  const result = await newsletterQuery(WABinary_1.S_WHATSAPP_NET, 'get', [
210
206
  {
211
207
  tag: 'messages',
212
- attrs: { type, ...(type === 'invite' ? { key } : { jid: key }), count: count.toString(), after: afterStr || '100' }
208
+ attrs: { type, ...(type === 'invite' ? { key } : { jid: key }), count: count.toString(), after: (after === null || after === void 0 ? void 0 : after.toString()) || '100' }
213
209
  }
214
210
  ]);
215
211
  return await parseFetchedUpdates(result, 'messages');
@@ -0,0 +1,271 @@
1
+ /// <reference types="long" />
2
+ /// <reference types="node" />
3
+ /// <reference types="node" />
4
+ import { AxiosRequestConfig } from 'axios';
5
+ import { KeyPair, SignedKeyPair, SocketConfig } from '../Types';
6
+ export declare const makeRegistrationSocket: (config: SocketConfig) => {
7
+ register: (code: string) => Promise<ExistsResponse>;
8
+ requestRegistrationCode: (registrationOptions?: RegistrationOptions) => Promise<ExistsResponse>;
9
+ logger: import("../Utils/logger").ILogger;
10
+ getOrderDetails: (orderId: string, tokenBase64: string) => Promise<import("../Types").OrderDetails>;
11
+ getCatalog: ({ jid, limit, cursor }: import("../Types").GetCatalogOptions) => Promise<{
12
+ products: import("../Types").Product[];
13
+ nextPageCursor: string | undefined;
14
+ }>;
15
+ getCollections: (jid?: string | undefined, limit?: number) => Promise<{
16
+ collections: import("../Types").CatalogCollection[];
17
+ }>;
18
+ productCreate: (create: import("../Types").ProductCreate) => Promise<import("../Types").Product>;
19
+ productDelete: (productIds: string[]) => Promise<{
20
+ deleted: number;
21
+ }>;
22
+ productUpdate: (productId: string, update: import("../Types").ProductUpdate) => Promise<import("../Types").Product>;
23
+ sendMessageAck: ({ tag, attrs, content }: import("../WABinary").BinaryNode, errorCode?: number | undefined) => Promise<void>;
24
+ sendRetryRequest: (node: import("../WABinary").BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
25
+ rejectCall: (callId: string, callFrom: string) => Promise<void>;
26
+ offerCall: (toJid: string, isVideo?: boolean) => Promise<{
27
+ callId: string;
28
+ toJid: string;
29
+ isVideo: boolean;
30
+ }>;
31
+ fetchMessageHistory: (count: number, oldestMsgKey: import("../Types").WAMessageKey, oldestMsgTimestamp: number | import("long").Long) => Promise<string>;
32
+ requestPlaceholderResend: (messageKey: import("../Types").WAMessageKey) => Promise<string | undefined>;
33
+ getPrivacyTokens: (jids: string[]) => Promise<import("../WABinary").BinaryNode>;
34
+ assertSessions: (jids: string[], force: boolean) => Promise<boolean>;
35
+ relayMessage: (jid: string, message: import("../Types").WAProto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, useCachedGroupMetadata, statusJidList }: import("../Types").MessageRelayOptions) => Promise<string>;
36
+ sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../Types").MessageReceiptType) => Promise<void>;
37
+ sendReceipts: (keys: import("../Types").WAMessageKey[], type: import("../Types").MessageReceiptType) => Promise<void>;
38
+ getButtonArgs: (message: import("../Types").WAProto.IMessage) => {
39
+ [key: string]: string;
40
+ };
41
+ readMessages: (keys: import("../Types").WAMessageKey[]) => Promise<void>;
42
+ refreshMediaConn: (forceGet?: boolean) => Promise<import("../Types").MediaConnInfo>;
43
+ waUploadToServer: import("../Types").WAMediaUploadFunction;
44
+ fetchPrivacySettings: (force?: boolean) => Promise<{
45
+ [_: string]: string;
46
+ }>;
47
+ getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<import("../WABinary").JidWithDevice[]>;
48
+ createParticipantNodes: (jids: string[], message: import("../Types").WAProto.IMessage, extraAttrs?: {
49
+ [key: string]: string;
50
+ } | undefined) => Promise<{
51
+ nodes: import("../WABinary").BinaryNode[];
52
+ shouldIncludeDeviceIdentity: boolean;
53
+ }>;
54
+ sendPeerDataOperationMessage: (pdoMessage: import("../Types").WAProto.Message.IPeerDataOperationRequestMessage) => Promise<string>;
55
+ updateMediaMessage: (message: import("../Types").WAProto.IWebMessageInfo) => Promise<import("../Types").WAProto.IWebMessageInfo>;
56
+ sendMessage: (jid: string, content: import("../Types").AnyMessageContent, options?: import("../Types").MiscMessageGenerationOptions) => Promise<import("../Types").WAProto.WebMessageInfo | undefined>;
57
+ subscribeNewsletterUpdates: (jid: string) => Promise<{
58
+ duration: string;
59
+ }>;
60
+ newsletterReactionMode: (jid: string, mode: import("../Types").NewsletterReactionMode) => Promise<void>;
61
+ newsletterUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>;
62
+ newsletterUpdateName: (jid: string, name: string) => Promise<void>;
63
+ newsletterUpdatePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
64
+ newsletterRemovePicture: (jid: string) => Promise<void>;
65
+ newsletterUnfollow: (jid: string) => Promise<void>;
66
+ newsletterFollow: (jid: string) => Promise<void>;
67
+ newsletterUnmute: (jid: string) => Promise<void>;
68
+ newsletterMute: (jid: string) => Promise<void>;
69
+ newsletterCreate: (name: string, description: string) => Promise<import("../Types").NewsletterMetadata>;
70
+ newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole | undefined) => Promise<import("../Types").NewsletterMetadata>;
71
+ newsletterAdminCount: (jid: string) => Promise<number>;
72
+ newsletterChangeOwner: (jid: string, user: string) => Promise<void>;
73
+ newsletterDemote: (jid: string, user: string) => Promise<void>;
74
+ newsletterDelete: (jid: string) => Promise<void>;
75
+ newsletterReactMessage: (jid: string, server_id: string, code?: string | undefined) => Promise<void>;
76
+ newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number | undefined) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
77
+ newsletterFetchUpdates: (jid: string, count: number, after?: number | undefined, since?: number | undefined) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
78
+ groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>;
79
+ groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>;
80
+ groupLeave: (id: string) => Promise<void>;
81
+ groupUpdateSubject: (jid: string, subject: string) => Promise<void>;
82
+ groupRequestParticipantsList: (jid: string) => Promise<{
83
+ [key: string]: string;
84
+ }[]>;
85
+ groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "reject" | "approve") => Promise<{
86
+ status: string;
87
+ jid: string;
88
+ }[]>;
89
+ groupParticipantsUpdate: (jid: string, participants: string[], action: import("../Types").ParticipantAction) => Promise<{
90
+ status: string;
91
+ jid: string;
92
+ content: import("../WABinary").BinaryNode;
93
+ }[]>;
94
+ groupUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>;
95
+ groupInviteCode: (jid: string) => Promise<string | undefined>;
96
+ groupRevokeInvite: (jid: string) => Promise<string | undefined>;
97
+ groupAcceptInvite: (code: string) => Promise<string | undefined>;
98
+ groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>;
99
+ groupAcceptInviteV4: (key: string | import("../Types").WAMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<string>;
100
+ groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>;
101
+ groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
102
+ groupSettingUpdate: (jid: string, setting: "announcement" | "locked" | "not_announcement" | "unlocked") => Promise<void>;
103
+ groupMemberAddMode: (jid: string, mode: "all_member_add" | "admin_add") => Promise<void>;
104
+ groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
105
+ groupFetchAllParticipating: () => Promise<{
106
+ [_: string]: import("../Types").GroupMetadata;
107
+ }>;
108
+ processingMutex: {
109
+ mutex<T>(code: () => T | Promise<T>): Promise<T>;
110
+ };
111
+ upsertMessage: (msg: import("../Types").WAProto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>;
112
+ appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
113
+ sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string | undefined) => Promise<void>;
114
+ presenceSubscribe: (toJid: string, tcToken?: Buffer | undefined) => Promise<void>;
115
+ profilePictureUrl: (jid: string, type?: "image" | "preview", timeoutMs?: number | undefined) => Promise<string | undefined>;
116
+ onWhatsApp: (...jids: string[]) => Promise<{
117
+ jid: string;
118
+ exists: unknown;
119
+ }[] | undefined>;
120
+ fetchBlocklist: () => Promise<string[]>;
121
+ fetchDisappearingDuration: (...jids: string[]) => Promise<import("../index").USyncQueryResultList[] | undefined>;
122
+ fetchStatus: (...jids: string[]) => Promise<import("../index").USyncQueryResultList[] | undefined>;
123
+ updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
124
+ removeProfilePicture: (jid: string) => Promise<void>;
125
+ updateProfileStatus: (status: string) => Promise<void>;
126
+ updateProfileName: (name: string) => Promise<void>;
127
+ updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
128
+ updateCallPrivacy: (value: import("../Types").WAPrivacyCallValue) => Promise<void>;
129
+ updateMessagesPrivacy: (value: import("../Types").WAPrivacyMessagesValue) => Promise<void>;
130
+ updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
131
+ updateOnlinePrivacy: (value: import("../Types").WAPrivacyOnlineValue) => Promise<void>;
132
+ updateProfilePicturePrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
133
+ updateStatusPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
134
+ updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
135
+ updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyGroupAddValue) => Promise<void>;
136
+ updateDefaultDisappearingMode: (duration: number) => Promise<void>;
137
+ getBusinessProfile: (jid: string) => Promise<void | import("../Types").WABusinessProfile>;
138
+ resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
139
+ chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
140
+ cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>;
141
+ addChatLabel: (jid: string, labelId: string) => Promise<void>;
142
+ removeChatLabel: (jid: string, labelId: string) => Promise<void>;
143
+ addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
144
+ removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
145
+ star: (jid: string, messages: {
146
+ id: string;
147
+ fromMe?: boolean | undefined;
148
+ }[], star: boolean) => Promise<void>;
149
+ executeUSyncQuery: (usyncQuery: import("../index").USyncQuery) => Promise<import("../index").USyncQueryResult | undefined>;
150
+ type: "md";
151
+ ws: any;
152
+ ev: import("../Types").BaileysEventEmitter & {
153
+ process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
154
+ buffer(): void;
155
+ createBufferedFunction<A extends any[], T_1>(work: (...args: A) => Promise<T_1>): (...args: A) => Promise<T_1>;
156
+ flush(force?: boolean | undefined): boolean;
157
+ isBuffering(): boolean;
158
+ };
159
+ authState: {
160
+ creds: import("../Types").AuthenticationCreds;
161
+ keys: import("../Types").SignalKeyStoreWithTransaction;
162
+ };
163
+ signalRepository: import("../Types").SignalRepository;
164
+ user: import("../Types").Contact | undefined;
165
+ generateMessageTag: () => string;
166
+ query: (node: import("../WABinary").BinaryNode, timeoutMs?: number | undefined) => Promise<import("../WABinary").BinaryNode>;
167
+ waitForMessage: <T_2>(msgId: string, timeoutMs?: number | undefined) => Promise<T_2>;
168
+ waitForSocketOpen: () => Promise<void>;
169
+ sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
170
+ sendNode: (frame: import("../WABinary").BinaryNode) => Promise<void>;
171
+ logout: (msg?: string | undefined) => Promise<void>;
172
+ end: (error: Error | undefined) => void;
173
+ onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void;
174
+ uploadPreKeys: (count?: number) => Promise<void>;
175
+ uploadPreKeysToServerIfRequired: () => Promise<void>;
176
+ requestPairingCode: (phoneNumber: string, pairCode: string) => Promise<string>;
177
+ waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number | undefined) => Promise<void>;
178
+ sendWAMBuffer: (wamBuffer: Buffer) => Promise<import("../WABinary").BinaryNode>;
179
+ };
180
+ export interface RegistrationData {
181
+ registrationId: number;
182
+ signedPreKey: SignedKeyPair;
183
+ noiseKey: KeyPair;
184
+ signedIdentityKey: KeyPair;
185
+ identityId: Buffer;
186
+ phoneId: string;
187
+ deviceId: string;
188
+ backupToken: Buffer;
189
+ }
190
+ export interface RegistrationOptions {
191
+ /** your phone number */
192
+ phoneNumber?: string;
193
+ /** the country code of your phone number */
194
+ phoneNumberCountryCode: string;
195
+ /** your phone number without country code */
196
+ phoneNumberNationalNumber: string;
197
+ /** the country code of your mobile network
198
+ * @see {@link https://de.wikipedia.org/wiki/Mobile_Country_Code}
199
+ */
200
+ phoneNumberMobileCountryCode: string;
201
+ /** the network code of your mobile network
202
+ * @see {@link https://de.wikipedia.org/wiki/Mobile_Network_Code}
203
+ */
204
+ phoneNumberMobileNetworkCode: string;
205
+ /**
206
+ * How to send the one time code
207
+ */
208
+ method?: 'sms' | 'voice' | 'captcha';
209
+ /**
210
+ * The captcha code if it was requested
211
+ */
212
+ captcha?: string;
213
+ }
214
+ export type RegistrationParams = RegistrationData & RegistrationOptions;
215
+ export declare function registrationParams(params: RegistrationParams): {
216
+ cc: string;
217
+ in: string;
218
+ Rc: string;
219
+ lg: string;
220
+ lc: string;
221
+ mistyped: string;
222
+ authkey: string;
223
+ e_regid: string;
224
+ e_keytype: string;
225
+ e_ident: string;
226
+ e_skey_id: string;
227
+ e_skey_val: string;
228
+ e_skey_sig: string;
229
+ fdid: string;
230
+ network_ratio_type: string;
231
+ expid: string;
232
+ simnum: string;
233
+ hasinrc: string;
234
+ pid: string;
235
+ id: string;
236
+ backup_token: string;
237
+ token: string;
238
+ fraud_checkpoint_code: string | undefined;
239
+ };
240
+ /**
241
+ * Requests a registration code for the given phone number.
242
+ */
243
+ export declare function mobileRegisterCode(params: RegistrationParams, fetchOptions?: AxiosRequestConfig): Promise<ExistsResponse>;
244
+ export declare function mobileRegisterExists(params: RegistrationParams, fetchOptions?: AxiosRequestConfig): Promise<ExistsResponse>;
245
+ /**
246
+ * Registers the phone number on whatsapp with the received OTP code.
247
+ */
248
+ export declare function mobileRegister(params: RegistrationParams & {
249
+ code: string;
250
+ }, fetchOptions?: AxiosRequestConfig): Promise<ExistsResponse>;
251
+ /**
252
+ * Encrypts the given string as AEAD aes-256-gcm with the public whatsapp key and a random keypair.
253
+ */
254
+ export declare function mobileRegisterEncrypt(data: string): string;
255
+ export declare function mobileRegisterFetch(path: string, opts?: AxiosRequestConfig): Promise<ExistsResponse>;
256
+ export interface ExistsResponse {
257
+ status: 'fail' | 'sent';
258
+ voice_length?: number;
259
+ voice_wait?: number;
260
+ sms_length?: number;
261
+ sms_wait?: number;
262
+ reason?: 'incorrect' | 'missing_param' | 'code_checkpoint';
263
+ login?: string;
264
+ flash_type?: number;
265
+ ab_hash?: string;
266
+ ab_key?: string;
267
+ exp_cfg?: string;
268
+ lid?: string;
269
+ image_blob?: string;
270
+ audio_blob?: string;
271
+ }