nrx-bails 0.0.1
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 -0
- package/README.md +1541 -0
- package/WAProto/GenerateStatics.sh +4 -0
- package/WAProto/WAProto.proto +4775 -0
- package/WAProto/index.d.ts +2 -0
- package/WAProto/index.js +169661 -0
- package/lib/Defaults/index.d.ts +113 -0
- package/lib/Defaults/index.js +156 -0
- package/lib/Defaults/phonenumber-mcc.json +223 -0
- package/lib/Defaults/ye-bail-version.json +3 -0
- package/lib/Signal/Group/ciphertext-message.d.ts +10 -0
- package/lib/Signal/Group/ciphertext-message.js +41 -0
- package/lib/Signal/Group/group-session-builder.d.ts +8 -0
- package/lib/Signal/Group/group-session-builder.js +90 -0
- package/lib/Signal/Group/group_cipher.d.ts +12 -0
- package/lib/Signal/Group/group_cipher.js +122 -0
- package/lib/Signal/Group/index.d.ts +22 -0
- package/lib/Signal/Group/index.js +83 -0
- package/lib/Signal/Group/keyhelper.d.ts +7 -0
- package/lib/Signal/Group/keyhelper.js +81 -0
- package/lib/Signal/Group/queue-job.d.ts +3 -0
- package/lib/Signal/Group/queue-job.js +83 -0
- package/lib/Signal/Group/sender-chain-key.d.ts +14 -0
- package/lib/Signal/Group/sender-chain-key.js +60 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +17 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +92 -0
- package/lib/Signal/Group/sender-key-message.d.ts +19 -0
- package/lib/Signal/Group/sender-key-message.js +95 -0
- package/lib/Signal/Group/sender-key-name.d.ts +12 -0
- package/lib/Signal/Group/sender-key-name.js +77 -0
- package/lib/Signal/Group/sender-key-record.d.ts +13 -0
- package/lib/Signal/Group/sender-key-record.js +79 -0
- package/lib/Signal/Group/sender-key-state.d.ts +17 -0
- package/lib/Signal/Group/sender-key-state.js +125 -0
- package/lib/Signal/Group/sender-message-key.d.ts +12 -0
- package/lib/Signal/Group/sender-message-key.js +55 -0
- package/lib/Signal/libsignal.d.ts +37 -0
- package/lib/Signal/libsignal.js +200 -0
- package/lib/Socket/Client/index.d.ts +1 -0
- package/lib/Socket/Client/index.js +44 -0
- package/lib/Socket/Client/types.d.ts +7 -0
- package/lib/Socket/Client/types.js +39 -0
- package/lib/Socket/Client/websocket.d.ts +19 -0
- package/lib/Socket/Client/websocket.js +137 -0
- package/lib/Socket/business.d.ts +329 -0
- package/lib/Socket/business.js +286 -0
- package/lib/Socket/chats.d.ts +84 -0
- package/lib/Socket/chats.js +1022 -0
- package/lib/Socket/groups.d.ts +216 -0
- package/lib/Socket/groups.js +358 -0
- package/lib/Socket/index.d.ts +330 -0
- package/lib/Socket/index.js +36 -0
- package/lib/Socket/messages-recv.d.ts +271 -0
- package/lib/Socket/messages-recv.js +1079 -0
- package/lib/Socket/messages-send.d.ts +258 -0
- package/lib/Socket/messages-send.js +1190 -0
- package/lib/Socket/newsletter.d.ts +253 -0
- package/lib/Socket/newsletter.js +362 -0
- package/lib/Socket/registration.d.ts +361 -0
- package/lib/Socket/registration.js +179 -0
- package/lib/Socket/socket.d.ts +33 -0
- package/lib/Socket/socket.js +699 -0
- package/lib/Socket/usync.d.ts +27 -0
- package/lib/Socket/usync.js +96 -0
- package/lib/Store/index.d.ts +3 -0
- package/lib/Store/index.js +36 -0
- package/lib/Store/make-cache-manager-auth-state.d.ts +16 -0
- package/lib/Store/make-cache-manager-auth-state.js +118 -0
- package/lib/Store/make-in-memory-store.d.ts +64 -0
- package/lib/Store/make-in-memory-store.js +465 -0
- package/lib/Store/make-ordered-dictionary.d.ts +14 -0
- package/lib/Store/make-ordered-dictionary.js +107 -0
- package/lib/Store/object-repository.d.ts +11 -0
- package/lib/Store/object-repository.js +53 -0
- package/lib/Types/Auth.d.ts +1 -0
- package/lib/Types/Auth.js +28 -0
- package/lib/Types/Call.d.ts +1 -0
- package/lib/Types/Call.js +28 -0
- package/lib/Types/Chat.d.ts +2 -0
- package/lib/Types/Chat.js +30 -0
- package/lib/Types/Contact.d.ts +1 -0
- package/lib/Types/Contact.js +28 -0
- package/lib/Types/Events.d.ts +1 -0
- package/lib/Types/Events.js +28 -0
- package/lib/Types/GroupMetadata.d.ts +1 -0
- package/lib/Types/GroupMetadata.js +28 -0
- package/lib/Types/Label.d.ts +2 -0
- package/lib/Types/Label.js +53 -0
- package/lib/Types/LabelAssociation.d.ts +2 -0
- package/lib/Types/LabelAssociation.js +35 -0
- package/lib/Types/Message.d.ts +2 -0
- package/lib/Types/Message.js +33 -0
- package/lib/Types/Newsletter.d.ts +4 -0
- package/lib/Types/Newsletter.js +62 -0
- package/lib/Types/Product.d.ts +1 -0
- package/lib/Types/Product.js +28 -0
- package/lib/Types/Signal.d.ts +1 -0
- package/lib/Types/Signal.js +28 -0
- package/lib/Types/Socket.d.ts +1 -0
- package/lib/Types/Socket.js +28 -0
- package/lib/Types/State.d.ts +1 -0
- package/lib/Types/State.js +28 -0
- package/lib/Types/USync.d.ts +1 -0
- package/lib/Types/USync.js +28 -0
- package/lib/Types/index.d.ts +2 -0
- package/lib/Types/index.js +68 -0
- package/lib/Utils/auth-utils.d.ts +63 -0
- package/lib/Utils/auth-utils.js +248 -0
- package/lib/Utils/browser-utils.d.ts +3 -0
- package/lib/Utils/browser-utils.js +61 -0
- package/lib/Utils/business.d.ts +53 -0
- package/lib/Utils/business.js +260 -0
- package/lib/Utils/chat-utils.d.ts +253 -0
- package/lib/Utils/chat-utils.js +756 -0
- package/lib/Utils/crypto.d.ts +43 -0
- package/lib/Utils/crypto.js +219 -0
- package/lib/Utils/decode-wa-message.d.ts +61 -0
- package/lib/Utils/decode-wa-message.js +233 -0
- package/lib/Utils/event-buffer.d.ts +17 -0
- package/lib/Utils/event-buffer.js +544 -0
- package/lib/Utils/generics.d.ts +89 -0
- package/lib/Utils/generics.js +471 -0
- package/lib/Utils/history.d.ts +59 -0
- package/lib/Utils/history.js +120 -0
- package/lib/Utils/index.d.ts +1 -0
- package/lib/Utils/index.js +61 -0
- package/lib/Utils/link-preview.d.ts +19 -0
- package/lib/Utils/link-preview.js +152 -0
- package/lib/Utils/logger.d.ts +3 -0
- package/lib/Utils/logger.js +33 -0
- package/lib/Utils/lt-hash.d.ts +13 -0
- package/lib/Utils/lt-hash.js +77 -0
- package/lib/Utils/make-mutex.d.ts +7 -0
- package/lib/Utils/make-mutex.js +69 -0
- package/lib/Utils/message-retry-manager.d.ts +34 -0
- package/lib/Utils/message-retry-manager.js +154 -0
- package/lib/Utils/messages-media.d.ts +137 -0
- package/lib/Utils/messages-media.js +1024 -0
- package/lib/Utils/messages.d.ts +66 -0
- package/lib/Utils/messages.js +1407 -0
- package/lib/Utils/noise-handler.d.ts +21 -0
- package/lib/Utils/noise-handler.js +176 -0
- package/lib/Utils/pre-key-manager.d.ts +13 -0
- package/lib/Utils/pre-key-manager.js +93 -0
- package/lib/Utils/process-message.d.ts +40 -0
- package/lib/Utils/process-message.js +430 -0
- package/lib/Utils/signal.d.ts +72 -0
- package/lib/Utils/signal.js +179 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts +18 -0
- package/lib/Utils/use-multi-file-auth-state.js +151 -0
- package/lib/Utils/validate-connection.d.ts +43 -0
- package/lib/Utils/validate-connection.js +255 -0
- package/lib/Utils/ye-bail-event-stream.d.ts +16 -0
- package/lib/Utils/ye-bail-event-stream.js +89 -0
- package/lib/WABinary/constants.d.ts +23 -0
- package/lib/WABinary/constants.js +1328 -0
- package/lib/WABinary/decode.d.ts +10 -0
- package/lib/WABinary/decode.js +291 -0
- package/lib/WABinary/encode.d.ts +2 -0
- package/lib/WABinary/encode.js +276 -0
- package/lib/WABinary/generic-utils.d.ts +16 -0
- package/lib/WABinary/generic-utils.js +155 -0
- package/lib/WABinary/index.d.ts +1 -0
- package/lib/WABinary/index.js +47 -0
- package/lib/WABinary/jid-utils.d.ts +34 -0
- package/lib/WABinary/jid-utils.js +111 -0
- package/lib/WABinary/types.d.ts +1 -0
- package/lib/WABinary/types.js +28 -0
- package/lib/WAM/BinaryInfo.d.ts +8 -0
- package/lib/WAM/BinaryInfo.js +39 -0
- package/lib/WAM/constants.d.ts +35374 -0
- package/lib/WAM/constants.js +15376 -0
- package/lib/WAM/encode.d.ts +2 -0
- package/lib/WAM/encode.js +181 -0
- package/lib/WAM/index.d.ts +1 -0
- package/lib/WAM/index.js +45 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +14 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +58 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +23 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +83 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +13 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +56 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +13 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +68 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +39 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +79 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +10 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +50 -0
- package/lib/WAUSync/Protocols/index.d.ts +1 -0
- package/lib/WAUSync/Protocols/index.js +46 -0
- package/lib/WAUSync/USyncQuery.d.ts +20 -0
- package/lib/WAUSync/USyncQuery.js +115 -0
- package/lib/WAUSync/USyncUser.d.ts +13 -0
- package/lib/WAUSync/USyncUser.js +52 -0
- package/lib/WAUSync/index.d.ts +1 -0
- package/lib/WAUSync/index.js +45 -0
- package/lib/index.js +81 -0
- package/package.json +113 -0
- package/requirements.js +32 -0
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
export const __esModule: boolean;
|
|
2
|
+
export function makeRegistrationSocket(config: any): {
|
|
3
|
+
register: (code: any) => Promise<any>;
|
|
4
|
+
requestRegistrationCode: (registrationOptions: any) => Promise<any>;
|
|
5
|
+
logger: any;
|
|
6
|
+
getOrderDetails: (orderId: any, tokenBase64: any) => Promise<{
|
|
7
|
+
price: {
|
|
8
|
+
total: number;
|
|
9
|
+
currency: any;
|
|
10
|
+
};
|
|
11
|
+
products: any;
|
|
12
|
+
}>;
|
|
13
|
+
getCatalog: ({ jid, limit, cursor }: {
|
|
14
|
+
jid: any;
|
|
15
|
+
limit: any;
|
|
16
|
+
cursor: any;
|
|
17
|
+
}) => Promise<{
|
|
18
|
+
products: any;
|
|
19
|
+
nextPageCursor: any;
|
|
20
|
+
}>;
|
|
21
|
+
getCollections: (jid: any, limit?: number) => Promise<{
|
|
22
|
+
collections: any;
|
|
23
|
+
}>;
|
|
24
|
+
productCreate: (create: any) => Promise<{
|
|
25
|
+
id: any;
|
|
26
|
+
imageUrls: {
|
|
27
|
+
requested: any;
|
|
28
|
+
original: any;
|
|
29
|
+
};
|
|
30
|
+
reviewStatus: {
|
|
31
|
+
whatsapp: any;
|
|
32
|
+
};
|
|
33
|
+
availability: string;
|
|
34
|
+
name: any;
|
|
35
|
+
retailerId: any;
|
|
36
|
+
url: any;
|
|
37
|
+
description: any;
|
|
38
|
+
price: number;
|
|
39
|
+
currency: any;
|
|
40
|
+
isHidden: boolean;
|
|
41
|
+
}>;
|
|
42
|
+
productDelete: (productIds: any) => Promise<{
|
|
43
|
+
deleted: number;
|
|
44
|
+
}>;
|
|
45
|
+
productUpdate: (productId: any, update: any) => Promise<{
|
|
46
|
+
id: any;
|
|
47
|
+
imageUrls: {
|
|
48
|
+
requested: any;
|
|
49
|
+
original: any;
|
|
50
|
+
};
|
|
51
|
+
reviewStatus: {
|
|
52
|
+
whatsapp: any;
|
|
53
|
+
};
|
|
54
|
+
availability: string;
|
|
55
|
+
name: any;
|
|
56
|
+
retailerId: any;
|
|
57
|
+
url: any;
|
|
58
|
+
description: any;
|
|
59
|
+
price: number;
|
|
60
|
+
currency: any;
|
|
61
|
+
isHidden: boolean;
|
|
62
|
+
}>;
|
|
63
|
+
sendMessageAck: ({ tag, attrs, content }: {
|
|
64
|
+
tag: any;
|
|
65
|
+
attrs: any;
|
|
66
|
+
content: any;
|
|
67
|
+
}, errorCode: any) => Promise<void>;
|
|
68
|
+
sendRetryRequest: (node: any, forceIncludeKeys?: boolean) => Promise<void>;
|
|
69
|
+
rejectCall: (callId: any, callFrom: any) => Promise<void>;
|
|
70
|
+
offerCall: (toJid: any, isVideo?: boolean) => Promise<{
|
|
71
|
+
callId: string;
|
|
72
|
+
toJid: any;
|
|
73
|
+
isVideo: boolean;
|
|
74
|
+
}>;
|
|
75
|
+
fetchMessageHistory: (count: any, oldestMsgKey: any, oldestMsgTimestamp: any) => Promise<any>;
|
|
76
|
+
requestPlaceholderResend: (messageKey: any) => Promise<any>;
|
|
77
|
+
getPrivacyTokens: (jids: any) => Promise<any>;
|
|
78
|
+
assertSessions: (jids: any, force: any) => Promise<boolean>;
|
|
79
|
+
relayMessage: (jid: any, message: any, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, useCachedGroupMetadata, statusJidList }: {
|
|
80
|
+
messageId: any;
|
|
81
|
+
participant: any;
|
|
82
|
+
additionalAttributes: any;
|
|
83
|
+
additionalNodes: any;
|
|
84
|
+
useUserDevicesCache: any;
|
|
85
|
+
useCachedGroupMetadata: any;
|
|
86
|
+
statusJidList: any;
|
|
87
|
+
}) => Promise<any>;
|
|
88
|
+
sendReceipt: (jid: any, participant: any, messageIds: any, type: any) => Promise<void>;
|
|
89
|
+
sendReceipts: (keys: any, type: any) => Promise<void>;
|
|
90
|
+
readMessages: (keys: any) => Promise<void>;
|
|
91
|
+
refreshMediaConn: (forceGet?: boolean) => Promise<any>;
|
|
92
|
+
waUploadToServer: any;
|
|
93
|
+
fetchPrivacySettings: (force?: boolean) => Promise<any>;
|
|
94
|
+
getUSyncDevices: (jids: any, useCache: any, ignoreZeroDevices: any) => Promise<any[]>;
|
|
95
|
+
createParticipantNodes: (jids: any, message: any, extraAttrs: any) => Promise<{
|
|
96
|
+
nodes: any[];
|
|
97
|
+
shouldIncludeDeviceIdentity: boolean;
|
|
98
|
+
}>;
|
|
99
|
+
sendPeerDataOperationMessage: (pdoMessage: any) => Promise<any>;
|
|
100
|
+
updateMediaMessage: (message: any) => Promise<any>;
|
|
101
|
+
sendMessage: (jid: any, content: any, options?: {}) => Promise<any>;
|
|
102
|
+
newsletterFetchAllSubscribe: () => Promise<any>;
|
|
103
|
+
subscribeNewsletterUpdates: (jid: any) => Promise<any>;
|
|
104
|
+
newsletterReactionMode: (jid: any, mode: any) => Promise<void>;
|
|
105
|
+
newsletterUpdateDescription: (jid: any, description: any) => Promise<void>;
|
|
106
|
+
newsletterId: (url: any) => Promise<string>;
|
|
107
|
+
newsletterUpdateName: (jid: any, name: any) => Promise<void>;
|
|
108
|
+
newsletterUpdatePicture: (jid: any, content: any) => Promise<void>;
|
|
109
|
+
newsletterRemovePicture: (jid: any) => Promise<void>;
|
|
110
|
+
newsletterUnfollow: (jid: any) => Promise<void>;
|
|
111
|
+
newsletterFollow: (jid: any) => Promise<void>;
|
|
112
|
+
newsletterUnmute: (jid: any) => Promise<void>;
|
|
113
|
+
newsletterMute: (jid: any) => Promise<void>;
|
|
114
|
+
newsletterAction: (jid: any, type: any) => Promise<void>;
|
|
115
|
+
newsletterCreate: (name: any, description: any, reaction_codes: any) => Promise<{
|
|
116
|
+
id: any;
|
|
117
|
+
state: any;
|
|
118
|
+
creation_time: number;
|
|
119
|
+
name: any;
|
|
120
|
+
nameTime: number;
|
|
121
|
+
description: any;
|
|
122
|
+
descriptionTime: number;
|
|
123
|
+
invite: any;
|
|
124
|
+
picture: any;
|
|
125
|
+
preview: any;
|
|
126
|
+
reaction_codes: any;
|
|
127
|
+
subscribers: number;
|
|
128
|
+
verification: any;
|
|
129
|
+
viewer_metadata: any;
|
|
130
|
+
}>;
|
|
131
|
+
newsletterMetadata: (type: any, key: any, role: any) => Promise<{
|
|
132
|
+
id: any;
|
|
133
|
+
state: any;
|
|
134
|
+
creation_time: number;
|
|
135
|
+
name: any;
|
|
136
|
+
nameTime: number;
|
|
137
|
+
description: any;
|
|
138
|
+
descriptionTime: number;
|
|
139
|
+
invite: any;
|
|
140
|
+
picture: any;
|
|
141
|
+
preview: any;
|
|
142
|
+
reaction_codes: any;
|
|
143
|
+
subscribers: number;
|
|
144
|
+
verification: any;
|
|
145
|
+
viewer_metadata: any;
|
|
146
|
+
}>;
|
|
147
|
+
newsletterAdminCount: (jid: any) => Promise<any>;
|
|
148
|
+
newsletterChangeOwner: (jid: any, user: any) => Promise<void>;
|
|
149
|
+
newsletterPromote: (jid: any, user: any) => Promise<void>;
|
|
150
|
+
newsletterDemote: (jid: any, user: any) => Promise<void>;
|
|
151
|
+
newsletterDelete: (jid: any) => Promise<void>;
|
|
152
|
+
newsletterReactMessage: (jid: any, serverId: any, code: any) => Promise<void>;
|
|
153
|
+
newsletterFetchMessages: (type: any, key: any, count: any, after: any, since: any) => Promise<any>;
|
|
154
|
+
newsletterFetchUpdates: (jid: any, count: any, after: any, since: any) => Promise<any>;
|
|
155
|
+
newsletterSubscribers: (jid: any) => Promise<any>;
|
|
156
|
+
groupQuery: (jid: any, type: any, content: any) => Promise<any>;
|
|
157
|
+
groupMetadata: (jid: any) => Promise<{
|
|
158
|
+
desc: any;
|
|
159
|
+
descId: any;
|
|
160
|
+
descOwner: any;
|
|
161
|
+
descOwnerLid: any;
|
|
162
|
+
descTime: number;
|
|
163
|
+
linkedParent: any;
|
|
164
|
+
restrict: boolean;
|
|
165
|
+
announce: boolean;
|
|
166
|
+
isCommunity: boolean;
|
|
167
|
+
isCommunityAnnounce: boolean;
|
|
168
|
+
joinApprovalMode: boolean;
|
|
169
|
+
memberAddMode: boolean;
|
|
170
|
+
participants: any;
|
|
171
|
+
ephemeralDuration: number;
|
|
172
|
+
ownerLid?: any;
|
|
173
|
+
subjectTime: number;
|
|
174
|
+
size: any;
|
|
175
|
+
creation: number;
|
|
176
|
+
owner: any;
|
|
177
|
+
subjectOwnerLid?: any;
|
|
178
|
+
id: any;
|
|
179
|
+
addressingMode: any;
|
|
180
|
+
subject: any;
|
|
181
|
+
subjectOwner: any;
|
|
182
|
+
}>;
|
|
183
|
+
groupCreate: (subject: any, participants: any) => Promise<{
|
|
184
|
+
desc: any;
|
|
185
|
+
descId: any;
|
|
186
|
+
descOwner: any;
|
|
187
|
+
descOwnerLid: any;
|
|
188
|
+
descTime: number;
|
|
189
|
+
linkedParent: any;
|
|
190
|
+
restrict: boolean;
|
|
191
|
+
announce: boolean;
|
|
192
|
+
isCommunity: boolean;
|
|
193
|
+
isCommunityAnnounce: boolean;
|
|
194
|
+
joinApprovalMode: boolean;
|
|
195
|
+
memberAddMode: boolean;
|
|
196
|
+
participants: any;
|
|
197
|
+
ephemeralDuration: number;
|
|
198
|
+
ownerLid?: any;
|
|
199
|
+
subjectTime: number;
|
|
200
|
+
size: any;
|
|
201
|
+
creation: number;
|
|
202
|
+
owner: any;
|
|
203
|
+
subjectOwnerLid?: any;
|
|
204
|
+
id: any;
|
|
205
|
+
addressingMode: any;
|
|
206
|
+
subject: any;
|
|
207
|
+
subjectOwner: any;
|
|
208
|
+
}>;
|
|
209
|
+
groupLeave: (id: any) => Promise<void>;
|
|
210
|
+
groupUpdateSubject: (jid: any, subject: any) => Promise<void>;
|
|
211
|
+
groupRequestParticipantsList: (jid: any) => Promise<any>;
|
|
212
|
+
groupRequestParticipantsUpdate: (jid: any, participants: any, action: any) => Promise<any>;
|
|
213
|
+
groupParticipantsUpdate: (jid: any, participants: any, action: any) => Promise<any>;
|
|
214
|
+
groupUpdateDescription: (jid: any, description: any) => Promise<void>;
|
|
215
|
+
groupInviteCode: (jid: any) => Promise<any>;
|
|
216
|
+
groupRevokeInvite: (jid: any) => Promise<any>;
|
|
217
|
+
groupAcceptInvite: (code: any) => Promise<any>;
|
|
218
|
+
groupRevokeInviteV4: (groupJid: any, invitedJid: any) => Promise<boolean>;
|
|
219
|
+
groupAcceptInviteV4: any;
|
|
220
|
+
groupGetInviteInfo: (code: any) => Promise<{
|
|
221
|
+
desc: any;
|
|
222
|
+
descId: any;
|
|
223
|
+
descOwner: any;
|
|
224
|
+
descOwnerLid: any;
|
|
225
|
+
descTime: number;
|
|
226
|
+
linkedParent: any;
|
|
227
|
+
restrict: boolean;
|
|
228
|
+
announce: boolean;
|
|
229
|
+
isCommunity: boolean;
|
|
230
|
+
isCommunityAnnounce: boolean;
|
|
231
|
+
joinApprovalMode: boolean;
|
|
232
|
+
memberAddMode: boolean;
|
|
233
|
+
participants: any;
|
|
234
|
+
ephemeralDuration: number;
|
|
235
|
+
ownerLid?: any;
|
|
236
|
+
subjectTime: number;
|
|
237
|
+
size: any;
|
|
238
|
+
creation: number;
|
|
239
|
+
owner: any;
|
|
240
|
+
subjectOwnerLid?: any;
|
|
241
|
+
id: any;
|
|
242
|
+
addressingMode: any;
|
|
243
|
+
subject: any;
|
|
244
|
+
subjectOwner: any;
|
|
245
|
+
}>;
|
|
246
|
+
groupToggleEphemeral: (jid: any, ephemeralExpiration: any) => Promise<void>;
|
|
247
|
+
groupSettingUpdate: (jid: any, setting: any) => Promise<void>;
|
|
248
|
+
groupMemberAddMode: (jid: any, mode: any) => Promise<void>;
|
|
249
|
+
groupJoinApprovalMode: (jid: any, mode: any) => Promise<void>;
|
|
250
|
+
groupFetchAllParticipating: () => Promise<{}>;
|
|
251
|
+
createCallLink: (type: any, event: any, timeoutMs: any) => Promise<any>;
|
|
252
|
+
getBotListV2: () => Promise<{
|
|
253
|
+
jid: any;
|
|
254
|
+
personaId: any;
|
|
255
|
+
}[]>;
|
|
256
|
+
processingMutex: {
|
|
257
|
+
mutex(code: any): Promise<void>;
|
|
258
|
+
};
|
|
259
|
+
upsertMessage: any;
|
|
260
|
+
appPatch: (patchCreate: any) => Promise<void>;
|
|
261
|
+
sendPresenceUpdate: (type: any, toJid: any) => Promise<void>;
|
|
262
|
+
presenceSubscribe: (toJid: any, tcToken: any) => Promise<void>;
|
|
263
|
+
profilePictureUrl: (jid: any, type: string, timeoutMs: any) => Promise<any>;
|
|
264
|
+
onWhatsApp: (...jids: any[]) => Promise<any>;
|
|
265
|
+
fetchBlocklist: () => Promise<any>;
|
|
266
|
+
fetchDisappearingDuration: (...jids: any[]) => Promise<any>;
|
|
267
|
+
fetchStatus: (...jids: any[]) => Promise<any>;
|
|
268
|
+
updateProfilePicture: (jid: any, content: any, dimensions: any) => Promise<void>;
|
|
269
|
+
removeProfilePicture: (jid: any) => Promise<void>;
|
|
270
|
+
updateProfileStatus: (status: any) => Promise<void>;
|
|
271
|
+
updateProfileName: (name: any) => Promise<void>;
|
|
272
|
+
updateBlockStatus: (jid: any, action: any) => Promise<void>;
|
|
273
|
+
updateDisableLinkPreviewsPrivacy: (isPreviewsDisabled: any) => Promise<void>;
|
|
274
|
+
updateCallPrivacy: (value: any) => Promise<void>;
|
|
275
|
+
updateMessagesPrivacy: (value: any) => Promise<void>;
|
|
276
|
+
updateLastSeenPrivacy: (value: any) => Promise<void>;
|
|
277
|
+
updateOnlinePrivacy: (value: any) => Promise<void>;
|
|
278
|
+
updateProfilePicturePrivacy: (value: any) => Promise<void>;
|
|
279
|
+
updateStatusPrivacy: (value: any) => Promise<void>;
|
|
280
|
+
updateReadReceiptsPrivacy: (value: any) => Promise<void>;
|
|
281
|
+
updateGroupsAddPrivacy: (value: any) => Promise<void>;
|
|
282
|
+
updateDefaultDisappearingMode: (duration: any) => Promise<void>;
|
|
283
|
+
getBusinessProfile: (jid: any) => Promise<{
|
|
284
|
+
wid: any;
|
|
285
|
+
address: any;
|
|
286
|
+
description: any;
|
|
287
|
+
website: any[];
|
|
288
|
+
email: any;
|
|
289
|
+
category: any;
|
|
290
|
+
business_hours: {
|
|
291
|
+
timezone: any;
|
|
292
|
+
business_config: any;
|
|
293
|
+
};
|
|
294
|
+
}>;
|
|
295
|
+
resyncAppState: any;
|
|
296
|
+
chatModify: (mod: any, jid: any) => Promise<void>;
|
|
297
|
+
cleanDirtyBits: (type: any, fromTimestamp: any) => Promise<void>;
|
|
298
|
+
addOrEditContact: (jid: any, contact: any) => Promise<void>;
|
|
299
|
+
removeContact: (jid: any) => Promise<void>;
|
|
300
|
+
addLabel: (jid: any, labels: any) => Promise<void>;
|
|
301
|
+
addChatLabel: (jid: any, labelId: any) => Promise<void>;
|
|
302
|
+
removeChatLabel: (jid: any, labelId: any) => Promise<void>;
|
|
303
|
+
addMessageLabel: (jid: any, messageId: any, labelId: any) => Promise<void>;
|
|
304
|
+
removeMessageLabel: (jid: any, messageId: any, labelId: any) => Promise<void>;
|
|
305
|
+
star: (jid: any, messages: any, star: any) => Promise<void>;
|
|
306
|
+
checkWhatsApp: (jid: any) => Promise<string>;
|
|
307
|
+
executeUSyncQuery: (usyncQuery: any) => Promise<any>;
|
|
308
|
+
type: string;
|
|
309
|
+
ws: any;
|
|
310
|
+
ev: any;
|
|
311
|
+
authState: {
|
|
312
|
+
creds: any;
|
|
313
|
+
keys: any;
|
|
314
|
+
};
|
|
315
|
+
signalRepository: any;
|
|
316
|
+
user: any;
|
|
317
|
+
generateMessageTag: () => string;
|
|
318
|
+
query: (node: any, timeoutMs: any) => Promise<any>;
|
|
319
|
+
waitForMessage: (msgId: any, timeoutMs?: any) => Promise<any>;
|
|
320
|
+
waitForSocketOpen: () => Promise<void>;
|
|
321
|
+
sendRawMessage: (data: any) => Promise<void>;
|
|
322
|
+
sendNode: (frame: any) => Promise<void>;
|
|
323
|
+
logout: (msg: any) => Promise<void>;
|
|
324
|
+
end: (error: any) => void;
|
|
325
|
+
onUnexpectedError: (err: any, msg: any) => void;
|
|
326
|
+
uploadPreKeys: (count?: 812) => Promise<void>;
|
|
327
|
+
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
328
|
+
requestPairingCode: (phoneNumber: any, pairCode?: string) => Promise<any>;
|
|
329
|
+
waitForConnectionUpdate: any;
|
|
330
|
+
sendWAMBuffer: (wamBuffer: any) => Promise<any>;
|
|
331
|
+
};
|
|
332
|
+
export function registrationParams(params: any): {
|
|
333
|
+
cc: any;
|
|
334
|
+
in: any;
|
|
335
|
+
Rc: string;
|
|
336
|
+
lg: string;
|
|
337
|
+
lc: string;
|
|
338
|
+
mistyped: string;
|
|
339
|
+
authkey: string;
|
|
340
|
+
e_regid: string;
|
|
341
|
+
e_keytype: string;
|
|
342
|
+
e_ident: string;
|
|
343
|
+
e_skey_id: string;
|
|
344
|
+
e_skey_val: string;
|
|
345
|
+
e_skey_sig: string;
|
|
346
|
+
fdid: any;
|
|
347
|
+
network_ratio_type: string;
|
|
348
|
+
expid: any;
|
|
349
|
+
simnum: string;
|
|
350
|
+
hasinrc: string;
|
|
351
|
+
pid: string;
|
|
352
|
+
id: string;
|
|
353
|
+
backup_token: string;
|
|
354
|
+
token: string;
|
|
355
|
+
fraud_checkpoint_code: any;
|
|
356
|
+
};
|
|
357
|
+
export function mobileRegisterCode(params: any, fetchOptions: any): Promise<any>;
|
|
358
|
+
export function mobileRegisterExists(params: any, fetchOptions: any): Promise<any>;
|
|
359
|
+
export function mobileRegister(params: any, fetchOptions: any): Promise<any>;
|
|
360
|
+
export function mobileRegisterEncrypt(data: any): string;
|
|
361
|
+
export function mobileRegisterFetch(path: any, opts?: {}): Promise<any>;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ╔═══════════════════════════════════════════════════════════╗
|
|
3
|
+
* ║ NEROX - WhatsApp API Library ║
|
|
4
|
+
* ║ Premium Edition ║
|
|
5
|
+
* ╚═══════════════════════════════════════════════════════════╝
|
|
6
|
+
*
|
|
7
|
+
* @package nerox-bails
|
|
8
|
+
* @version 0.1.0
|
|
9
|
+
* @author NEROX Development Team
|
|
10
|
+
* @copyright Copyright (c) 2025 NEROX. All rights reserved.
|
|
11
|
+
* @license MIT License
|
|
12
|
+
*
|
|
13
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
14
|
+
* a copy of this software and associated documentation files (the "Software"),
|
|
15
|
+
* to deal in the Software without restriction, including without limitation
|
|
16
|
+
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
17
|
+
* and/or sell copies of the Software, and to permit persons to whom the
|
|
18
|
+
* Software is furnished to do so, subject to the following conditions:
|
|
19
|
+
*
|
|
20
|
+
* The above copyright notice and this permission notice shall be included
|
|
21
|
+
* in all copies or substantial portions of the Software.
|
|
22
|
+
*
|
|
23
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
24
|
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
26
|
+
*/
|
|
27
|
+
"use strict";
|
|
28
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
+
};
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.mobileRegisterFetch = exports.mobileRegisterEncrypt = exports.mobileRegister = exports.mobileRegisterExists = exports.mobileRegisterCode = exports.registrationParams = exports.makeRegistrationSocket = void 0;
|
|
33
|
+
const axios_1 = __importDefault(require("axios"));
|
|
34
|
+
const Defaults_1 = require("../Defaults");
|
|
35
|
+
const crypto_1 = require("../Utils/crypto");
|
|
36
|
+
const WABinary_1 = require("../WABinary");
|
|
37
|
+
const business_1 = require("./business");
|
|
38
|
+
function urlencode(str) {
|
|
39
|
+
return str.replace(/-/g, '%2d').replace(/_/g, '%5f').replace(/~/g, '%7e');
|
|
40
|
+
}
|
|
41
|
+
const validRegistrationOptions = (config) => (config === null || config === void 0 ? void 0 : config.phoneNumberCountryCode) &&
|
|
42
|
+
config.phoneNumberNationalNumber &&
|
|
43
|
+
config.phoneNumberMobileCountryCode;
|
|
44
|
+
const makeRegistrationSocket = (config) => {
|
|
45
|
+
const sock = (0, business_1.makeBusinessSocket)(config);
|
|
46
|
+
const register = async (code) => {
|
|
47
|
+
if (!validRegistrationOptions(config.auth.creds.registration)) {
|
|
48
|
+
throw new Error('please specify the registration options');
|
|
49
|
+
}
|
|
50
|
+
const result = await mobileRegister({ ...sock.authState.creds, ...sock.authState.creds.registration, code }, config.options);
|
|
51
|
+
sock.authState.creds.me = {
|
|
52
|
+
id: (0, WABinary_1.jidEncode)(result.login, 's.whatsapp.net'),
|
|
53
|
+
name: '~'
|
|
54
|
+
};
|
|
55
|
+
sock.authState.creds.registered = true;
|
|
56
|
+
sock.ev.emit('creds.update', sock.authState.creds);
|
|
57
|
+
return result;
|
|
58
|
+
};
|
|
59
|
+
const requestRegistrationCode = async (registrationOptions) => {
|
|
60
|
+
registrationOptions = registrationOptions || config.auth.creds.registration;
|
|
61
|
+
if (!validRegistrationOptions(registrationOptions)) {
|
|
62
|
+
throw new Error('Invalid registration options');
|
|
63
|
+
}
|
|
64
|
+
sock.authState.creds.registration = registrationOptions;
|
|
65
|
+
sock.ev.emit('creds.update', sock.authState.creds);
|
|
66
|
+
return mobileRegisterCode({ ...config.auth.creds, ...registrationOptions }, config.options);
|
|
67
|
+
};
|
|
68
|
+
return {
|
|
69
|
+
...sock,
|
|
70
|
+
register,
|
|
71
|
+
requestRegistrationCode,
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
exports.makeRegistrationSocket = makeRegistrationSocket;
|
|
75
|
+
function convertBufferToUrlHex(buffer) {
|
|
76
|
+
var id = '';
|
|
77
|
+
buffer.forEach((x) => {
|
|
78
|
+
id += `%${x.toString(16).padStart(2, '0').toLowerCase()}`;
|
|
79
|
+
});
|
|
80
|
+
return id;
|
|
81
|
+
}
|
|
82
|
+
function registrationParams(params) {
|
|
83
|
+
const e_regid = Buffer.alloc(4);
|
|
84
|
+
e_regid.writeInt32BE(params.registrationId);
|
|
85
|
+
const e_skey_id = Buffer.alloc(3);
|
|
86
|
+
e_skey_id.writeInt16BE(params.signedPreKey.keyId);
|
|
87
|
+
params.phoneNumberCountryCode = params.phoneNumberCountryCode.replace('+', '').trim();
|
|
88
|
+
params.phoneNumberNationalNumber = params.phoneNumberNationalNumber.replace(/[/-\s)(]/g, '').trim();
|
|
89
|
+
return {
|
|
90
|
+
cc: params.phoneNumberCountryCode,
|
|
91
|
+
in: params.phoneNumberNationalNumber,
|
|
92
|
+
Rc: '0',
|
|
93
|
+
lg: 'en',
|
|
94
|
+
lc: 'GB',
|
|
95
|
+
mistyped: '6',
|
|
96
|
+
authkey: Buffer.from(params.noiseKey.public).toString('base64url'),
|
|
97
|
+
e_regid: e_regid.toString('base64url'),
|
|
98
|
+
e_keytype: 'BQ',
|
|
99
|
+
e_ident: Buffer.from(params.signedIdentityKey.public).toString('base64url'),
|
|
100
|
+
e_skey_id: 'AAAA',
|
|
101
|
+
e_skey_val: Buffer.from(params.signedPreKey.keyPair.public).toString('base64url'),
|
|
102
|
+
e_skey_sig: Buffer.from(params.signedPreKey.signature).toString('base64url'),
|
|
103
|
+
fdid: params.phoneId,
|
|
104
|
+
network_ratio_type: '1',
|
|
105
|
+
expid: params.deviceId,
|
|
106
|
+
simnum: '1',
|
|
107
|
+
hasinrc: '1',
|
|
108
|
+
pid: Math.floor(Math.random() * 1000).toString(),
|
|
109
|
+
id: convertBufferToUrlHex(params.identityId),
|
|
110
|
+
backup_token: convertBufferToUrlHex(params.backupToken),
|
|
111
|
+
token: (0, crypto_1.md5)(Buffer.concat([Defaults_1.MOBILE_TOKEN, Buffer.from(params.phoneNumberNationalNumber)])).toString('hex'),
|
|
112
|
+
fraud_checkpoint_code: params.captcha,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
exports.registrationParams = registrationParams;
|
|
116
|
+
function mobileRegisterCode(params, fetchOptions) {
|
|
117
|
+
return mobileRegisterFetch('/code', {
|
|
118
|
+
params: {
|
|
119
|
+
...registrationParams(params),
|
|
120
|
+
mcc: `${params.phoneNumberMobileCountryCode}`.padStart(3, '0'),
|
|
121
|
+
mnc: `${params.phoneNumberMobileNetworkCode || '001'}`.padStart(3, '0'),
|
|
122
|
+
sim_mcc: '000',
|
|
123
|
+
sim_mnc: '000',
|
|
124
|
+
method: (params === null || params === void 0 ? void 0 : params.method) || 'sms',
|
|
125
|
+
reason: '',
|
|
126
|
+
hasav: '1'
|
|
127
|
+
},
|
|
128
|
+
...fetchOptions,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
exports.mobileRegisterCode = mobileRegisterCode;
|
|
132
|
+
function mobileRegisterExists(params, fetchOptions) {
|
|
133
|
+
return mobileRegisterFetch('/exist', {
|
|
134
|
+
params: registrationParams(params),
|
|
135
|
+
...fetchOptions
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
exports.mobileRegisterExists = mobileRegisterExists;
|
|
139
|
+
async function mobileRegister(params, fetchOptions) {
|
|
140
|
+
return mobileRegisterFetch('/register', {
|
|
141
|
+
params: { ...registrationParams(params), code: params.code.replace('-', '') },
|
|
142
|
+
...fetchOptions,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
exports.mobileRegister = mobileRegister;
|
|
146
|
+
function mobileRegisterEncrypt(data) {
|
|
147
|
+
const keypair = crypto_1.Curve.generateKeyPair();
|
|
148
|
+
const key = crypto_1.Curve.sharedKey(keypair.private, Defaults_1.REGISTRATION_PUBLIC_KEY);
|
|
149
|
+
const buffer = (0, crypto_1.aesEncryptGCM)(Buffer.from(data), new Uint8Array(key), Buffer.alloc(12), Buffer.alloc(0));
|
|
150
|
+
return Buffer.concat([Buffer.from(keypair.public), buffer]).toString('base64url');
|
|
151
|
+
}
|
|
152
|
+
exports.mobileRegisterEncrypt = mobileRegisterEncrypt;
|
|
153
|
+
async function mobileRegisterFetch(path, opts = {}) {
|
|
154
|
+
let url = `${Defaults_1.MOBILE_REGISTRATION_ENDPOINT}${path}`;
|
|
155
|
+
if (opts.params) {
|
|
156
|
+
const parameter = [];
|
|
157
|
+
for (const param in opts.params) {
|
|
158
|
+
if (opts.params[param] !== null && opts.params[param] !== undefined) {
|
|
159
|
+
parameter.push(param + '=' + urlencode(opts.params[param]));
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
url += `?${parameter.join('&')}`;
|
|
163
|
+
delete opts.params;
|
|
164
|
+
}
|
|
165
|
+
if (!opts.headers) {
|
|
166
|
+
opts.headers = {};
|
|
167
|
+
}
|
|
168
|
+
opts.headers['User-Agent'] = Defaults_1.MOBILE_USERAGENT;
|
|
169
|
+
const response = await (0, axios_1.default)(url, opts);
|
|
170
|
+
var json = response.data;
|
|
171
|
+
if (response.status > 300 || json.reason) {
|
|
172
|
+
throw json;
|
|
173
|
+
}
|
|
174
|
+
if (json.status && !['ok', 'sent'].includes(json.status)) {
|
|
175
|
+
throw json;
|
|
176
|
+
}
|
|
177
|
+
return json;
|
|
178
|
+
}
|
|
179
|
+
exports.mobileRegisterFetch = mobileRegisterFetch;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export const __esModule: boolean;
|
|
2
|
+
/**
|
|
3
|
+
* Connects to WA servers and performs:
|
|
4
|
+
* - simple queries (no retry mechanism, wait for connection establishment)
|
|
5
|
+
* - listen to messages and emit events
|
|
6
|
+
* - query phone connection
|
|
7
|
+
*/
|
|
8
|
+
export function makeSocket(config: any): {
|
|
9
|
+
type: string;
|
|
10
|
+
ws: any;
|
|
11
|
+
ev: any;
|
|
12
|
+
authState: {
|
|
13
|
+
creds: any;
|
|
14
|
+
keys: any;
|
|
15
|
+
};
|
|
16
|
+
signalRepository: any;
|
|
17
|
+
readonly user: any;
|
|
18
|
+
generateMessageTag: () => string;
|
|
19
|
+
query: (node: any, timeoutMs: any) => Promise<any>;
|
|
20
|
+
waitForMessage: (msgId: any, timeoutMs?: any) => Promise<any>;
|
|
21
|
+
waitForSocketOpen: () => Promise<void>;
|
|
22
|
+
sendRawMessage: (data: any) => Promise<void>;
|
|
23
|
+
sendNode: (frame: any) => Promise<void>;
|
|
24
|
+
logout: (msg: any) => Promise<void>;
|
|
25
|
+
end: (error: any) => void;
|
|
26
|
+
onUnexpectedError: (err: any, msg: any) => void;
|
|
27
|
+
uploadPreKeys: (count?: 812) => Promise<void>;
|
|
28
|
+
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
29
|
+
requestPairingCode: (phoneNumber: any, pairCode?: string) => Promise<any>;
|
|
30
|
+
/** Waits for the connection to WA to reach a state */
|
|
31
|
+
waitForConnectionUpdate: any;
|
|
32
|
+
sendWAMBuffer: (wamBuffer: any) => Promise<any>;
|
|
33
|
+
};
|