@d0v3riz/baileys 6.7.6 → 6.7.8

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 (73) hide show
  1. package/README.md +0 -10
  2. package/lib/Defaults/baileys-version.json +1 -1
  3. package/lib/Defaults/index.d.ts +1 -231
  4. package/lib/Defaults/index.js +1 -17
  5. package/lib/Socket/Client/index.d.ts +2 -3
  6. package/lib/Socket/Client/index.js +2 -3
  7. package/lib/Socket/Client/{web-socket-client.d.ts → websocket.d.ts} +1 -1
  8. package/lib/Socket/Client/{web-socket-client.js → websocket.js} +2 -2
  9. package/lib/Socket/business.d.ts +10 -1
  10. package/lib/Socket/chats.d.ts +4 -1
  11. package/lib/Socket/chats.js +39 -11
  12. package/lib/Socket/groups.d.ts +3 -1
  13. package/lib/Socket/index.d.ts +17 -10
  14. package/lib/Socket/index.js +2 -2
  15. package/lib/Socket/messages-recv.d.ts +11 -2
  16. package/lib/Socket/messages-recv.js +127 -118
  17. package/lib/Socket/messages-send.d.ts +9 -2
  18. package/lib/Socket/messages-send.js +26 -9
  19. package/lib/Socket/socket.d.ts +3 -1
  20. package/lib/Socket/socket.js +9 -14
  21. package/lib/Store/make-cache-manager-store.d.ts +2 -1
  22. package/lib/Store/make-in-memory-store.js +8 -10
  23. package/lib/Store/make-ordered-dictionary.js +2 -2
  24. package/lib/Types/Auth.d.ts +1 -6
  25. package/lib/Types/Call.d.ts +1 -1
  26. package/lib/Types/Chat.d.ts +10 -7
  27. package/lib/Types/Contact.d.ts +1 -1
  28. package/lib/Types/Events.d.ts +4 -0
  29. package/lib/Types/Label.d.ts +11 -0
  30. package/lib/Types/Message.d.ts +5 -2
  31. package/lib/Types/Socket.d.ts +3 -3
  32. package/lib/Utils/auth-utils.js +1 -7
  33. package/lib/Utils/chat-utils.d.ts +5 -4
  34. package/lib/Utils/chat-utils.js +41 -20
  35. package/lib/Utils/crypto.d.ts +1 -0
  36. package/lib/Utils/decode-wa-message.js +1 -0
  37. package/lib/Utils/event-buffer.js +14 -8
  38. package/lib/Utils/generics.d.ts +10 -5
  39. package/lib/Utils/generics.js +35 -7
  40. package/lib/Utils/history.d.ts +2 -2
  41. package/lib/Utils/history.js +1 -1
  42. package/lib/Utils/link-preview.js +24 -1
  43. package/lib/Utils/make-mutex.js +1 -0
  44. package/lib/Utils/messages-media.d.ts +2 -1
  45. package/lib/Utils/messages-media.js +8 -15
  46. package/lib/Utils/messages.d.ts +1 -0
  47. package/lib/Utils/messages.js +7 -11
  48. package/lib/Utils/noise-handler.d.ts +2 -2
  49. package/lib/Utils/noise-handler.js +5 -10
  50. package/lib/Utils/process-message.js +3 -1
  51. package/lib/Utils/signal.js +2 -0
  52. package/lib/Utils/use-multi-file-auth-state.js +1 -0
  53. package/lib/Utils/validate-connection.d.ts +0 -1
  54. package/lib/Utils/validate-connection.js +10 -44
  55. package/lib/WABinary/constants.js +5 -5
  56. package/lib/WABinary/decode.d.ts +1 -0
  57. package/lib/WABinary/encode.d.ts +1 -0
  58. package/lib/WABinary/encode.js +7 -5
  59. package/lib/WABinary/generic-utils.d.ts +1 -0
  60. package/lib/WABinary/jid-utils.d.ts +2 -2
  61. package/lib/WABinary/jid-utils.js +1 -1
  62. package/lib/WAM/BinaryInfo.d.ts +3 -2
  63. package/lib/WAM/constants.d.ts +3 -2
  64. package/lib/WAM/encode.d.ts +1 -0
  65. package/lib/WAM/encode.js +2 -2
  66. package/package.json +5 -6
  67. package/lib/Defaults/phonenumber-mcc.json +0 -223
  68. package/lib/Socket/Client/mobile-socket-client.d.ts +0 -13
  69. package/lib/Socket/Client/mobile-socket-client.js +0 -65
  70. package/lib/Socket/registration.d.ts +0 -234
  71. package/lib/Socket/registration.js +0 -166
  72. /package/lib/Socket/Client/{abstract-socket-client.d.ts → types.d.ts} +0 -0
  73. /package/lib/Socket/Client/{abstract-socket-client.js → types.js} +0 -0
@@ -1,223 +0,0 @@
1
- {
2
- "93": 412,
3
- "355": 276,
4
- "213": 603,
5
- "1-684": 544,
6
- "376": 213,
7
- "244": 631,
8
- "1-264": 365,
9
- "1-268": 344,
10
- "54": 722,
11
- "374": 283,
12
- "297": 363,
13
- "61": 505,
14
- "43": 232,
15
- "994": 400,
16
- "1-242": 364,
17
- "973": 426,
18
- "880": 470,
19
- "1-246": 342,
20
- "375": 257,
21
- "32": 206,
22
- "501": 702,
23
- "229": 616,
24
- "1-441": 350,
25
- "975": 402,
26
- "591": 736,
27
- "387": 218,
28
- "267": 652,
29
- "55": 724,
30
- "1-284": 348,
31
- "673": 528,
32
- "359": 284,
33
- "226": 613,
34
- "257": 642,
35
- "855": 456,
36
- "237": 624,
37
- "238": 625,
38
- "1-345": 346,
39
- "236": 623,
40
- "235": 622,
41
- "56": 730,
42
- "86": 454,
43
- "57": 732,
44
- "269": 654,
45
- "682": 548,
46
- "506": 712,
47
- "385": 219,
48
- "53": 368,
49
- "357": 280,
50
- "420": 230,
51
- "243": 630,
52
- "45": 238,
53
- "253": 638,
54
- "1-767": 366,
55
- "1-809": 370,
56
- "1-849": 370,
57
- "1-829": 370,
58
- "593": 740,
59
- "20": 602,
60
- "503": 706,
61
- "240": 627,
62
- "291": 657,
63
- "372": 248,
64
- "251": 636,
65
- "500": 750,
66
- "298": 288,
67
- "679": 542,
68
- "358": 244,
69
- "33": 208,
70
- "689": 547,
71
- "241": 628,
72
- "220": 607,
73
- "995": 282,
74
- "49": 262,
75
- "233": 620,
76
- "350": 266,
77
- "30": 202,
78
- "299": 290,
79
- "1-473": 352,
80
- "1-671": 535,
81
- "502": 704,
82
- "224": 537,
83
- "592": 738,
84
- "509": 372,
85
- "504": 708,
86
- "852": 454,
87
- "36": 216,
88
- "354": 274,
89
- "91": 404,
90
- "62": 510,
91
- "98": 432,
92
- "964": 418,
93
- "353": 234,
94
- "972": 425,
95
- "39": 222,
96
- "225": 612,
97
- "1-876": 338,
98
- "81": 440,
99
- "962": 416,
100
- "254": 639,
101
- "686": 545,
102
- "383": 221,
103
- "965": 419,
104
- "371": 247,
105
- "961": 415,
106
- "266": 651,
107
- "231": 618,
108
- "218": 606,
109
- "423": 295,
110
- "370": 246,
111
- "352": 270,
112
- "389": 294,
113
- "261": 646,
114
- "265": 650,
115
- "60": 502,
116
- "960": 472,
117
- "223": 610,
118
- "356": 278,
119
- "692": 551,
120
- "222": 609,
121
- "230": 617,
122
- "52": 334,
123
- "691": 550,
124
- "373": 259,
125
- "377": 212,
126
- "976": 428,
127
- "382": 297,
128
- "1-664": 354,
129
- "212": 604,
130
- "258": 643,
131
- "95": 414,
132
- "264": 649,
133
- "674": 536,
134
- "977": 429,
135
- "31": 204,
136
- "687": 546,
137
- "64": 530,
138
- "505": 710,
139
- "227": 614,
140
- "234": 621,
141
- "683": 555,
142
- "1-670": 534,
143
- "47": 242,
144
- "968": 226,
145
- "92": 410,
146
- "680": 552,
147
- "970": 423,
148
- "507": 714,
149
- "675": 537,
150
- "595": 744,
151
- "51": 716,
152
- "63": 515,
153
- "48": 260,
154
- "351": 268,
155
- "1-787, 1-939": 330,
156
- "974": 427,
157
- "242": 630,
158
- "40": 226,
159
- "7": 250,
160
- "250": 635,
161
- "290": 658,
162
- "1-869": 356,
163
- "1-758": 358,
164
- "508": 308,
165
- "1-784": 360,
166
- "685": 544,
167
- "378": 292,
168
- "239": 626,
169
- "966": 420,
170
- "221": 608,
171
- "381": 220,
172
- "248": 633,
173
- "232": 619,
174
- "65": 525,
175
- "386": 293,
176
- "677": 540,
177
- "27": 655,
178
- "211": 659,
179
- "34": 214,
180
- "94": 413,
181
- "249": 634,
182
- "597": 746,
183
- "268": 653,
184
- "46": 240,
185
- "41": 228,
186
- "963": 417,
187
- "886": 466,
188
- "992": 436,
189
- "255": 640,
190
- "66": 520,
191
- "228": 615,
192
- "690": 554,
193
- "676": 539,
194
- "1-868": 374,
195
- "216": 605,
196
- "90": 286,
197
- "993": 438,
198
- "1-649": 376,
199
- "688": 553,
200
- "1-340": 332,
201
- "256": 641,
202
- "380": 255,
203
- "971": 424,
204
- "44": 234,
205
- "1": 310,
206
- "598": 748,
207
- "998": 434,
208
- "678": 541,
209
- "379": 225,
210
- "58": 734,
211
- "681": 543,
212
- "967": 421,
213
- "260": 645,
214
- "263": 648,
215
- "670": 514,
216
- "245": 632,
217
- "856": 457,
218
- "599": 362,
219
- "850": 467,
220
- "262": 647,
221
- "82": 450,
222
- "84": 452
223
- }
@@ -1,13 +0,0 @@
1
- /// <reference types="node" />
2
- import { Socket } from 'net';
3
- import { AbstractSocketClient } from './abstract-socket-client';
4
- export declare class MobileSocketClient extends AbstractSocketClient {
5
- protected socket: Socket | null;
6
- get isOpen(): boolean;
7
- get isClosed(): boolean;
8
- get isClosing(): boolean;
9
- get isConnecting(): boolean;
10
- connect(): Promise<void>;
11
- close(): Promise<void>;
12
- send(str: string | Uint8Array, cb?: (err?: Error) => void): boolean;
13
- }
@@ -1,65 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MobileSocketClient = void 0;
4
- const net_1 = require("net");
5
- const abstract_socket_client_1 = require("./abstract-socket-client");
6
- class MobileSocketClient extends abstract_socket_client_1.AbstractSocketClient {
7
- constructor() {
8
- super(...arguments);
9
- this.socket = null;
10
- }
11
- get isOpen() {
12
- var _a;
13
- return ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === 'open';
14
- }
15
- get isClosed() {
16
- var _a;
17
- return this.socket === null || ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === 'closed';
18
- }
19
- get isClosing() {
20
- var _a;
21
- return this.socket === null || ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === 'closed';
22
- }
23
- get isConnecting() {
24
- var _a;
25
- return ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === 'opening';
26
- }
27
- async connect() {
28
- var _a;
29
- if (this.socket) {
30
- return;
31
- }
32
- if (this.config.agent) {
33
- throw new Error('There are not support for proxy agent for mobile connection');
34
- }
35
- else {
36
- this.socket = (0, net_1.connect)({
37
- host: this.url.hostname,
38
- port: Number(this.url.port) || 443
39
- });
40
- }
41
- this.socket.setMaxListeners(0);
42
- const events = ['close', 'connect', 'data', 'drain', 'end', 'error', 'lookup', 'ready', 'timeout'];
43
- for (const event of events) {
44
- (_a = this.socket) === null || _a === void 0 ? void 0 : _a.on(event, (...args) => this.emit(event, ...args));
45
- }
46
- this.socket.on('data', (...args) => this.emit('message', ...args));
47
- this.socket.on('ready', (...args) => this.emit('open', ...args));
48
- }
49
- async close() {
50
- if (!this.socket) {
51
- return;
52
- }
53
- return new Promise(resolve => {
54
- this.socket.end(resolve);
55
- this.socket = null;
56
- });
57
- }
58
- send(str, cb) {
59
- if (this.socket === null) {
60
- return false;
61
- }
62
- return this.socket.write(str, undefined, cb);
63
- }
64
- }
65
- exports.MobileSocketClient = MobileSocketClient;
@@ -1,234 +0,0 @@
1
- /// <reference types="long" />
2
- /// <reference types="node" />
3
- import { AxiosRequestConfig } from 'axios';
4
- import { KeyPair, SignedKeyPair, SocketConfig } from '../Types';
5
- export declare const makeRegistrationSocket: (config: SocketConfig) => {
6
- register: (code: string) => Promise<ExistsResponse>;
7
- requestRegistrationCode: (registrationOptions?: RegistrationOptions) => Promise<ExistsResponse>;
8
- logger: import("pino").Logger<import("pino").LoggerOptions>;
9
- getOrderDetails: (orderId: string, tokenBase64: string) => Promise<import("../Types").OrderDetails>;
10
- getCatalog: ({ jid, limit, cursor }: import("../Types").GetCatalogOptions) => Promise<{
11
- products: import("../Types").Product[];
12
- nextPageCursor: string | undefined;
13
- }>;
14
- getCollections: (jid?: string | undefined, limit?: number) => Promise<{
15
- collections: import("../Types").CatalogCollection[];
16
- }>;
17
- productCreate: (create: import("../Types").ProductCreate) => Promise<import("../Types").Product>;
18
- productDelete: (productIds: string[]) => Promise<{
19
- deleted: number;
20
- }>;
21
- productUpdate: (productId: string, update: import("../Types").ProductUpdate) => Promise<import("../Types").Product>;
22
- sendMessageAck: ({ tag, attrs, content }: import("../WABinary").BinaryNode) => Promise<void>;
23
- sendRetryRequest: (node: import("../WABinary").BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
24
- rejectCall: (callId: string, callFrom: string) => Promise<void>;
25
- fetchMessageHistory: (count: number, oldestMsgKey: import("../Types").WAProto.IMessageKey, oldestMsgTimestamp: number | import("long").Long) => Promise<string>;
26
- requestPlaceholderResend: (messageKey: import("../Types").WAProto.IMessageKey) => Promise<string | undefined>;
27
- getPrivacyTokens: (jids: string[]) => Promise<import("../WABinary").BinaryNode>;
28
- assertSessions: (jids: string[], force: boolean) => Promise<boolean>;
29
- relayMessage: (jid: string, message: import("../Types").WAProto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, useCachedGroupMetadata, statusJidList }: import("../Types").MessageRelayOptions) => Promise<string>;
30
- sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../Types").MessageReceiptType) => Promise<void>;
31
- sendReceipts: (keys: import("../Types").WAProto.IMessageKey[], type: import("../Types").MessageReceiptType) => Promise<void>;
32
- readMessages: (keys: import("../Types").WAProto.IMessageKey[]) => Promise<void>;
33
- refreshMediaConn: (forceGet?: boolean) => Promise<import("../Types").MediaConnInfo>;
34
- waUploadToServer: import("../Types").WAMediaUploadFunction;
35
- fetchPrivacySettings: (force?: boolean) => Promise<{
36
- [_: string]: string;
37
- }>;
38
- sendPeerDataOperationMessage: (pdoMessage: import("../Types").WAProto.Message.IPeerDataOperationRequestMessage) => Promise<string>;
39
- updateMediaMessage: (message: import("../Types").WAProto.IWebMessageInfo) => Promise<import("../Types").WAProto.IWebMessageInfo>;
40
- sendMessage: (jid: string, content: import("../Types").AnyMessageContent, options?: import("../Types").MiscMessageGenerationOptions) => Promise<import("../Types").WAProto.WebMessageInfo | undefined>;
41
- groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>;
42
- groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>;
43
- groupLeave: (id: string) => Promise<void>;
44
- groupUpdateSubject: (jid: string, subject: string) => Promise<void>;
45
- groupRequestParticipantsList: (jid: string) => Promise<{
46
- [key: string]: string;
47
- }[]>;
48
- groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "reject" | "approve") => Promise<{
49
- status: string;
50
- jid: string;
51
- }[]>;
52
- groupParticipantsUpdate: (jid: string, participants: string[], action: import("../Types").ParticipantAction) => Promise<{
53
- status: string;
54
- jid: string;
55
- content: import("../WABinary").BinaryNode;
56
- }[]>;
57
- groupUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>;
58
- groupInviteCode: (jid: string) => Promise<string | undefined>;
59
- groupRevokeInvite: (jid: string) => Promise<string | undefined>;
60
- groupAcceptInvite: (code: string) => Promise<string | undefined>;
61
- groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>;
62
- groupAcceptInviteV4: (key: string | import("../Types").WAProto.IMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<string>;
63
- groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>;
64
- groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
65
- groupSettingUpdate: (jid: string, setting: "announcement" | "locked" | "not_announcement" | "unlocked") => Promise<void>;
66
- groupMemberAddMode: (jid: string, mode: "all_member_add" | "admin_add") => Promise<void>;
67
- groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
68
- groupFetchAllParticipating: () => Promise<{
69
- [_: string]: import("../Types").GroupMetadata;
70
- }>;
71
- processingMutex: {
72
- mutex<T>(code: () => T | Promise<T>): Promise<T>;
73
- };
74
- upsertMessage: (msg: import("../Types").WAProto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>;
75
- appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
76
- sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string | undefined) => Promise<void>;
77
- presenceSubscribe: (toJid: string, tcToken?: Buffer | undefined) => Promise<void>;
78
- profilePictureUrl: (jid: string, type?: "image" | "preview", timeoutMs?: number | undefined) => Promise<string | undefined>;
79
- onWhatsApp: (...jids: string[]) => Promise<{
80
- exists: boolean;
81
- jid: string;
82
- }[]>;
83
- fetchBlocklist: () => Promise<string[]>;
84
- fetchStatus: (jid: string) => Promise<{
85
- status: string | undefined;
86
- setAt: Date;
87
- } | undefined>;
88
- updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
89
- removeProfilePicture: (jid: string) => Promise<void>;
90
- updateProfileStatus: (status: string) => Promise<void>;
91
- updateProfileName: (name: string) => Promise<void>;
92
- updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
93
- updateCallPrivacy: (value: import("../Types").WAPrivacyCallValue) => Promise<void>;
94
- updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
95
- updateOnlinePrivacy: (value: import("../Types").WAPrivacyOnlineValue) => Promise<void>;
96
- updateProfilePicturePrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
97
- updateStatusPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
98
- updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
99
- updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyGroupAddValue) => Promise<void>;
100
- updateDefaultDisappearingMode: (duration: number) => Promise<void>;
101
- getBusinessProfile: (jid: string) => Promise<void | import("../Types").WABusinessProfile>;
102
- resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
103
- chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
104
- cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>;
105
- addChatLabel: (jid: string, labelId: string) => Promise<void>;
106
- removeChatLabel: (jid: string, labelId: string) => Promise<void>;
107
- addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
108
- removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
109
- star: (jid: string, messages: {
110
- id: string;
111
- fromMe?: boolean | undefined;
112
- }[], star: boolean) => Promise<void>;
113
- type: "md";
114
- ws: any;
115
- ev: import("../Types").BaileysEventEmitter & {
116
- process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
117
- buffer(): void;
118
- createBufferedFunction<A extends any[], T_1>(work: (...args: A) => Promise<T_1>): (...args: A) => Promise<T_1>;
119
- flush(force?: boolean | undefined): boolean;
120
- isBuffering(): boolean;
121
- };
122
- authState: {
123
- creds: import("../Types").AuthenticationCreds;
124
- keys: import("../Types").SignalKeyStoreWithTransaction;
125
- };
126
- signalRepository: import("../Types").SignalRepository;
127
- user: import("../Types").Contact | undefined;
128
- generateMessageTag: () => string;
129
- query: (node: import("../WABinary").BinaryNode, timeoutMs?: number | undefined) => Promise<import("../WABinary").BinaryNode>;
130
- waitForMessage: <T_2>(msgId: string, timeoutMs?: number | undefined) => Promise<T_2>;
131
- waitForSocketOpen: () => Promise<void>;
132
- sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
133
- sendNode: (frame: import("../WABinary").BinaryNode) => Promise<void>;
134
- logout: (msg?: string | undefined) => Promise<void>;
135
- end: (error: Error | undefined) => void;
136
- onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void;
137
- uploadPreKeys: (count?: number) => Promise<void>;
138
- uploadPreKeysToServerIfRequired: () => Promise<void>;
139
- requestPairingCode: (phoneNumber: string) => Promise<string>;
140
- waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
141
- sendWAMBuffer: (wamBuffer: Buffer) => Promise<import("../WABinary").BinaryNode>;
142
- };
143
- export interface RegistrationData {
144
- registrationId: number;
145
- signedPreKey: SignedKeyPair;
146
- noiseKey: KeyPair;
147
- signedIdentityKey: KeyPair;
148
- identityId: Buffer;
149
- phoneId: string;
150
- deviceId: string;
151
- backupToken: Buffer;
152
- }
153
- export interface RegistrationOptions {
154
- /** your phone number */
155
- phoneNumber?: string;
156
- /** the country code of your phone number */
157
- phoneNumberCountryCode: string;
158
- /** your phone number without country code */
159
- phoneNumberNationalNumber: string;
160
- /** the country code of your mobile network
161
- * @see {@link https://de.wikipedia.org/wiki/Mobile_Country_Code}
162
- */
163
- phoneNumberMobileCountryCode: string;
164
- /** the network code of your mobile network
165
- * @see {@link https://de.wikipedia.org/wiki/Mobile_Network_Code}
166
- */
167
- phoneNumberMobileNetworkCode: string;
168
- /**
169
- * How to send the one time code
170
- */
171
- method?: 'sms' | 'voice' | 'captcha';
172
- /**
173
- * The captcha code if it was requested
174
- */
175
- captcha?: string;
176
- }
177
- export type RegistrationParams = RegistrationData & RegistrationOptions;
178
- export declare function registrationParams(params: RegistrationParams): {
179
- cc: string;
180
- in: string;
181
- Rc: string;
182
- lg: string;
183
- lc: string;
184
- mistyped: string;
185
- authkey: string;
186
- e_regid: string;
187
- e_keytype: string;
188
- e_ident: string;
189
- e_skey_id: string;
190
- e_skey_val: string;
191
- e_skey_sig: string;
192
- fdid: string;
193
- network_ratio_type: string;
194
- expid: string;
195
- simnum: string;
196
- hasinrc: string;
197
- pid: string;
198
- id: string;
199
- backup_token: string;
200
- token: string;
201
- fraud_checkpoint_code: string | undefined;
202
- };
203
- /**
204
- * Requests a registration code for the given phone number.
205
- */
206
- export declare function mobileRegisterCode(params: RegistrationParams, fetchOptions?: AxiosRequestConfig): Promise<ExistsResponse>;
207
- export declare function mobileRegisterExists(params: RegistrationParams, fetchOptions?: AxiosRequestConfig): Promise<ExistsResponse>;
208
- /**
209
- * Registers the phone number on whatsapp with the received OTP code.
210
- */
211
- export declare function mobileRegister(params: RegistrationParams & {
212
- code: string;
213
- }, fetchOptions?: AxiosRequestConfig): Promise<ExistsResponse>;
214
- /**
215
- * Encrypts the given string as AEAD aes-256-gcm with the public whatsapp key and a random keypair.
216
- */
217
- export declare function mobileRegisterEncrypt(data: string): string;
218
- export declare function mobileRegisterFetch(path: string, opts?: AxiosRequestConfig): Promise<ExistsResponse>;
219
- export interface ExistsResponse {
220
- status: 'fail' | 'sent';
221
- voice_length?: number;
222
- voice_wait?: number;
223
- sms_length?: number;
224
- sms_wait?: number;
225
- reason?: 'incorrect' | 'missing_param' | 'code_checkpoint';
226
- login?: string;
227
- flash_type?: number;
228
- ab_hash?: string;
229
- ab_key?: string;
230
- exp_cfg?: string;
231
- lid?: string;
232
- image_blob?: string;
233
- audio_blob?: string;
234
- }