@pontalabs/baileys 1.0.10 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +96 -85
- package/lib/Defaults/connection.js +39 -0
- package/lib/Defaults/constants.js +50 -0
- package/lib/Defaults/history.js +13 -0
- package/lib/Defaults/index.js +36 -151
- package/lib/Defaults/media.js +43 -0
- package/lib/Defaults/phonenumber-mcc.json +221 -221
- package/lib/Defaults/prefix.js +12 -0
- package/lib/Defaults/vialeys-version.json +7 -0
- package/lib/Signal/Group/ciphertext-message.js +10 -15
- package/lib/Signal/Group/group-session-builder.js +34 -60
- package/lib/Signal/Group/group_cipher.js +69 -76
- package/lib/Signal/Group/index.js +41 -60
- package/lib/Signal/Group/keyhelper.js +12 -57
- package/lib/Signal/Group/sender-chain-key.js +20 -33
- package/lib/Signal/Group/sender-key-distribution-message.js +43 -48
- package/lib/Signal/Group/sender-key-message.js +58 -53
- package/lib/Signal/Group/sender-key-name.js +21 -31
- package/lib/Signal/Group/sender-key-record.js +21 -34
- package/lib/Signal/Group/sender-key-state.js +59 -106
- package/lib/Signal/Group/sender-message-key.js +16 -21
- package/lib/Signal/libsignal.js +282 -203
- package/lib/Signal/lid-mapping.js +164 -184
- package/lib/Socket/Client/index.js +31 -22
- package/lib/Socket/Client/types.js +9 -15
- package/lib/Socket/Client/websocket.js +42 -37
- package/lib/Socket/business.js +212 -336
- package/lib/Socket/chats.js +696 -940
- package/lib/Socket/community.js +454 -369
- package/lib/Socket/groups.js +278 -280
- package/lib/Socket/index.js +9 -21
- package/lib/Socket/messages-recv.js +1027 -1570
- package/lib/Socket/messages-send.js +1180 -1136
- package/lib/Socket/mex.js +59 -0
- package/lib/Socket/newsletter.js +193 -251
- package/lib/Socket/socket.js +758 -898
- package/lib/Store/index.js +35 -24
- package/lib/Store/make-cache-manager-store.js +53 -66
- package/lib/Store/make-in-memory-store.js +319 -325
- package/lib/Store/make-ordered-dictionary.js +49 -57
- package/lib/Store/object-repository.js +10 -15
- package/lib/Types/Auth.js +2 -3
- package/lib/Types/Bussines.js +2 -3
- package/lib/Types/Call.js +2 -3
- package/lib/Types/Chat.js +10 -9
- package/lib/Types/Contact.js +2 -3
- package/lib/Types/Events.js +2 -3
- package/lib/Types/GroupMetadata.js +2 -3
- package/lib/Types/Label.js +6 -12
- package/lib/Types/LabelAssociation.js +4 -13
- package/lib/Types/Message.js +10 -18
- package/lib/Types/MexUpdates.js +15 -18
- package/lib/Types/Newsletter.js +26 -34
- package/lib/Types/Product.js +2 -3
- package/lib/Types/Signal.js +2 -3
- package/lib/Types/Socket.js +2 -3
- package/lib/Types/State.js +8 -13
- package/lib/Types/USync.js +2 -3
- package/lib/Types/index.js +49 -40
- package/lib/Utils/auth-utils.js +190 -495
- package/lib/Utils/browser-utils.js +29 -0
- package/lib/Utils/business.js +177 -199
- package/lib/Utils/chat-utils.js +711 -624
- package/lib/Utils/crypto.js +116 -161
- package/lib/Utils/decode-wa-message.js +225 -321
- package/lib/Utils/event-buffer.js +363 -405
- package/lib/Utils/generics.js +318 -472
- package/lib/Utils/history.js +72 -76
- package/lib/Utils/index.js +49 -41
- package/lib/Utils/link-preview.js +59 -103
- package/lib/Utils/logger.js +4 -7
- package/lib/Utils/lt-hash.js +29 -42
- package/lib/Utils/make-mutex.js +26 -42
- package/lib/Utils/message-retry-manager.js +134 -160
- package/lib/Utils/messages-media.js +665 -731
- package/lib/Utils/messages.js +518 -1
- package/lib/Utils/noise-handler.js +127 -125
- package/lib/Utils/pre-key-manager.js +86 -0
- package/lib/Utils/process-message.js +739 -351
- package/lib/Utils/signal.js +146 -129
- package/lib/Utils/use-multi-file-auth-state.js +68 -135
- package/lib/Utils/validate-connection.js +183 -142
- package/lib/Utils/vialeys-event-stream.js +41 -0
- package/lib/WABinary/constants.js +1281 -1289
- package/lib/WABinary/decode.js +145 -200
- package/lib/WABinary/encode.js +149 -202
- package/lib/WABinary/generic-utils.js +79 -97
- package/lib/WABinary/index.js +36 -25
- package/lib/WABinary/jid-utils.js +91 -123
- package/lib/WABinary/types.js +2 -3
- package/lib/WAM/BinaryInfo.js +8 -13
- package/lib/WAM/constants.js +16584 -11464
- package/lib/WAM/encode.js +117 -133
- package/lib/WAM/index.js +34 -23
- package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +62 -69
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +11 -25
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +32 -44
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +13 -23
- package/lib/WAUSync/Protocols/USyncLIDProtocol.js +24 -38
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +17 -31
- package/lib/WAUSync/Protocols/index.js +37 -26
- package/lib/WAUSync/USyncQuery.js +66 -66
- package/lib/WAUSync/USyncUser.js +13 -18
- package/lib/WAUSync/index.js +34 -23
- package/lib/index.js +95 -28
- package/package.json +4 -3
- package/lib/Defaults/baileys-version.json +0 -3
- package/lib/Signal/Group/queue-job.d.ts +0 -1
- package/lib/Signal/Group/queue-job.js +0 -57
- package/lib/Socket/usync.d.ts +0 -37
- package/lib/Socket/usync.js +0 -83
- package/lib/Utils/baileys-event-stream.d.ts +0 -18
- package/lib/Utils/baileys-event-stream.js +0 -70
- package/lib/Utils/signal-housekeeping.d.ts +0 -19
- package/lib/Utils/signal-housekeeping.js +0 -73
- package/lib/Utils/use-mongo-file-auth-state.d.ts +0 -6
- package/lib/Utils/use-mongo-file-auth-state.js +0 -84
- package/lib/Utils/use-single-file-auth-state.d.ts +0 -13
- package/lib/Utils/use-single-file-auth-state.js +0 -80
package/lib/Utils/generics.js
CHANGED
|
@@ -1,559 +1,405 @@
|
|
|
1
|
-
"use strict"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
30
|
-
return (mod && mod.__esModule) ? mod : { "default": mod }
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
Object.defineProperty(exports, "__esModule", { value: true })
|
|
34
|
-
|
|
35
|
-
const boom_1 = require("@hapi/boom")
|
|
36
|
-
const axios_1 = __importDefault(require("axios"))
|
|
37
|
-
const crypto_1 = require("crypto")
|
|
38
|
-
const crypto_2 = require("./crypto")
|
|
39
|
-
const os_1 = require("os")
|
|
40
|
-
const WAProto_1 = require("../../WAProto")
|
|
41
|
-
const baileysVersion = [2, 3000, 1027934701];
|
|
42
|
-
const Types_1 = require("../Types")
|
|
43
|
-
const WABinary_1 = require("../WABinary")
|
|
44
|
-
|
|
45
|
-
const COMPANION_PLATFORM_MAP = {
|
|
46
|
-
'Chrome': '49',
|
|
47
|
-
'Edge': '50',
|
|
48
|
-
'Firefox': '51',
|
|
49
|
-
'Opera': '53',
|
|
50
|
-
'Safari': '54',
|
|
51
|
-
'Brave': '1.79.112',
|
|
52
|
-
'Vivaldi': '6.2.3105.58',
|
|
53
|
-
'Tor': '12.5.3',
|
|
54
|
-
'Yandex': '23.7.1',
|
|
55
|
-
'Falkon': '22.08.3',
|
|
56
|
-
'Epiphany': '44.2'
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const PLATFORM_MAP = {
|
|
60
|
-
'aix': 'AIX',
|
|
61
|
-
'darwin': 'Mac OS',
|
|
62
|
-
'win32': 'Windows',
|
|
63
|
-
'android': 'Android',
|
|
64
|
-
'freebsd': 'FreeBSD',
|
|
65
|
-
'openbsd': 'OpenBSD',
|
|
66
|
-
'sunos': 'Solaris',
|
|
67
|
-
'linux': 'Linux',
|
|
68
|
-
'ubuntu': 'Ubuntu',
|
|
69
|
-
'ios': 'iOS',
|
|
70
|
-
'baileys': 'Baileys',
|
|
71
|
-
'chromeos': 'Chrome OS',
|
|
72
|
-
'tizen': 'Tizen',
|
|
73
|
-
'watchos': 'watchOS',
|
|
74
|
-
'wearos': 'Wear OS',
|
|
75
|
-
'harmonyos': 'HarmonyOS',
|
|
76
|
-
'kaios': 'KaiOS',
|
|
77
|
-
'smarttv': 'Smart TV',
|
|
78
|
-
'raspberrypi': 'Raspberry Pi OS',
|
|
79
|
-
'symbian': 'Symbian',
|
|
80
|
-
'blackberry': 'Blackberry OS',
|
|
81
|
-
'windowsphone': 'Windows Phone'
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const PLATFORM_VERSIONS = {
|
|
85
|
-
'ubuntu': '22.04.4',
|
|
86
|
-
'darwin': '18.5',
|
|
87
|
-
'win32': '10.0.22631',
|
|
88
|
-
'android': '14.0.0',
|
|
89
|
-
'freebsd': '13.2',
|
|
90
|
-
'openbsd': '7.3',
|
|
91
|
-
'sunos': '11',
|
|
92
|
-
'linux': '6.5',
|
|
93
|
-
'ios': '18.2',
|
|
94
|
-
'baileys': '6.5.0',
|
|
95
|
-
'chromeos': '117.0.5938.132',
|
|
96
|
-
'tizen': '6.5',
|
|
97
|
-
'watchos': '10.1',
|
|
98
|
-
'wearos': '4.1',
|
|
99
|
-
'harmonyos': '4.0.0',
|
|
100
|
-
'kaios': '3.1',
|
|
101
|
-
'smarttv': '23.3.1',
|
|
102
|
-
'raspberrypi': '11 (Bullseye)',
|
|
103
|
-
'symbian': '3',
|
|
104
|
-
'blackberry': '10.3.3',
|
|
105
|
-
'windowsphone': '8.1'
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const Browsers = {
|
|
109
|
-
ubuntu: (browser) => {
|
|
110
|
-
return [PLATFORM_MAP['ubuntu'], browser, PLATFORM_VERSIONS['ubuntu']]
|
|
111
|
-
},
|
|
112
|
-
macOS: (browser) => {
|
|
113
|
-
return [PLATFORM_MAP['darwin'], browser, PLATFORM_VERSIONS['darwin']]
|
|
114
|
-
},
|
|
115
|
-
windows: (browser) => {
|
|
116
|
-
return [PLATFORM_MAP['win32'], browser, PLATFORM_VERSIONS['win32']]
|
|
117
|
-
},
|
|
118
|
-
linux: (browser) => {
|
|
119
|
-
return [PLATFORM_MAP['linux'], browser, PLATFORM_VERSIONS['linux']]
|
|
120
|
-
},
|
|
121
|
-
solaris: (browser) => {
|
|
122
|
-
return [PLATFORM_MAP['sunos'], browser, PLATFORM_VERSIONS['sunos']]
|
|
123
|
-
},
|
|
124
|
-
baileys: (browser) => {
|
|
125
|
-
return [PLATFORM_MAP['baileys'], browser, PLATFORM_VERSIONS['baileys']]
|
|
126
|
-
},
|
|
127
|
-
android: (browser) => {
|
|
128
|
-
return [PLATFORM_MAP['android'], browser, PLATFORM_VERSIONS['android']]
|
|
129
|
-
},
|
|
130
|
-
iOS: (browser) => {
|
|
131
|
-
return [PLATFORM_MAP['ios'], browser, PLATFORM_VERSIONS['ios']]
|
|
132
|
-
},
|
|
133
|
-
kaiOS: (browser) => {
|
|
134
|
-
return [PLATFORM_MAP['kaios'], browser, PLATFORM_VERSIONS['kaios']]
|
|
135
|
-
},
|
|
136
|
-
chromeOS: (browser) => {
|
|
137
|
-
return [PLATFORM_MAP['chromeos'], browser, PLATFORM_VERSIONS['chromeos']]
|
|
138
|
-
},
|
|
139
|
-
appropriate: (browser) => {
|
|
140
|
-
const platform = os_1.platform()
|
|
141
|
-
const platformName = PLATFORM_MAP[platform] || 'Unknown OS'
|
|
142
|
-
return [platformName, browser, PLATFORM_VERSIONS[platform] || 'latest']
|
|
143
|
-
},
|
|
144
|
-
custom: (platform, browser, version) => {
|
|
145
|
-
const platformName = PLATFORM_MAP[platform.toLowerCase()] || platform
|
|
146
|
-
return [platformName, browser, version || PLATFORM_VERSIONS[platform] || 'latest']
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const { Boom: Boom } = require("@hapi/boom");
|
|
4
|
+
const { createHash: createHash, randomBytes: randomBytes } = require("crypto");
|
|
5
|
+
const {
|
|
6
|
+
jidDecode: jidDecode,
|
|
7
|
+
getAllBinaryNodeChildren: getAllBinaryNodeChildren,
|
|
8
|
+
} = require("../WABinary");
|
|
9
|
+
const { sha256: sha256 } = require("./crypto");
|
|
10
|
+
const { proto: proto } = require("../../WAProto");
|
|
11
|
+
const { version: version } = require("../Defaults/vialeys-version.json");
|
|
12
|
+
const { DisconnectReason: DisconnectReason } = require("../Types");
|
|
13
|
+
const hwaifu = async () => {
|
|
14
|
+
try {
|
|
15
|
+
const response = await fetch(
|
|
16
|
+
"https://raw.githubusercontent.com/ramadanny/json/refs/heads/main/hwaifu.json",
|
|
17
|
+
{ method: "GET" }
|
|
18
|
+
);
|
|
19
|
+
const data = await response.json();
|
|
20
|
+
if (Array.isArray(data)) {
|
|
21
|
+
const random = data[Math.floor(Math.random() * data.length)];
|
|
22
|
+
return random;
|
|
23
|
+
} else {
|
|
24
|
+
throw new Boom("Data is not in array format.");
|
|
25
|
+
}
|
|
26
|
+
} catch (error) {
|
|
27
|
+
throw new Boom(error.message);
|
|
147
28
|
}
|
|
148
|
-
}
|
|
149
|
-
|
|
29
|
+
};
|
|
150
30
|
const BufferJSON = {
|
|
151
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
152
31
|
replacer: (k, value) => {
|
|
153
|
-
if (Buffer.isBuffer(value) || value instanceof Uint8Array || value?.type ===
|
|
154
|
-
return {
|
|
32
|
+
if (Buffer.isBuffer(value) || value instanceof Uint8Array || value?.type === "Buffer") {
|
|
33
|
+
return {
|
|
34
|
+
type: "Buffer",
|
|
35
|
+
data: Buffer.from(value?.data || value).toString("base64"),
|
|
36
|
+
};
|
|
155
37
|
}
|
|
156
|
-
return value
|
|
38
|
+
return value;
|
|
157
39
|
},
|
|
158
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
159
40
|
reviver: (_, value) => {
|
|
160
|
-
if (
|
|
161
|
-
|
|
162
|
-
|
|
41
|
+
if (
|
|
42
|
+
typeof value === "object" &&
|
|
43
|
+
value !== null &&
|
|
44
|
+
value.type === "Buffer" &&
|
|
45
|
+
typeof value.data === "string"
|
|
46
|
+
) {
|
|
47
|
+
return Buffer.from(value.data, "base64");
|
|
163
48
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
176
|
-
|
|
49
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
50
|
+
const keys = Object.keys(value);
|
|
51
|
+
if (keys.length > 0 && keys.every((k) => !isNaN(parseInt(k, 10)))) {
|
|
52
|
+
const values = Object.values(value);
|
|
53
|
+
if (values.every((v) => typeof v === "number")) {
|
|
54
|
+
return Buffer.from(values);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return value;
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
const getKeyAuthor = (key, meId = "me") =>
|
|
62
|
+
(key?.fromMe
|
|
63
|
+
? meId
|
|
64
|
+
: key?.participantAlt || key?.remoteJidAlt || key?.participant || key?.remoteJid) || "";
|
|
177
65
|
const writeRandomPadMax16 = (msg) => {
|
|
178
|
-
const pad =
|
|
179
|
-
const padLength = (pad[0] &
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
|
|
66
|
+
const pad = randomBytes(1);
|
|
67
|
+
const padLength = (pad[0] & 15) + 1;
|
|
68
|
+
return Buffer.concat([msg, Buffer.alloc(padLength, padLength)]);
|
|
69
|
+
};
|
|
184
70
|
const unpadRandomMax16 = (e) => {
|
|
185
|
-
const t = new Uint8Array(e)
|
|
71
|
+
const t = new Uint8Array(e);
|
|
186
72
|
if (0 === t.length) {
|
|
187
|
-
throw new Error(
|
|
73
|
+
throw new Error("unpadPkcs7 given empty bytes");
|
|
188
74
|
}
|
|
189
|
-
var r = t[t.length - 1]
|
|
75
|
+
var r = t[t.length - 1];
|
|
190
76
|
if (r > t.length) {
|
|
191
|
-
throw new Error(`unpad given ${t.length} bytes, but pad is ${r}`)
|
|
77
|
+
throw new Error(`unpad given ${t.length} bytes, but pad is ${r}`);
|
|
192
78
|
}
|
|
193
|
-
return new Uint8Array(t.buffer, t.byteOffset, t.length - r)
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
const
|
|
197
|
-
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
const encodeNewsletterMessage = (message) => {
|
|
201
|
-
return WAProto_1.proto.Message.encode(message).finish()
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
const generateRegistrationId = () => {
|
|
205
|
-
return Uint16Array.from(crypto_1.randomBytes(2))[0] & 16383
|
|
206
|
-
}
|
|
207
|
-
|
|
79
|
+
return new Uint8Array(t.buffer, t.byteOffset, t.length - r);
|
|
80
|
+
};
|
|
81
|
+
const encodeWAMessage = (message) => writeRandomPadMax16(proto.Message.encode(message).finish());
|
|
82
|
+
const encodeNewsletterMessage = (message) => proto.Message.encode(message).finish();
|
|
83
|
+
const generateRegistrationId = () => Uint16Array.from(randomBytes(2))[0] & 16383;
|
|
208
84
|
const encodeBigEndian = (e, t = 4) => {
|
|
209
|
-
let r = e
|
|
210
|
-
const a = new Uint8Array(t)
|
|
85
|
+
let r = e;
|
|
86
|
+
const a = new Uint8Array(t);
|
|
211
87
|
for (let i = t - 1; i >= 0; i--) {
|
|
212
|
-
a[i] = 255 & r
|
|
213
|
-
r >>>= 8
|
|
88
|
+
a[i] = 255 & r;
|
|
89
|
+
r >>>= 8;
|
|
214
90
|
}
|
|
215
|
-
return a
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
const debouncedTimeout = (intervalMs = 1000, task) => {
|
|
224
|
-
let timeout
|
|
91
|
+
return a;
|
|
92
|
+
};
|
|
93
|
+
const toNumber = (t) =>
|
|
94
|
+
typeof t === "object" && t ? ("toNumber" in t ? t.toNumber() : t.low) : t || 0;
|
|
95
|
+
const unixTimestampSeconds = (date = new Date()) => Math.floor(date.getTime() / 1e3);
|
|
96
|
+
const debouncedTimeout = (intervalMs = 1e3, task) => {
|
|
97
|
+
let timeout;
|
|
225
98
|
return {
|
|
226
99
|
start: (newIntervalMs, newTask) => {
|
|
227
|
-
task = newTask || task
|
|
228
|
-
intervalMs = newIntervalMs || intervalMs
|
|
229
|
-
timeout && clearTimeout(timeout)
|
|
230
|
-
timeout = setTimeout(() => task?.(), intervalMs)
|
|
100
|
+
task = newTask || task;
|
|
101
|
+
intervalMs = newIntervalMs || intervalMs;
|
|
102
|
+
timeout && clearTimeout(timeout);
|
|
103
|
+
timeout = setTimeout(() => task?.(), intervalMs);
|
|
231
104
|
},
|
|
232
105
|
cancel: () => {
|
|
233
|
-
timeout && clearTimeout(timeout)
|
|
234
|
-
timeout = undefined
|
|
106
|
+
timeout && clearTimeout(timeout);
|
|
107
|
+
timeout = undefined;
|
|
235
108
|
},
|
|
236
|
-
setTask: (newTask) => task = newTask,
|
|
237
|
-
setInterval: (newInterval) => intervalMs = newInterval
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
const delay = (ms) => {
|
|
242
|
-
return delayCancellable(ms).delay
|
|
243
|
-
}
|
|
244
|
-
|
|
109
|
+
setTask: (newTask) => (task = newTask),
|
|
110
|
+
setInterval: (newInterval) => (intervalMs = newInterval),
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
const delay = (ms) => delayCancellable(ms).delay;
|
|
245
114
|
const delayCancellable = (ms) => {
|
|
246
|
-
const stack = new Error().stack
|
|
247
|
-
let timeout
|
|
248
|
-
let reject
|
|
115
|
+
const stack = new Error().stack;
|
|
116
|
+
let timeout;
|
|
117
|
+
let reject;
|
|
249
118
|
const delay = new Promise((resolve, _reject) => {
|
|
250
|
-
timeout = setTimeout(resolve, ms)
|
|
251
|
-
reject = _reject
|
|
252
|
-
})
|
|
119
|
+
timeout = setTimeout(resolve, ms);
|
|
120
|
+
reject = _reject;
|
|
121
|
+
});
|
|
253
122
|
const cancel = () => {
|
|
254
|
-
clearTimeout(timeout)
|
|
255
|
-
reject(new
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}
|
|
260
|
-
}))
|
|
261
|
-
}
|
|
262
|
-
return { delay, cancel }
|
|
263
|
-
}
|
|
264
|
-
|
|
123
|
+
clearTimeout(timeout);
|
|
124
|
+
reject(new Boom("Cancelled", { statusCode: 500, data: { stack: stack } }));
|
|
125
|
+
};
|
|
126
|
+
return { delay: delay, cancel: cancel };
|
|
127
|
+
};
|
|
265
128
|
async function promiseTimeout(ms, promise) {
|
|
266
129
|
if (!ms) {
|
|
267
|
-
return new Promise(promise)
|
|
130
|
+
return new Promise(promise);
|
|
268
131
|
}
|
|
269
|
-
const stack = new Error().stack
|
|
270
|
-
|
|
271
|
-
const { delay, cancel } = delayCancellable(ms)
|
|
132
|
+
const stack = new Error().stack;
|
|
133
|
+
const { delay: delay, cancel: cancel } = delayCancellable(ms);
|
|
272
134
|
const p = new Promise((resolve, reject) => {
|
|
273
|
-
delay
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
135
|
+
delay
|
|
136
|
+
.then(() =>
|
|
137
|
+
reject(
|
|
138
|
+
new Boom("Timed Out", {
|
|
139
|
+
statusCode: DisconnectReason.timedOut,
|
|
140
|
+
data: { stack: stack },
|
|
141
|
+
})
|
|
142
|
+
)
|
|
143
|
+
)
|
|
144
|
+
.catch((err) => reject(err));
|
|
145
|
+
promise(resolve, reject);
|
|
146
|
+
}).finally(cancel);
|
|
147
|
+
return p;
|
|
282
148
|
}
|
|
283
|
-
|
|
284
149
|
const generateMessageID = (userId) => {
|
|
285
|
-
const data = Buffer.alloc(8 + 20 + 16)
|
|
286
|
-
data.writeBigUInt64BE(BigInt(Math.floor(Date.now() /
|
|
150
|
+
const data = Buffer.alloc(8 + 20 + 16);
|
|
151
|
+
data.writeBigUInt64BE(BigInt(Math.floor(Date.now() / 1e3)));
|
|
287
152
|
if (userId) {
|
|
288
|
-
const id =
|
|
153
|
+
const id = jidDecode(userId);
|
|
289
154
|
if (id?.user) {
|
|
290
|
-
data.write(id.user, 8)
|
|
291
|
-
data.write(
|
|
155
|
+
data.write(id.user, 8);
|
|
156
|
+
data.write("@c.us", 8 + id.user.length);
|
|
292
157
|
}
|
|
293
158
|
}
|
|
294
|
-
const random =
|
|
295
|
-
random.copy(data, 28)
|
|
296
|
-
const sha = asciiDecode([
|
|
297
|
-
const hash =
|
|
298
|
-
return sha + hash.toString(
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
// code is inspired by whatsmeow
|
|
159
|
+
const random = randomBytes(20);
|
|
160
|
+
random.copy(data, 28);
|
|
161
|
+
const sha = asciiDecode([80, 48, 78, 84, 52, 67, 49, 84]);
|
|
162
|
+
const hash = createHash("sha256").update(data).digest();
|
|
163
|
+
return sha + hash.toString("hex").toUpperCase().substring(0, 16);
|
|
164
|
+
};
|
|
302
165
|
const generateParticipantHashV2 = (participants) => {
|
|
303
|
-
participants.sort()
|
|
304
|
-
const sha256Hash =
|
|
305
|
-
return
|
|
166
|
+
participants.sort();
|
|
167
|
+
const sha256Hash = sha256(Buffer.from(participants.join(""))).toString("base64");
|
|
168
|
+
return "2:" + sha256Hash.slice(0, 6);
|
|
306
169
|
};
|
|
307
|
-
|
|
308
170
|
function bindWaitForEvent(ev, event) {
|
|
309
171
|
return async (check, timeoutMs) => {
|
|
310
|
-
let listener
|
|
311
|
-
let closeListener
|
|
312
|
-
await
|
|
313
|
-
closeListener = ({ connection, lastDisconnect }) => {
|
|
314
|
-
if (connection ===
|
|
315
|
-
reject(
|
|
316
|
-
||
|
|
172
|
+
let listener;
|
|
173
|
+
let closeListener;
|
|
174
|
+
await promiseTimeout(timeoutMs, (resolve, reject) => {
|
|
175
|
+
closeListener = ({ connection: connection, lastDisconnect: lastDisconnect }) => {
|
|
176
|
+
if (connection === "close") {
|
|
177
|
+
reject(
|
|
178
|
+
lastDisconnect?.error ||
|
|
179
|
+
new Boom("Connection Closed", {
|
|
180
|
+
statusCode: DisconnectReason.connectionClosed,
|
|
181
|
+
})
|
|
182
|
+
);
|
|
317
183
|
}
|
|
318
|
-
}
|
|
319
|
-
ev.on(
|
|
184
|
+
};
|
|
185
|
+
ev.on("connection.update", closeListener);
|
|
320
186
|
listener = async (update) => {
|
|
321
187
|
if (await check(update)) {
|
|
322
|
-
resolve()
|
|
188
|
+
resolve();
|
|
323
189
|
}
|
|
324
|
-
}
|
|
325
|
-
ev.on(event, listener)
|
|
190
|
+
};
|
|
191
|
+
ev.on(event, listener);
|
|
326
192
|
}).finally(() => {
|
|
327
|
-
ev.off(event, listener)
|
|
328
|
-
ev.off(
|
|
329
|
-
})
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
const bindWaitForConnectionUpdate = (ev) => {
|
|
334
|
-
return bindWaitForEvent(ev, 'connection.update')
|
|
193
|
+
ev.off(event, listener);
|
|
194
|
+
ev.off("connection.update", closeListener);
|
|
195
|
+
});
|
|
196
|
+
};
|
|
335
197
|
}
|
|
336
|
-
|
|
198
|
+
const bindWaitForConnectionUpdate = (ev) => bindWaitForEvent(ev, "connection.update");
|
|
337
199
|
const printQRIfNecessaryListener = (ev, logger) => {
|
|
338
|
-
ev.on(
|
|
200
|
+
ev.on("connection.update", async ({ qr: qr }) => {
|
|
339
201
|
if (qr) {
|
|
340
|
-
const QR = await Promise.resolve()
|
|
202
|
+
const QR = await Promise.resolve()
|
|
203
|
+
.then(() => __importStar(require("qrcode-terminal")))
|
|
204
|
+
.then((m) => m.default || m)
|
|
341
205
|
.catch(() => {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
QR?.generate(qr, { small: true })
|
|
206
|
+
logger.error("QR code terminal not added as dependency");
|
|
207
|
+
});
|
|
208
|
+
QR?.generate(qr, { small: true });
|
|
345
209
|
}
|
|
346
|
-
})
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* utility that fetches latest baileys version from the master branch.
|
|
351
|
-
* Use to ensure your WA connection is always on the latest version
|
|
352
|
-
*/
|
|
210
|
+
});
|
|
211
|
+
};
|
|
353
212
|
const fetchLatestBaileysVersion = async (options = {}) => {
|
|
354
|
-
const URL =
|
|
213
|
+
const URL =
|
|
214
|
+
"https://raw.githubusercontent.com/ramadanny/vialeys/refs/heads/master/lib/Defaults/vialeys-version.json";
|
|
215
|
+
try {
|
|
216
|
+
const result = await fetch(URL, { ...options, method: "GET" });
|
|
217
|
+
const json = await result.json();
|
|
218
|
+
return { version: json.version, isLatest: true };
|
|
219
|
+
} catch (error) {
|
|
220
|
+
return { version: version, isLatest: false, error: error };
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
const fetchLatestWaWebVersion = async (options = {}) => {
|
|
355
224
|
try {
|
|
356
|
-
const
|
|
225
|
+
const defaultHeaders = {
|
|
226
|
+
"sec-fetch-site": "none",
|
|
227
|
+
"User-Agent":
|
|
228
|
+
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
|
|
229
|
+
};
|
|
230
|
+
const headers = { ...defaultHeaders, ...options.headers };
|
|
231
|
+
const response = await fetch("https://web.whatsapp.com/sw.js", {
|
|
357
232
|
...options,
|
|
358
|
-
|
|
233
|
+
method: "GET",
|
|
234
|
+
headers: headers,
|
|
359
235
|
});
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
236
|
+
if (!response.ok) {
|
|
237
|
+
throw new Boom(`Failed to fetch sw.js: ${response.statusText}`, {
|
|
238
|
+
statusCode: response.status,
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
const data = await response.text();
|
|
242
|
+
const regex = /\\?"client_revision\\?":\s*(\d+)/;
|
|
243
|
+
const match = data.match(regex);
|
|
244
|
+
if (!match?.[1]) {
|
|
365
245
|
return {
|
|
366
|
-
version,
|
|
367
|
-
isLatest:
|
|
246
|
+
version: version,
|
|
247
|
+
isLatest: false,
|
|
248
|
+
error: {
|
|
249
|
+
message: "Could not find client revision in the fetched content",
|
|
250
|
+
},
|
|
368
251
|
};
|
|
369
|
-
} else {
|
|
370
|
-
throw new Error('Could not parse version from Defaults/index.ts');
|
|
371
252
|
}
|
|
253
|
+
const clientRevision = match[1];
|
|
254
|
+
return { version: [2, 3e3, +clientRevision], isLatest: true };
|
|
372
255
|
} catch (error) {
|
|
373
|
-
return {
|
|
374
|
-
version: baileysVersion,
|
|
375
|
-
isLatest: false,
|
|
376
|
-
error
|
|
377
|
-
};
|
|
256
|
+
return { version: version, isLatest: false, error: error };
|
|
378
257
|
}
|
|
379
258
|
};
|
|
380
|
-
|
|
381
|
-
/** unique message tag prefix for MD clients */
|
|
382
259
|
const generateMdTagPrefix = () => {
|
|
383
|
-
const bytes =
|
|
384
|
-
return `${bytes.readUInt16BE()}.${bytes.readUInt16BE(2)}
|
|
385
|
-
}
|
|
386
|
-
|
|
260
|
+
const bytes = randomBytes(4);
|
|
261
|
+
return `${bytes.readUInt16BE()}.${bytes.readUInt16BE(2)}-`;
|
|
262
|
+
};
|
|
387
263
|
const STATUS_MAP = {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
/**
|
|
395
|
-
* Given a type of receipt, returns what the new status of the message should be
|
|
396
|
-
* @param type type from receipt
|
|
397
|
-
*/
|
|
264
|
+
sender: proto.WebMessageInfo.Status.SERVER_ACK,
|
|
265
|
+
played: proto.WebMessageInfo.Status.PLAYED,
|
|
266
|
+
read: proto.WebMessageInfo.Status.READ,
|
|
267
|
+
"read-self": proto.WebMessageInfo.Status.READ,
|
|
268
|
+
};
|
|
398
269
|
const getStatusFromReceiptType = (type) => {
|
|
399
|
-
const status = STATUS_MAP[type]
|
|
400
|
-
if (typeof type ===
|
|
401
|
-
return
|
|
270
|
+
const status = STATUS_MAP[type];
|
|
271
|
+
if (typeof type === "undefined") {
|
|
272
|
+
return proto.WebMessageInfo.Status.DELIVERY_ACK;
|
|
402
273
|
}
|
|
403
|
-
return status
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
const CODE_MAP = {
|
|
407
|
-
conflict: Types_1.DisconnectReason.connectionReplaced
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
/**
|
|
411
|
-
* Stream errors generally provide a reason, map that to a baileys DisconnectReason
|
|
412
|
-
* @param reason the string reason given, eg. "conflict"
|
|
413
|
-
*/
|
|
274
|
+
return status;
|
|
275
|
+
};
|
|
276
|
+
const CODE_MAP = { conflict: DisconnectReason.connectionReplaced };
|
|
414
277
|
const getErrorCodeFromStreamError = (node) => {
|
|
415
|
-
const [reasonNode] =
|
|
416
|
-
let reason = reasonNode?.tag ||
|
|
417
|
-
const statusCode = +(node.attrs.code || CODE_MAP[reason] ||
|
|
418
|
-
if (statusCode ===
|
|
419
|
-
reason =
|
|
278
|
+
const [reasonNode] = getAllBinaryNodeChildren(node);
|
|
279
|
+
let reason = reasonNode?.tag || "unknown";
|
|
280
|
+
const statusCode = +(node.attrs.code || CODE_MAP[reason] || DisconnectReason.badSession);
|
|
281
|
+
if (statusCode === DisconnectReason.restartRequired) {
|
|
282
|
+
reason = "restart required";
|
|
420
283
|
}
|
|
421
|
-
return {
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
const getCallStatusFromNode = ({ tag, attrs }) => {
|
|
428
|
-
let status
|
|
284
|
+
return { reason: reason, statusCode: statusCode };
|
|
285
|
+
};
|
|
286
|
+
const getCallStatusFromNode = ({ tag: tag, attrs: attrs }) => {
|
|
287
|
+
let status;
|
|
429
288
|
switch (tag) {
|
|
430
|
-
case
|
|
431
|
-
case
|
|
432
|
-
status =
|
|
433
|
-
break
|
|
434
|
-
case
|
|
435
|
-
if (attrs.reason ===
|
|
436
|
-
status =
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
//fired when accepted/rejected/timeout/caller hangs up
|
|
440
|
-
status = 'terminate'
|
|
289
|
+
case "offer":
|
|
290
|
+
case "offer_notice":
|
|
291
|
+
status = "offer";
|
|
292
|
+
break;
|
|
293
|
+
case "terminate":
|
|
294
|
+
if (attrs.reason === "timeout") {
|
|
295
|
+
status = "timeout";
|
|
296
|
+
} else {
|
|
297
|
+
status = "terminate";
|
|
441
298
|
}
|
|
442
|
-
break
|
|
443
|
-
case
|
|
444
|
-
status =
|
|
445
|
-
break
|
|
446
|
-
case
|
|
447
|
-
status =
|
|
448
|
-
break
|
|
299
|
+
break;
|
|
300
|
+
case "reject":
|
|
301
|
+
status = "reject";
|
|
302
|
+
break;
|
|
303
|
+
case "accept":
|
|
304
|
+
status = "accept";
|
|
305
|
+
break;
|
|
449
306
|
default:
|
|
450
|
-
status =
|
|
451
|
-
break
|
|
307
|
+
status = "ringing";
|
|
308
|
+
break;
|
|
452
309
|
}
|
|
453
|
-
return status
|
|
454
|
-
}
|
|
455
|
-
|
|
310
|
+
return status;
|
|
311
|
+
};
|
|
312
|
+
const UNEXPECTED_SERVER_CODE_TEXT = "Unexpected server response: ";
|
|
456
313
|
const getCodeFromWSError = (error) => {
|
|
457
|
-
let statusCode = 500
|
|
458
|
-
if (error?.message?.includes(
|
|
459
|
-
const code = +
|
|
314
|
+
let statusCode = 500;
|
|
315
|
+
if (error?.message?.includes(UNEXPECTED_SERVER_CODE_TEXT)) {
|
|
316
|
+
const code = +error?.message.slice(UNEXPECTED_SERVER_CODE_TEXT.length);
|
|
460
317
|
if (!Number.isNaN(code) && code >= 400) {
|
|
461
|
-
statusCode = code
|
|
318
|
+
statusCode = code;
|
|
462
319
|
}
|
|
320
|
+
} else if (error?.code?.startsWith("E") || error?.message?.includes("timed out")) {
|
|
321
|
+
statusCode = 408;
|
|
463
322
|
}
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
return statusCode
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
/**
|
|
471
|
-
* Is the given platform WA business
|
|
472
|
-
* @param platform AuthenticationCreds.platform
|
|
473
|
-
*/
|
|
474
|
-
const isWABusinessPlatform = (platform) => {
|
|
475
|
-
return platform === 'smbi' || platform === 'smba'
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
323
|
+
return statusCode;
|
|
324
|
+
};
|
|
325
|
+
const isWABusinessPlatform = (platform) => platform === "smbi" || platform === "smba";
|
|
479
326
|
function trimUndefined(obj) {
|
|
480
327
|
for (const key in obj) {
|
|
481
|
-
if (typeof obj[key] ===
|
|
482
|
-
delete obj[key]
|
|
328
|
+
if (typeof obj[key] === "undefined") {
|
|
329
|
+
delete obj[key];
|
|
483
330
|
}
|
|
484
331
|
}
|
|
485
|
-
return obj
|
|
332
|
+
return obj;
|
|
486
333
|
}
|
|
487
|
-
|
|
488
334
|
function bytesToCrockford(buffer) {
|
|
489
|
-
let value = 0
|
|
490
|
-
let bitCount = 0
|
|
491
|
-
const crockford = []
|
|
335
|
+
let value = 0;
|
|
336
|
+
let bitCount = 0;
|
|
337
|
+
const crockford = [];
|
|
492
338
|
for (const element of buffer) {
|
|
493
|
-
value = (value << 8) | (element &
|
|
494
|
-
bitCount += 8
|
|
339
|
+
value = (value << 8) | (element & 255);
|
|
340
|
+
bitCount += 8;
|
|
495
341
|
while (bitCount >= 5) {
|
|
496
|
-
crockford.push(
|
|
497
|
-
|
|
342
|
+
crockford.push(
|
|
343
|
+
"123456789ABCDEFGHJKLMNPQRSTVWXYZ".charAt((value >>> (bitCount - 5)) & 31)
|
|
344
|
+
);
|
|
345
|
+
bitCount -= 5;
|
|
498
346
|
}
|
|
499
347
|
}
|
|
500
348
|
if (bitCount > 0) {
|
|
501
|
-
crockford.push(
|
|
349
|
+
crockford.push("123456789ABCDEFGHJKLMNPQRSTVWXYZ".charAt((value << (5 - bitCount)) & 31));
|
|
502
350
|
}
|
|
503
|
-
return crockford.join(
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
const fromUnicodeEscape = (escapedText) =>
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
351
|
+
return crockford.join("");
|
|
352
|
+
}
|
|
353
|
+
const toUnicodeEscape = (text) =>
|
|
354
|
+
text
|
|
355
|
+
.split("")
|
|
356
|
+
.map((char) => "\\u" + char.charCodeAt(0).toString(16).padStart(4, "0"))
|
|
357
|
+
.join("");
|
|
358
|
+
const fromUnicodeEscape = (escapedText) =>
|
|
359
|
+
escapedText.replace(/\\u[\dA-Fa-f]{4}/g, (match) =>
|
|
360
|
+
String.fromCharCode(parseInt(match.slice(2), 16))
|
|
361
|
+
);
|
|
514
362
|
const asciiEncode = (text) => {
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
}
|
|
518
|
-
|
|
363
|
+
var encoded = text.split("").map((c) => c.charCodeAt(0));
|
|
364
|
+
return encoded;
|
|
365
|
+
};
|
|
519
366
|
const asciiDecode = (...codes) => {
|
|
520
|
-
var codeArray = Array.isArray(codes[0]) ? codes[0] : codes
|
|
521
|
-
return codeArray.map(c => String.fromCharCode(c)).join("")
|
|
522
|
-
}
|
|
523
|
-
|
|
367
|
+
var codeArray = Array.isArray(codes[0]) ? codes[0] : codes;
|
|
368
|
+
return codeArray.map((c) => String.fromCharCode(c)).join("");
|
|
369
|
+
};
|
|
524
370
|
module.exports = {
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
}
|
|
371
|
+
hwaifu: hwaifu,
|
|
372
|
+
BufferJSON: BufferJSON,
|
|
373
|
+
getKeyAuthor: getKeyAuthor,
|
|
374
|
+
writeRandomPadMax16: writeRandomPadMax16,
|
|
375
|
+
unpadRandomMax16: unpadRandomMax16,
|
|
376
|
+
encodeWAMessage: encodeWAMessage,
|
|
377
|
+
encodeNewsletterMessage: encodeNewsletterMessage,
|
|
378
|
+
generateRegistrationId: generateRegistrationId,
|
|
379
|
+
encodeBigEndian: encodeBigEndian,
|
|
380
|
+
toNumber: toNumber,
|
|
381
|
+
unixTimestampSeconds: unixTimestampSeconds,
|
|
382
|
+
debouncedTimeout: debouncedTimeout,
|
|
383
|
+
delay: delay,
|
|
384
|
+
delayCancellable: delayCancellable,
|
|
385
|
+
promiseTimeout: promiseTimeout,
|
|
386
|
+
generateMessageID: generateMessageID,
|
|
387
|
+
generateParticipantHashV2: generateParticipantHashV2,
|
|
388
|
+
bindWaitForEvent: bindWaitForEvent,
|
|
389
|
+
bindWaitForConnectionUpdate: bindWaitForConnectionUpdate,
|
|
390
|
+
printQRIfNecessaryListener: printQRIfNecessaryListener,
|
|
391
|
+
fetchLatestBaileysVersion: fetchLatestBaileysVersion,
|
|
392
|
+
fetchLatestWaWebVersion: fetchLatestWaWebVersion,
|
|
393
|
+
generateMdTagPrefix: generateMdTagPrefix,
|
|
394
|
+
getStatusFromReceiptType: getStatusFromReceiptType,
|
|
395
|
+
getErrorCodeFromStreamError: getErrorCodeFromStreamError,
|
|
396
|
+
getCallStatusFromNode: getCallStatusFromNode,
|
|
397
|
+
getCodeFromWSError: getCodeFromWSError,
|
|
398
|
+
isWABusinessPlatform: isWABusinessPlatform,
|
|
399
|
+
trimUndefined: trimUndefined,
|
|
400
|
+
bytesToCrockford: bytesToCrockford,
|
|
401
|
+
toUnicodeEscape: toUnicodeEscape,
|
|
402
|
+
fromUnicodeEscape: fromUnicodeEscape,
|
|
403
|
+
asciiEncode: asciiEncode,
|
|
404
|
+
asciiDecode: asciiDecode,
|
|
405
|
+
};
|