@neelegirl/baileys 1.5.2 → 1.5.3
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.
- package/LICENSE +21 -21
- package/README.md +195 -187
- package/WAProto/WAProto.proto +537 -236
- package/WAProto/index.d.ts +5971 -2388
- package/WAProto/index.js +17298 -6513
- package/lib/Defaults/baileys-version.json +3 -3
- package/lib/Defaults/index.d.ts +77 -67
- package/lib/Defaults/index.js +148 -136
- package/lib/Defaults/phonenumber-mcc.json +223 -223
- package/lib/Signal/WASignalGroup/GroupProtocol.js +1908 -1908
- package/lib/Signal/WASignalGroup/ciphertext-message.d.ts +9 -0
- package/lib/Signal/WASignalGroup/ciphertext-message.js +19 -0
- package/lib/Signal/WASignalGroup/ciphertext_message.js +15 -15
- package/lib/Signal/WASignalGroup/group-session-builder.d.ts +17 -0
- package/lib/Signal/WASignalGroup/group-session-builder.js +72 -0
- package/lib/Signal/WASignalGroup/group.proto +41 -41
- package/lib/Signal/WASignalGroup/group_cipher.d.ts +19 -0
- package/lib/Signal/WASignalGroup/group_cipher.js +101 -110
- package/lib/Signal/WASignalGroup/group_session_builder.js +45 -45
- package/lib/Signal/WASignalGroup/index.d.ts +11 -0
- package/lib/Signal/WASignalGroup/index.js +61 -6
- package/lib/Signal/WASignalGroup/keyhelper.d.ts +16 -0
- package/lib/Signal/WASignalGroup/keyhelper.js +58 -13
- package/lib/Signal/WASignalGroup/protobufs.js +2 -2
- package/lib/Signal/WASignalGroup/queue_job.js +68 -68
- package/lib/Signal/WASignalGroup/readme.md +5 -5
- package/lib/Signal/WASignalGroup/sender-chain-key.d.ts +14 -0
- package/lib/Signal/WASignalGroup/sender-chain-key.js +47 -0
- package/lib/Signal/WASignalGroup/sender-key-distribution-message.d.ts +17 -0
- package/lib/Signal/WASignalGroup/sender-key-distribution-message.js +71 -0
- package/lib/Signal/WASignalGroup/sender-key-message.d.ts +19 -0
- package/lib/Signal/WASignalGroup/sender-key-message.js +73 -0
- package/lib/Signal/WASignalGroup/sender-key-name.d.ts +19 -0
- package/lib/Signal/WASignalGroup/sender-key-name.js +59 -0
- package/lib/Signal/WASignalGroup/sender-key-record.d.ts +32 -0
- package/lib/Signal/WASignalGroup/sender-key-record.js +58 -0
- package/lib/Signal/WASignalGroup/sender-key-state.d.ts +44 -0
- package/lib/Signal/WASignalGroup/sender-key-state.js +147 -0
- package/lib/Signal/WASignalGroup/sender-message-key.d.ts +11 -0
- package/lib/Signal/WASignalGroup/sender-message-key.js +33 -0
- package/lib/Signal/WASignalGroup/sender_chain_key.js +49 -49
- package/lib/Signal/WASignalGroup/sender_key_distribution_message.js +77 -77
- package/lib/Signal/WASignalGroup/sender_key_message.js +91 -91
- package/lib/Signal/WASignalGroup/sender_key_name.js +69 -69
- package/lib/Signal/WASignalGroup/sender_key_record.js +55 -55
- package/lib/Signal/WASignalGroup/sender_key_state.js +128 -128
- package/lib/Signal/WASignalGroup/sender_message_key.js +38 -38
- package/lib/Signal/libsignal.d.ts +5 -1
- package/lib/Signal/libsignal.js +390 -161
- package/lib/Signal/lid-mapping.d.ts +28 -0
- package/lib/Signal/lid-mapping.js +184 -0
- package/lib/Socket/Client/abstract-socket-client.d.ts +15 -15
- package/lib/Socket/Client/abstract-socket-client.js +13 -13
- package/lib/Socket/Client/index.d.ts +2 -2
- package/lib/Socket/Client/mobile-socket-client.d.ts +12 -12
- package/lib/Socket/Client/mobile-socket-client.js +65 -65
- package/lib/Socket/Client/types.d.ts +1 -1
- package/lib/Socket/Client/websocket.d.ts +1 -1
- package/lib/Socket/business.d.ts +6 -6
- package/lib/Socket/business.js +152 -5
- package/lib/Socket/chats.d.ts +3 -4
- package/lib/Socket/chats.js +31 -26
- package/lib/Socket/communities.d.ts +223 -223
- package/lib/Socket/communities.js +432 -432
- package/lib/Socket/groups.d.ts +2 -4
- package/lib/Socket/groups.js +22 -14
- package/lib/Socket/index.d.ts +69 -69
- package/lib/Socket/index.js +3 -2
- package/lib/Socket/messages-recv.d.ts +3 -6
- package/lib/Socket/messages-recv.js +1449 -1707
- package/lib/Socket/messages-send.d.ts +2 -4
- package/lib/Socket/messages-send.js +617 -126
- package/lib/Socket/mex.d.ts +2 -2
- package/lib/Socket/mex.js +46 -46
- package/lib/Socket/newsletter.d.ts +2 -4
- package/lib/Socket/newsletter.js +294 -285
- package/lib/Socket/socket.js +318 -132
- package/lib/Socket/usync.js +3 -3
- package/lib/Store/index.d.ts +4 -4
- package/lib/Store/index.js +23 -23
- package/lib/Store/make-cache-manager-store.d.ts +13 -13
- package/lib/Store/make-cache-manager-store.js +89 -89
- package/lib/Store/make-in-memory-store.d.ts +122 -122
- package/lib/Store/make-in-memory-store.js +428 -428
- package/lib/Store/make-ordered-dictionary.d.ts +11 -11
- package/lib/Store/make-ordered-dictionary.js +85 -85
- package/lib/Store/object-repository.d.ts +9 -9
- package/lib/Store/object-repository.js +30 -30
- package/lib/Types/Auth.d.ts +5 -4
- package/lib/Types/Bussines.js +3 -0
- package/lib/Types/Bussiness.d.ts +28 -0
- package/lib/Types/Chat.d.ts +13 -8
- package/lib/Types/Contact.d.ts +4 -1
- package/lib/Types/Events.d.ts +13 -16
- package/lib/Types/GroupMetadata.d.ts +1 -1
- package/lib/Types/Message.d.ts +18 -7
- package/lib/Types/Message.js +7 -1
- package/lib/Types/MexUpdates.d.ts +8 -8
- package/lib/Types/MexUpdates.js +17 -17
- package/lib/Types/Newsletter.d.ts +1 -1
- package/lib/Types/Product.d.ts +1 -1
- package/lib/Types/Signal.d.ts +31 -1
- package/lib/Types/Socket.d.ts +34 -13
- package/lib/Types/State.d.ts +1 -1
- package/lib/Types/USync.d.ts +2 -2
- package/lib/Types/index.d.ts +16 -15
- package/lib/Types/index.js +4 -2
- package/lib/Utils/auth-utils.d.ts +20 -20
- package/lib/Utils/auth-utils.js +527 -204
- package/lib/Utils/baileys-event-stream.d.ts +17 -17
- package/lib/Utils/baileys-event-stream.js +69 -69
- package/lib/Utils/business.d.ts +28 -28
- package/lib/Utils/business.js +254 -254
- package/lib/Utils/chat-utils.d.ts +81 -81
- package/lib/Utils/chat-utils.js +808 -780
- package/lib/Utils/crypto.d.ts +55 -55
- package/lib/Utils/crypto.js +188 -178
- package/lib/Utils/decode-wa-message.d.ts +52 -40
- package/lib/Utils/decode-wa-message.js +322 -252
- package/lib/Utils/event-buffer.d.ts +38 -38
- package/lib/Utils/event-buffer.js +594 -564
- package/lib/Utils/generics.d.ts +131 -129
- package/lib/Utils/generics.js +629 -623
- package/lib/Utils/history.d.ts +22 -22
- package/lib/Utils/history.js +103 -109
- package/lib/Utils/index.d.ts +20 -19
- package/lib/Utils/index.js +39 -38
- package/lib/Utils/link-preview.d.ts +22 -22
- package/lib/Utils/link-preview.js +119 -119
- package/lib/Utils/logger.d.ts +13 -13
- package/lib/Utils/logger.js +7 -7
- package/lib/Utils/lt-hash.d.ts +13 -13
- package/lib/Utils/lt-hash.js +57 -57
- package/lib/Utils/make-mutex.d.ts +8 -8
- package/lib/Utils/make-mutex.js +48 -48
- package/lib/Utils/message-retry-manager.d.ts +88 -0
- package/lib/Utils/message-retry-manager.js +160 -0
- package/lib/Utils/messages-media.d.ts +134 -128
- package/lib/Utils/messages-media.js +868 -805
- package/lib/Utils/messages.d.ts +104 -102
- package/lib/Utils/messages.js +1744 -1578
- package/lib/Utils/noise-handler.d.ts +20 -19
- package/lib/Utils/noise-handler.js +164 -154
- package/lib/Utils/process-message.d.ts +48 -48
- package/lib/Utils/process-message.js +427 -428
- package/lib/Utils/signal.d.ts +41 -41
- package/lib/Utils/signal.js +165 -165
- package/lib/Utils/use-mongo-file-auth-state.d.ts +5 -5
- package/lib/Utils/use-mongo-file-auth-state.js +83 -83
- package/lib/Utils/use-multi-file-auth-state.d.ts +17 -17
- package/lib/Utils/use-multi-file-auth-state.js +237 -237
- package/lib/Utils/use-single-file-auth-state.d.ts +12 -12
- package/lib/Utils/use-single-file-auth-state.js +79 -79
- package/lib/Utils/validate-connection.d.ts +12 -12
- package/lib/Utils/validate-connection.js +219 -186
- package/lib/WABinary/constants.d.ts +29 -29
- package/lib/WABinary/constants.js +1315 -1315
- package/lib/WABinary/decode.d.ts +8 -8
- package/lib/WABinary/decode.js +287 -287
- package/lib/WABinary/encode.d.ts +2 -2
- package/lib/WABinary/encode.js +264 -264
- package/lib/WABinary/generic-utils.d.ts +27 -27
- package/lib/WABinary/generic-utils.js +141 -141
- package/lib/WABinary/index.d.ts +5 -5
- package/lib/WABinary/index.js +24 -24
- package/lib/WABinary/jid-utils.d.ts +58 -53
- package/lib/WABinary/jid-utils.js +103 -91
- package/lib/WABinary/types.d.ts +21 -21
- package/lib/WABinary/types.js +2 -2
- package/lib/WAM/BinaryInfo.d.ts +15 -15
- package/lib/WAM/BinaryInfo.js +16 -16
- package/lib/WAM/constants.d.ts +46 -46
- package/lib/WAM/constants.js +15370 -15370
- package/lib/WAM/encode.d.ts +2 -2
- package/lib/WAM/encode.js +163 -164
- package/lib/WAM/index.d.ts +3 -3
- package/lib/WAM/index.js +22 -22
- package/lib/WAUSync/Protocols/USyncBotProfileProtocol.d.ts +27 -27
- package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +68 -68
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +3 -3
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +2 -2
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +2 -2
- package/lib/WAUSync/Protocols/USyncLIDProtocol.d.ts +9 -8
- package/lib/WAUSync/Protocols/USyncLIDProtocol.js +37 -29
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +2 -2
- package/lib/WAUSync/Protocols/index.d.ts +6 -6
- package/lib/WAUSync/USyncQuery.d.ts +3 -3
- package/lib/WAUSync/index.d.ts +3 -3
- package/lib/index.d.ts +13 -13
- package/lib/index.js +33 -33
- package/package.json +96 -94
- package/lib/Socket/registration.d.ts +0 -266
- package/lib/Socket/registration.js +0 -166
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
import { AxiosRequestConfig } from 'axios';
|
|
2
|
-
import { KeyPair, SignedKeyPair, SocketConfig } from '../Types';
|
|
3
|
-
export declare const makeRegistrationSocket: (config: SocketConfig) => {
|
|
4
|
-
register: (code: string) => Promise<ExistsResponse>;
|
|
5
|
-
requestRegistrationCode: (registrationOptions?: RegistrationOptions) => Promise<ExistsResponse>;
|
|
6
|
-
logger: import("../Utils/logger").ILogger;
|
|
7
|
-
getOrderDetails: (orderId: string, tokenBase64: string) => Promise<import("../Types").OrderDetails>;
|
|
8
|
-
getCatalog: ({ jid, limit, cursor }: import("../Types").GetCatalogOptions) => Promise<{
|
|
9
|
-
products: import("../Types").Product[];
|
|
10
|
-
nextPageCursor: string | undefined;
|
|
11
|
-
}>;
|
|
12
|
-
getCollections: (jid?: string, limit?: number) => Promise<{
|
|
13
|
-
collections: import("../Types").CatalogCollection[];
|
|
14
|
-
}>;
|
|
15
|
-
productCreate: (create: import("../Types").ProductCreate) => Promise<import("../Types").Product>;
|
|
16
|
-
productDelete: (productIds: string[]) => Promise<{
|
|
17
|
-
deleted: number;
|
|
18
|
-
}>;
|
|
19
|
-
productUpdate: (productId: string, update: import("../Types").ProductUpdate) => Promise<import("../Types").Product>;
|
|
20
|
-
sendMessageAck: ({ tag, attrs, content }: import("../WABinary").BinaryNode, errorCode?: number) => Promise<void>;
|
|
21
|
-
sendRetryRequest: (node: import("../WABinary").BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
|
|
22
|
-
rejectCall: (callId: string, callFrom: string) => Promise<void>;
|
|
23
|
-
offerCall: (toJid: string, isVideo?: boolean) => Promise<{
|
|
24
|
-
callId: string;
|
|
25
|
-
toJid: string;
|
|
26
|
-
isVideo: boolean;
|
|
27
|
-
}>;
|
|
28
|
-
fetchMessageHistory: (count: number, oldestMsgKey: import("../Types").WAMessageKey, oldestMsgTimestamp: number | Long) => Promise<string>;
|
|
29
|
-
requestPlaceholderResend: (messageKey: import("../Types").WAMessageKey) => Promise<"RESOLVED" | string | undefined>;
|
|
30
|
-
getPrivacyTokens: (jids: string[]) => Promise<any>;
|
|
31
|
-
assertSessions: (jids: string[], force: boolean) => Promise<boolean>;
|
|
32
|
-
relayMessage: (jid: string, message: import("../Types").WAProto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, useCachedGroupMetadata, statusJidList }: import("../Types").MessageRelayOptions) => Promise<string>;
|
|
33
|
-
sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../Types").MessageReceiptType) => Promise<void>;
|
|
34
|
-
sendReceipts: (keys: import("../Types").WAMessageKey[], type: import("../Types").MessageReceiptType) => Promise<void>;
|
|
35
|
-
readMessages: (keys: import("../Types").WAMessageKey[]) => Promise<void>;
|
|
36
|
-
refreshMediaConn: (forceGet?: boolean) => Promise<import("../Types").MediaConnInfo>;
|
|
37
|
-
waUploadToServer: import("../Types").WAMediaUploadFunction;
|
|
38
|
-
fetchPrivacySettings: (force?: boolean) => Promise<{
|
|
39
|
-
[_: string]: string;
|
|
40
|
-
}>;
|
|
41
|
-
getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<import("../WABinary").JidWithDevice[]>;
|
|
42
|
-
createParticipantNodes: (jids: string[], message: import("../Types").WAProto.IMessage, extraAttrs?: import("../WABinary").BinaryNode["attrs"]) => Promise<{
|
|
43
|
-
nodes: import("../WABinary").BinaryNode[];
|
|
44
|
-
shouldIncludeDeviceIdentity: boolean;
|
|
45
|
-
}>;
|
|
46
|
-
sendPeerDataOperationMessage: (pdoMessage: import("../Types").WAProto.Message.IPeerDataOperationRequestMessage) => Promise<string>;
|
|
47
|
-
updateMediaMessage: (message: import("../Types").WAProto.IWebMessageInfo) => Promise<import("../Types").WAProto.IWebMessageInfo>;
|
|
48
|
-
sendMessage: (jid: string, content: import("../Types").AnyMessageContent, options?: import("../Types").MiscMessageGenerationOptions) => Promise<import("../Types").WAProto.WebMessageInfo | undefined>;
|
|
49
|
-
subscribeNewsletterUpdates: (jid: string) => Promise<{
|
|
50
|
-
duration: string;
|
|
51
|
-
}>;
|
|
52
|
-
newsletterReactionMode: (jid: string, mode: import("../Types").NewsletterReactionMode) => Promise<void>;
|
|
53
|
-
newsletterUpdateDescription: (jid: string, description?: string) => Promise<void>;
|
|
54
|
-
newsletterUpdateName: (jid: string, name: string) => Promise<void>;
|
|
55
|
-
newsletterUpdatePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
56
|
-
newsletterRemovePicture: (jid: string) => Promise<void>;
|
|
57
|
-
newsletterUnfollow: (jid: string) => Promise<void>;
|
|
58
|
-
newsletterFollow: (jid: string) => Promise<void>;
|
|
59
|
-
newsletterUnmute: (jid: string) => Promise<void>;
|
|
60
|
-
newsletterMute: (jid: string) => Promise<void>;
|
|
61
|
-
newsletterCreate: (name: string, description?: string, picture?: import("../Types").WAMediaUpload) => Promise<import("../Types").NewsletterMetadata>;
|
|
62
|
-
newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole) => Promise<import("../Types").NewsletterMetadata>;
|
|
63
|
-
newsletterAdminCount: (jid: string) => Promise<number>;
|
|
64
|
-
newsletterChangeOwner: (jid: string, user: string) => Promise<void>;
|
|
65
|
-
newsletterDemote: (jid: string, user: string) => Promise<void>;
|
|
66
|
-
newsletterDelete: (jid: string) => Promise<void>;
|
|
67
|
-
newsletterReactMessage: (jid: string, server_id: string, code?: string) => Promise<void>;
|
|
68
|
-
newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
|
|
69
|
-
newsletterFetchUpdates: (jid: string, count: number, after?: number, since?: number) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
|
|
70
|
-
groupQuery: (jid: string, type: "get" | "set", content: import("../WABinary").BinaryNode[]) => Promise<any>;
|
|
71
|
-
groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>;
|
|
72
|
-
groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>;
|
|
73
|
-
groupLeave: (id: string) => Promise<void>;
|
|
74
|
-
groupUpdateSubject: (jid: string, subject: string) => Promise<void>;
|
|
75
|
-
groupRequestParticipantsList: (jid: string) => Promise<{
|
|
76
|
-
[key: string]: string;
|
|
77
|
-
}[]>;
|
|
78
|
-
groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "approve" | "reject") => Promise<{
|
|
79
|
-
status: string;
|
|
80
|
-
jid: string;
|
|
81
|
-
}[]>;
|
|
82
|
-
groupParticipantsUpdate: (jid: string, participants: string[], action: import("../Types").ParticipantAction) => Promise<{
|
|
83
|
-
status: string;
|
|
84
|
-
jid: string;
|
|
85
|
-
content: import("../WABinary").BinaryNode;
|
|
86
|
-
}[]>;
|
|
87
|
-
groupUpdateDescription: (jid: string, description?: string) => Promise<void>;
|
|
88
|
-
groupInviteCode: (jid: string) => Promise<string | undefined>;
|
|
89
|
-
groupRevokeInvite: (jid: string) => Promise<string | undefined>;
|
|
90
|
-
groupAcceptInvite: (code: string) => Promise<string | undefined>;
|
|
91
|
-
groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>;
|
|
92
|
-
groupAcceptInviteV4: (key: string | import("../Types").WAMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<any>;
|
|
93
|
-
groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>;
|
|
94
|
-
groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
|
|
95
|
-
groupSettingUpdate: (jid: string, setting: "announcement" | "not_announcement" | "locked" | "unlocked") => Promise<void>;
|
|
96
|
-
groupMemberAddMode: (jid: string, mode: "admin_add" | "all_member_add") => Promise<void>;
|
|
97
|
-
groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
|
|
98
|
-
groupFetchAllParticipating: () => Promise<{
|
|
99
|
-
[_: string]: import("../Types").GroupMetadata;
|
|
100
|
-
}>;
|
|
101
|
-
getBotListV2: () => Promise<import("../Types").BotListInfo[]>;
|
|
102
|
-
processingMutex: {
|
|
103
|
-
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
104
|
-
};
|
|
105
|
-
upsertMessage: (msg: import("../Types").WAProto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>;
|
|
106
|
-
appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
|
|
107
|
-
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string) => Promise<void>;
|
|
108
|
-
presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
|
|
109
|
-
profilePictureUrl: (jid: string, type?: "preview" | "image", timeoutMs?: number) => Promise<string | undefined>;
|
|
110
|
-
onWhatsApp: (...jids: string[]) => Promise<{
|
|
111
|
-
jid: string;
|
|
112
|
-
exists: unknown;
|
|
113
|
-
lid: unknown;
|
|
114
|
-
}[] | undefined>;
|
|
115
|
-
fetchBlocklist: () => Promise<string[]>;
|
|
116
|
-
fetchDisappearingDuration: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>;
|
|
117
|
-
fetchStatus: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>;
|
|
118
|
-
updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
119
|
-
removeProfilePicture: (jid: string) => Promise<void>;
|
|
120
|
-
updateProfileStatus: (status: string) => Promise<void>;
|
|
121
|
-
updateProfileName: (name: string) => Promise<void>;
|
|
122
|
-
updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
|
|
123
|
-
updateCallPrivacy: (value: import("../Types").WAPrivacyCallValue) => Promise<void>;
|
|
124
|
-
updateMessagesPrivacy: (value: import("../Types").WAPrivacyMessagesValue) => Promise<void>;
|
|
125
|
-
updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
126
|
-
updateOnlinePrivacy: (value: import("../Types").WAPrivacyOnlineValue) => Promise<void>;
|
|
127
|
-
updateProfilePicturePrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
128
|
-
updateStatusPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
129
|
-
updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
|
|
130
|
-
updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyGroupAddValue) => Promise<void>;
|
|
131
|
-
updateDefaultDisappearingMode: (duration: number) => Promise<void>;
|
|
132
|
-
getBusinessProfile: (jid: string) => Promise<import("../Types").WABusinessProfile | void>;
|
|
133
|
-
resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
|
|
134
|
-
chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
|
|
135
|
-
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
|
|
136
|
-
addChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
137
|
-
removeChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
138
|
-
addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
139
|
-
removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
140
|
-
star: (jid: string, messages: {
|
|
141
|
-
id: string;
|
|
142
|
-
fromMe?: boolean;
|
|
143
|
-
}[], star: boolean) => Promise<void>;
|
|
144
|
-
executeUSyncQuery: (usyncQuery: import("..").USyncQuery) => Promise<import("..").USyncQueryResult | undefined>;
|
|
145
|
-
type: "md";
|
|
146
|
-
ws: any;
|
|
147
|
-
ev: import("../Types").BaileysEventEmitter & {
|
|
148
|
-
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void);
|
|
149
|
-
buffer(): void;
|
|
150
|
-
createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
|
|
151
|
-
flush(force?: boolean): boolean;
|
|
152
|
-
isBuffering(): boolean;
|
|
153
|
-
};
|
|
154
|
-
authState: {
|
|
155
|
-
creds: import("../Types").AuthenticationCreds;
|
|
156
|
-
keys: import("../Types").SignalKeyStoreWithTransaction;
|
|
157
|
-
};
|
|
158
|
-
signalRepository: import("../Types").SignalRepository;
|
|
159
|
-
user: import("../Types").Contact | undefined;
|
|
160
|
-
generateMessageTag: () => string;
|
|
161
|
-
query: (node: import("../WABinary").BinaryNode, timeoutMs?: number) => Promise<any>;
|
|
162
|
-
waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<any>;
|
|
163
|
-
waitForSocketOpen: () => Promise<void>;
|
|
164
|
-
sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
|
|
165
|
-
sendNode: (frame: import("../WABinary").BinaryNode) => Promise<void>;
|
|
166
|
-
logout: (msg?: string) => Promise<void>;
|
|
167
|
-
end: (error: Error | undefined) => void;
|
|
168
|
-
onUnexpectedError: (err: Error | import("@hapi/boom").Boom, msg: string) => void;
|
|
169
|
-
uploadPreKeys: (count?: number) => Promise<void>;
|
|
170
|
-
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
171
|
-
requestPairingCode: (phoneNumber: string, pairCode: string) => Promise<string>;
|
|
172
|
-
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
|
|
173
|
-
sendWAMBuffer: (wamBuffer: Buffer) => Promise<any>;
|
|
174
|
-
};
|
|
175
|
-
export interface RegistrationData {
|
|
176
|
-
registrationId: number;
|
|
177
|
-
signedPreKey: SignedKeyPair;
|
|
178
|
-
noiseKey: KeyPair;
|
|
179
|
-
signedIdentityKey: KeyPair;
|
|
180
|
-
identityId: Buffer;
|
|
181
|
-
phoneId: string;
|
|
182
|
-
deviceId: string;
|
|
183
|
-
backupToken: Buffer;
|
|
184
|
-
}
|
|
185
|
-
export interface RegistrationOptions {
|
|
186
|
-
/** your phone number */
|
|
187
|
-
phoneNumber?: string;
|
|
188
|
-
/** the country code of your phone number */
|
|
189
|
-
phoneNumberCountryCode: string;
|
|
190
|
-
/** your phone number without country code */
|
|
191
|
-
phoneNumberNationalNumber: string;
|
|
192
|
-
/** the country code of your mobile network
|
|
193
|
-
* @see {@link https://de.wikipedia.org/wiki/Mobile_Country_Code}
|
|
194
|
-
*/
|
|
195
|
-
phoneNumberMobileCountryCode: string;
|
|
196
|
-
/** the network code of your mobile network
|
|
197
|
-
* @see {@link https://de.wikipedia.org/wiki/Mobile_Network_Code}
|
|
198
|
-
*/
|
|
199
|
-
phoneNumberMobileNetworkCode: string;
|
|
200
|
-
/**
|
|
201
|
-
* How to send the one time code
|
|
202
|
-
*/
|
|
203
|
-
method?: 'sms' | 'voice' | 'captcha';
|
|
204
|
-
/**
|
|
205
|
-
* The captcha code if it was requested
|
|
206
|
-
*/
|
|
207
|
-
captcha?: string;
|
|
208
|
-
}
|
|
209
|
-
export type RegistrationParams = RegistrationData & RegistrationOptions;
|
|
210
|
-
export declare function registrationParams(params: RegistrationParams): {
|
|
211
|
-
cc: string;
|
|
212
|
-
in: string;
|
|
213
|
-
Rc: string;
|
|
214
|
-
lg: string;
|
|
215
|
-
lc: string;
|
|
216
|
-
mistyped: string;
|
|
217
|
-
authkey: string;
|
|
218
|
-
e_regid: string;
|
|
219
|
-
e_keytype: string;
|
|
220
|
-
e_ident: string;
|
|
221
|
-
e_skey_id: string;
|
|
222
|
-
e_skey_val: string;
|
|
223
|
-
e_skey_sig: string;
|
|
224
|
-
fdid: string;
|
|
225
|
-
network_ratio_type: string;
|
|
226
|
-
expid: string;
|
|
227
|
-
simnum: string;
|
|
228
|
-
hasinrc: string;
|
|
229
|
-
pid: string;
|
|
230
|
-
id: string;
|
|
231
|
-
backup_token: string;
|
|
232
|
-
token: string;
|
|
233
|
-
fraud_checkpoint_code: string | undefined;
|
|
234
|
-
};
|
|
235
|
-
/**
|
|
236
|
-
* Requests a registration code for the given phone number.
|
|
237
|
-
*/
|
|
238
|
-
export declare function mobileRegisterCode(params: RegistrationParams, fetchOptions?: AxiosRequestConfig): Promise<ExistsResponse>;
|
|
239
|
-
export declare function mobileRegisterExists(params: RegistrationParams, fetchOptions?: AxiosRequestConfig): Promise<ExistsResponse>;
|
|
240
|
-
/**
|
|
241
|
-
* Registers the phone number on whatsapp with the received OTP code.
|
|
242
|
-
*/
|
|
243
|
-
export declare function mobileRegister(params: RegistrationParams & {
|
|
244
|
-
code: string;
|
|
245
|
-
}, fetchOptions?: AxiosRequestConfig): Promise<ExistsResponse>;
|
|
246
|
-
/**
|
|
247
|
-
* Encrypts the given string as AEAD aes-256-gcm with the public whatsapp key and a random keypair.
|
|
248
|
-
*/
|
|
249
|
-
export declare function mobileRegisterEncrypt(data: string): string;
|
|
250
|
-
export declare function mobileRegisterFetch(path: string, opts?: AxiosRequestConfig): Promise<ExistsResponse>;
|
|
251
|
-
export interface ExistsResponse {
|
|
252
|
-
status: 'fail' | 'sent';
|
|
253
|
-
voice_length?: number;
|
|
254
|
-
voice_wait?: number;
|
|
255
|
-
sms_length?: number;
|
|
256
|
-
sms_wait?: number;
|
|
257
|
-
reason?: 'incorrect' | 'missing_param' | 'code_checkpoint';
|
|
258
|
-
login?: string;
|
|
259
|
-
flash_type?: number;
|
|
260
|
-
ab_hash?: string;
|
|
261
|
-
ab_key?: string;
|
|
262
|
-
exp_cfg?: string;
|
|
263
|
-
lid?: string;
|
|
264
|
-
image_blob?: string;
|
|
265
|
-
audio_blob?: string;
|
|
266
|
-
}
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.makeRegistrationSocket = void 0;
|
|
7
|
-
exports.registrationParams = registrationParams;
|
|
8
|
-
exports.mobileRegisterCode = mobileRegisterCode;
|
|
9
|
-
exports.mobileRegisterExists = mobileRegisterExists;
|
|
10
|
-
exports.mobileRegister = mobileRegister;
|
|
11
|
-
exports.mobileRegisterEncrypt = mobileRegisterEncrypt;
|
|
12
|
-
exports.mobileRegisterFetch = mobileRegisterFetch;
|
|
13
|
-
/* eslint-disable camelcase */
|
|
14
|
-
const axios_1 = __importDefault(require("axios"));
|
|
15
|
-
const Defaults_1 = require("../Defaults");
|
|
16
|
-
const crypto_1 = require("../Utils/crypto");
|
|
17
|
-
const WABinary_1 = require("../WABinary");
|
|
18
|
-
const business_1 = require("./business");
|
|
19
|
-
function urlencode(str) {
|
|
20
|
-
return str.replace(/-/g, '%2d').replace(/_/g, '%5f').replace(/~/g, '%7e');
|
|
21
|
-
}
|
|
22
|
-
const validRegistrationOptions = (config) => (config === null || config === void 0 ? void 0 : config.phoneNumberCountryCode) &&
|
|
23
|
-
config.phoneNumberNationalNumber &&
|
|
24
|
-
config.phoneNumberMobileCountryCode;
|
|
25
|
-
const makeRegistrationSocket = (config) => {
|
|
26
|
-
const sock = (0, business_1.makeBusinessSocket)(config);
|
|
27
|
-
const register = async (code) => {
|
|
28
|
-
if (!validRegistrationOptions(config.auth.creds.registration)) {
|
|
29
|
-
throw new Error('please specify the registration options');
|
|
30
|
-
}
|
|
31
|
-
const result = await mobileRegister({ ...sock.authState.creds, ...sock.authState.creds.registration, code }, config.options);
|
|
32
|
-
sock.authState.creds.me = {
|
|
33
|
-
id: (0, WABinary_1.jidEncode)(result.login, 's.whatsapp.net'),
|
|
34
|
-
name: '~'
|
|
35
|
-
};
|
|
36
|
-
sock.authState.creds.registered = true;
|
|
37
|
-
sock.ev.emit('creds.update', sock.authState.creds);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
|
-
const requestRegistrationCode = async (registrationOptions) => {
|
|
41
|
-
registrationOptions = registrationOptions || config.auth.creds.registration;
|
|
42
|
-
if (!validRegistrationOptions(registrationOptions)) {
|
|
43
|
-
throw new Error('Invalid registration options');
|
|
44
|
-
}
|
|
45
|
-
sock.authState.creds.registration = registrationOptions;
|
|
46
|
-
sock.ev.emit('creds.update', sock.authState.creds);
|
|
47
|
-
return mobileRegisterCode({ ...config.auth.creds, ...registrationOptions }, config.options);
|
|
48
|
-
};
|
|
49
|
-
return {
|
|
50
|
-
...sock,
|
|
51
|
-
register,
|
|
52
|
-
requestRegistrationCode,
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
exports.makeRegistrationSocket = makeRegistrationSocket;
|
|
56
|
-
function convertBufferToUrlHex(buffer) {
|
|
57
|
-
var id = '';
|
|
58
|
-
buffer.forEach((x) => {
|
|
59
|
-
// encode random identity_id buffer as percentage url encoding
|
|
60
|
-
id += `%${x.toString(16).padStart(2, '0').toLowerCase()}`;
|
|
61
|
-
});
|
|
62
|
-
return id;
|
|
63
|
-
}
|
|
64
|
-
function registrationParams(params) {
|
|
65
|
-
const e_regid = Buffer.alloc(4);
|
|
66
|
-
e_regid.writeInt32BE(params.registrationId);
|
|
67
|
-
const e_skey_id = Buffer.alloc(3);
|
|
68
|
-
e_skey_id.writeInt16BE(params.signedPreKey.keyId);
|
|
69
|
-
params.phoneNumberCountryCode = params.phoneNumberCountryCode.replace('+', '').trim();
|
|
70
|
-
params.phoneNumberNationalNumber = params.phoneNumberNationalNumber.replace(/[/-\s)(]/g, '').trim();
|
|
71
|
-
return {
|
|
72
|
-
cc: params.phoneNumberCountryCode,
|
|
73
|
-
in: params.phoneNumberNationalNumber,
|
|
74
|
-
Rc: '0',
|
|
75
|
-
lg: 'en',
|
|
76
|
-
lc: 'GB',
|
|
77
|
-
mistyped: '6',
|
|
78
|
-
authkey: Buffer.from(params.noiseKey.public).toString('base64url'),
|
|
79
|
-
e_regid: e_regid.toString('base64url'),
|
|
80
|
-
e_keytype: 'BQ',
|
|
81
|
-
e_ident: Buffer.from(params.signedIdentityKey.public).toString('base64url'),
|
|
82
|
-
// e_skey_id: e_skey_id.toString('base64url'),
|
|
83
|
-
e_skey_id: 'AAAA',
|
|
84
|
-
e_skey_val: Buffer.from(params.signedPreKey.keyPair.public).toString('base64url'),
|
|
85
|
-
e_skey_sig: Buffer.from(params.signedPreKey.signature).toString('base64url'),
|
|
86
|
-
fdid: params.phoneId,
|
|
87
|
-
network_ratio_type: '1',
|
|
88
|
-
expid: params.deviceId,
|
|
89
|
-
simnum: '1',
|
|
90
|
-
hasinrc: '1',
|
|
91
|
-
pid: Math.floor(Math.random() * 1000).toString(),
|
|
92
|
-
id: convertBufferToUrlHex(params.identityId),
|
|
93
|
-
backup_token: convertBufferToUrlHex(params.backupToken),
|
|
94
|
-
token: (0, crypto_1.md5)(Buffer.concat([Defaults_1.MOBILE_TOKEN, Buffer.from(params.phoneNumberNationalNumber)])).toString('hex'),
|
|
95
|
-
fraud_checkpoint_code: params.captcha,
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Requests a registration code for the given phone number.
|
|
100
|
-
*/
|
|
101
|
-
function mobileRegisterCode(params, fetchOptions) {
|
|
102
|
-
return mobileRegisterFetch('/code', {
|
|
103
|
-
params: {
|
|
104
|
-
...registrationParams(params),
|
|
105
|
-
mcc: `${params.phoneNumberMobileCountryCode}`.padStart(3, '0'),
|
|
106
|
-
mnc: `${params.phoneNumberMobileNetworkCode || '001'}`.padStart(3, '0'),
|
|
107
|
-
sim_mcc: '000',
|
|
108
|
-
sim_mnc: '000',
|
|
109
|
-
method: (params === null || params === void 0 ? void 0 : params.method) || 'sms',
|
|
110
|
-
reason: '',
|
|
111
|
-
hasav: '1'
|
|
112
|
-
},
|
|
113
|
-
...fetchOptions,
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
function mobileRegisterExists(params, fetchOptions) {
|
|
117
|
-
return mobileRegisterFetch('/exist', {
|
|
118
|
-
params: registrationParams(params),
|
|
119
|
-
...fetchOptions
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Registers the phone number on whatsapp with the received OTP code.
|
|
124
|
-
*/
|
|
125
|
-
async function mobileRegister(params, fetchOptions) {
|
|
126
|
-
//const result = await mobileRegisterFetch(`/reg_onboard_abprop?cc=${params.phoneNumberCountryCode}&in=${params.phoneNumberNationalNumber}&rc=0`)
|
|
127
|
-
return mobileRegisterFetch('/register', {
|
|
128
|
-
params: { ...registrationParams(params), code: params.code.replace('-', '') },
|
|
129
|
-
...fetchOptions,
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Encrypts the given string as AEAD aes-256-gcm with the public whatsapp key and a random keypair.
|
|
134
|
-
*/
|
|
135
|
-
function mobileRegisterEncrypt(data) {
|
|
136
|
-
const keypair = crypto_1.Curve.generateKeyPair();
|
|
137
|
-
const key = crypto_1.Curve.sharedKey(keypair.private, Defaults_1.REGISTRATION_PUBLIC_KEY);
|
|
138
|
-
const buffer = (0, crypto_1.aesEncryptGCM)(Buffer.from(data), new Uint8Array(key), Buffer.alloc(12), Buffer.alloc(0));
|
|
139
|
-
return Buffer.concat([Buffer.from(keypair.public), buffer]).toString('base64url');
|
|
140
|
-
}
|
|
141
|
-
async function mobileRegisterFetch(path, opts = {}) {
|
|
142
|
-
let url = `${Defaults_1.MOBILE_REGISTRATION_ENDPOINT}${path}`;
|
|
143
|
-
if (opts.params) {
|
|
144
|
-
const parameter = [];
|
|
145
|
-
for (const param in opts.params) {
|
|
146
|
-
if (opts.params[param] !== null && opts.params[param] !== undefined) {
|
|
147
|
-
parameter.push(param + '=' + urlencode(opts.params[param]));
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
url += `?${parameter.join('&')}`;
|
|
151
|
-
delete opts.params;
|
|
152
|
-
}
|
|
153
|
-
if (!opts.headers) {
|
|
154
|
-
opts.headers = {};
|
|
155
|
-
}
|
|
156
|
-
opts.headers['User-Agent'] = Defaults_1.MOBILE_USERAGENT;
|
|
157
|
-
const response = await (0, axios_1.default)(url, opts);
|
|
158
|
-
var json = response.data;
|
|
159
|
-
if (response.status > 300 || json.reason) {
|
|
160
|
-
throw json;
|
|
161
|
-
}
|
|
162
|
-
if (json.status && !['ok', 'sent'].includes(json.status)) {
|
|
163
|
-
throw json;
|
|
164
|
-
}
|
|
165
|
-
return json;
|
|
166
|
-
}
|