ndikzv1 26.0.12
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/WAProto/index.d.ts +55057 -0
- package/WAProto/index.js +169661 -0
- package/WASignalGroup/GroupProtocol.js +1697 -0
- package/WASignalGroup/ciphertext_message.js +16 -0
- package/WASignalGroup/group_cipher.js +120 -0
- package/WASignalGroup/group_session_builder.js +46 -0
- package/WASignalGroup/index.js +5 -0
- package/WASignalGroup/keyhelper.js +21 -0
- package/WASignalGroup/protobufs.js +3 -0
- package/WASignalGroup/queue_job.js +69 -0
- package/WASignalGroup/sender_chain_key.js +50 -0
- package/WASignalGroup/sender_key_distribution_message.js +78 -0
- package/WASignalGroup/sender_key_message.js +92 -0
- package/WASignalGroup/sender_key_name.js +70 -0
- package/WASignalGroup/sender_key_record.js +56 -0
- package/WASignalGroup/sender_key_state.js +129 -0
- package/WASignalGroup/sender_message_key.js +39 -0
- package/engine-requirements.js +10 -0
- package/lib/Defaults/baileys-version.json +3 -0
- package/lib/Defaults/index.d.ts +282 -0
- package/lib/Defaults/index.js +122 -0
- package/lib/Defaults/phonenumber-mcc.json +223 -0
- package/lib/Signal/libsignal.d.ts +3 -0
- package/lib/Signal/libsignal.js +161 -0
- package/lib/Socket/Client/abstract-socket-client.d.ts +15 -0
- package/lib/Socket/Client/abstract-socket-client.js +13 -0
- package/lib/Socket/Client/index.d.ts +3 -0
- package/lib/Socket/Client/index.js +19 -0
- package/lib/Socket/Client/mobile-socket-client.d.ts +12 -0
- package/lib/Socket/Client/mobile-socket-client.js +65 -0
- package/lib/Socket/Client/web-socket-client.d.ts +12 -0
- package/lib/Socket/Client/web-socket-client.js +62 -0
- package/lib/Socket/business.d.ts +172 -0
- package/lib/Socket/business.js +260 -0
- package/lib/Socket/chats.d.ts +83 -0
- package/lib/Socket/chats.js +871 -0
- package/lib/Socket/groups.d.ts +124 -0
- package/lib/Socket/groups.js +332 -0
- package/lib/Socket/index.d.ts +174 -0
- package/lib/Socket/index.js +10 -0
- package/lib/Socket/messages-recv.d.ts +161 -0
- package/lib/Socket/messages-recv.js +1046 -0
- package/lib/Socket/messages-send.d.ts +151 -0
- package/lib/Socket/messages-send.js +806 -0
- package/lib/Socket/newsletter.d.ts +136 -0
- package/lib/Socket/newsletter.js +250 -0
- package/lib/Socket/registration.d.ts +266 -0
- package/lib/Socket/registration.js +166 -0
- package/lib/Socket/socket.d.ts +42 -0
- package/lib/Socket/socket.js +640 -0
- package/lib/Socket/usync.d.ts +36 -0
- package/lib/Socket/usync.js +70 -0
- package/lib/Store/index.d.ts +2 -0
- package/lib/Store/index.js +8 -0
- package/lib/Store/make-in-memory-store.d.ts +118 -0
- package/lib/Store/make-in-memory-store.js +431 -0
- package/lib/Store/make-ordered-dictionary.d.ts +13 -0
- package/lib/Store/make-ordered-dictionary.js +81 -0
- package/lib/Store/object-repository.d.ts +10 -0
- package/lib/Store/object-repository.js +27 -0
- package/lib/Types/Auth.d.ts +109 -0
- package/lib/Types/Auth.js +2 -0
- package/lib/Types/Call.d.ts +13 -0
- package/lib/Types/Call.js +2 -0
- package/lib/Types/Chat.d.ts +109 -0
- package/lib/Types/Chat.js +4 -0
- package/lib/Types/Contact.d.ts +23 -0
- package/lib/Types/Contact.js +2 -0
- package/lib/Types/Events.d.ts +199 -0
- package/lib/Types/Events.js +2 -0
- package/lib/Types/GroupMetadata.d.ts +64 -0
- package/lib/Types/GroupMetadata.js +2 -0
- package/lib/Types/Label.d.ts +35 -0
- package/lib/Types/Label.js +27 -0
- package/lib/Types/LabelAssociation.d.ts +29 -0
- package/lib/Types/LabelAssociation.js +9 -0
- package/lib/Types/Message.d.ts +384 -0
- package/lib/Types/Message.js +7 -0
- package/lib/Types/Newsletter.d.ts +79 -0
- package/lib/Types/Newsletter.js +18 -0
- package/lib/Types/Product.d.ts +78 -0
- package/lib/Types/Product.js +2 -0
- package/lib/Types/Signal.d.ts +57 -0
- package/lib/Types/Signal.js +2 -0
- package/lib/Types/Socket.d.ts +119 -0
- package/lib/Types/Socket.js +2 -0
- package/lib/Types/State.d.ts +27 -0
- package/lib/Types/State.js +2 -0
- package/lib/Types/USync.d.ts +25 -0
- package/lib/Types/USync.js +2 -0
- package/lib/Types/index.d.ts +64 -0
- package/lib/Types/index.js +42 -0
- package/lib/Utils/auth-utils.d.ts +18 -0
- package/lib/Utils/auth-utils.js +206 -0
- package/lib/Utils/baileys-event-stream.d.ts +16 -0
- package/lib/Utils/baileys-event-stream.js +63 -0
- package/lib/Utils/business.d.ts +22 -0
- package/lib/Utils/business.js +234 -0
- package/lib/Utils/chat-utils.d.ts +70 -0
- package/lib/Utils/chat-utils.js +730 -0
- package/lib/Utils/crypto.d.ts +40 -0
- package/lib/Utils/crypto.js +193 -0
- package/lib/Utils/decode-wa-message.d.ts +36 -0
- package/lib/Utils/decode-wa-message.js +204 -0
- package/lib/Utils/event-buffer.d.ts +35 -0
- package/lib/Utils/event-buffer.js +520 -0
- package/lib/Utils/generics.d.ts +89 -0
- package/lib/Utils/generics.js +445 -0
- package/lib/Utils/history.d.ts +19 -0
- package/lib/Utils/history.js +94 -0
- package/lib/Utils/index.d.ts +17 -0
- package/lib/Utils/index.js +33 -0
- package/lib/Utils/link-preview.d.ts +21 -0
- package/lib/Utils/link-preview.js +126 -0
- package/lib/Utils/logger.d.ts +11 -0
- package/lib/Utils/logger.js +7 -0
- package/lib/Utils/lt-hash.d.ts +12 -0
- package/lib/Utils/lt-hash.js +51 -0
- package/lib/Utils/make-mutex.d.ts +7 -0
- package/lib/Utils/make-mutex.js +43 -0
- package/lib/Utils/messages-media.d.ts +120 -0
- package/lib/Utils/messages-media.js +879 -0
- package/lib/Utils/messages.d.ts +75 -0
- package/lib/Utils/messages.js +1022 -0
- package/lib/Utils/noise-handler.d.ts +20 -0
- package/lib/Utils/noise-handler.js +155 -0
- package/lib/Utils/process-message.d.ts +42 -0
- package/lib/Utils/process-message.js +372 -0
- package/lib/Utils/signal.d.ts +33 -0
- package/lib/Utils/signal.js +153 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts +12 -0
- package/lib/Utils/use-multi-file-auth-state.js +125 -0
- package/lib/Utils/validate-connection.d.ts +11 -0
- package/lib/Utils/validate-connection.js +207 -0
- package/lib/WABinary/constants.d.ts +27 -0
- package/lib/WABinary/constants.js +1303 -0
- package/lib/WABinary/decode.d.ts +6 -0
- package/lib/WABinary/decode.js +265 -0
- package/lib/WABinary/encode.d.ts +2 -0
- package/lib/WABinary/encode.js +250 -0
- package/lib/WABinary/generic-utils.d.ts +14 -0
- package/lib/WABinary/generic-utils.js +110 -0
- package/lib/WABinary/index.d.ts +5 -0
- package/lib/WABinary/index.js +21 -0
- package/lib/WABinary/jid-utils.d.ts +36 -0
- package/lib/WABinary/jid-utils.js +83 -0
- package/lib/WABinary/types.d.ts +18 -0
- package/lib/WABinary/types.js +2 -0
- package/lib/WAM/BinaryInfo.d.ts +8 -0
- package/lib/WAM/BinaryInfo.js +13 -0
- package/lib/WAM/constants.d.ts +38 -0
- package/lib/WAM/constants.js +15350 -0
- package/lib/WAM/encode.d.ts +2 -0
- package/lib/WAM/encode.js +155 -0
- package/lib/WAM/index.d.ts +3 -0
- package/lib/WAM/index.js +19 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +9 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +32 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +57 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +30 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +42 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +25 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +53 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +8 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +24 -0
- package/lib/WAUSync/Protocols/index.d.ts +4 -0
- package/lib/WAUSync/Protocols/index.js +20 -0
- package/lib/WAUSync/USyncQuery.d.ts +28 -0
- package/lib/WAUSync/USyncQuery.js +89 -0
- package/lib/WAUSync/USyncUser.d.ts +12 -0
- package/lib/WAUSync/USyncUser.js +26 -0
- package/lib/WAUSync/index.d.ts +3 -0
- package/lib/WAUSync/index.js +19 -0
- package/lib/index.d.ts +13 -0
- package/lib/index.js +63 -0
- package/package.json +90 -0
@@ -0,0 +1,153 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.getNextPreKeysNode = exports.getNextPreKeys = exports.extractDeviceJids = exports.parseAndInjectE2ESessions = exports.xmppPreKey = exports.xmppSignedPreKey = exports.generateOrGetPreKeys = exports.getPreKeys = exports.createSignalIdentity = void 0;
|
4
|
+
const lodash_1 = require("lodash");
|
5
|
+
const Defaults_1 = require("../Defaults");
|
6
|
+
const WABinary_1 = require("../WABinary");
|
7
|
+
const crypto_1 = require("./crypto");
|
8
|
+
const generics_1 = require("./generics");
|
9
|
+
const createSignalIdentity = (wid, accountSignatureKey) => {
|
10
|
+
return {
|
11
|
+
identifier: { name: wid, deviceId: 0 },
|
12
|
+
identifierKey: (0, crypto_1.generateSignalPubKey)(accountSignatureKey)
|
13
|
+
};
|
14
|
+
};
|
15
|
+
exports.createSignalIdentity = createSignalIdentity;
|
16
|
+
const getPreKeys = async ({ get }, min, limit) => {
|
17
|
+
const idList = [];
|
18
|
+
for (let id = min; id < limit; id++) {
|
19
|
+
idList.push(id.toString());
|
20
|
+
}
|
21
|
+
return get('pre-key', idList);
|
22
|
+
};
|
23
|
+
exports.getPreKeys = getPreKeys;
|
24
|
+
const generateOrGetPreKeys = (creds, range) => {
|
25
|
+
const avaliable = creds.nextPreKeyId - creds.firstUnuploadedPreKeyId;
|
26
|
+
const remaining = range - avaliable;
|
27
|
+
const lastPreKeyId = creds.nextPreKeyId + remaining - 1;
|
28
|
+
const newPreKeys = {};
|
29
|
+
if (remaining > 0) {
|
30
|
+
for (let i = creds.nextPreKeyId; i <= lastPreKeyId; i++) {
|
31
|
+
newPreKeys[i] = crypto_1.Curve.generateKeyPair();
|
32
|
+
}
|
33
|
+
}
|
34
|
+
return {
|
35
|
+
newPreKeys,
|
36
|
+
lastPreKeyId,
|
37
|
+
preKeysRange: [creds.firstUnuploadedPreKeyId, range],
|
38
|
+
};
|
39
|
+
};
|
40
|
+
exports.generateOrGetPreKeys = generateOrGetPreKeys;
|
41
|
+
const xmppSignedPreKey = (key) => ({
|
42
|
+
tag: 'skey',
|
43
|
+
attrs: {},
|
44
|
+
content: [
|
45
|
+
{ tag: 'id', attrs: {}, content: (0, generics_1.encodeBigEndian)(key.keyId, 3) },
|
46
|
+
{ tag: 'value', attrs: {}, content: key.keyPair.public },
|
47
|
+
{ tag: 'signature', attrs: {}, content: key.signature }
|
48
|
+
]
|
49
|
+
});
|
50
|
+
exports.xmppSignedPreKey = xmppSignedPreKey;
|
51
|
+
const xmppPreKey = (pair, id) => ({
|
52
|
+
tag: 'key',
|
53
|
+
attrs: {},
|
54
|
+
content: [
|
55
|
+
{ tag: 'id', attrs: {}, content: (0, generics_1.encodeBigEndian)(id, 3) },
|
56
|
+
{ tag: 'value', attrs: {}, content: pair.public }
|
57
|
+
]
|
58
|
+
});
|
59
|
+
exports.xmppPreKey = xmppPreKey;
|
60
|
+
const parseAndInjectE2ESessions = async (node, repository) => {
|
61
|
+
const extractKey = (key) => (key ? ({
|
62
|
+
keyId: (0, WABinary_1.getBinaryNodeChildUInt)(key, 'id', 3),
|
63
|
+
publicKey: (0, crypto_1.generateSignalPubKey)((0, WABinary_1.getBinaryNodeChildBuffer)(key, 'value')),
|
64
|
+
signature: (0, WABinary_1.getBinaryNodeChildBuffer)(key, 'signature'),
|
65
|
+
}) : undefined);
|
66
|
+
const nodes = (0, WABinary_1.getBinaryNodeChildren)((0, WABinary_1.getBinaryNodeChild)(node, 'list'), 'user');
|
67
|
+
for (const node of nodes) {
|
68
|
+
(0, WABinary_1.assertNodeErrorFree)(node);
|
69
|
+
}
|
70
|
+
// Most of the work in repository.injectE2ESession is CPU intensive, not IO
|
71
|
+
// So Promise.all doesn't really help here,
|
72
|
+
// but blocks even loop if we're using it inside keys.transaction, and it makes it "sync" actually
|
73
|
+
// This way we chunk it in smaller parts and between those parts we can yield to the event loop
|
74
|
+
// It's rare case when you need to E2E sessions for so many users, but it's possible
|
75
|
+
const chunkSize = 100;
|
76
|
+
const chunks = (0, lodash_1.chunk)(nodes, chunkSize);
|
77
|
+
for (const nodesChunk of chunks) {
|
78
|
+
await Promise.all(nodesChunk.map(async (node) => {
|
79
|
+
const signedKey = (0, WABinary_1.getBinaryNodeChild)(node, 'skey');
|
80
|
+
const key = (0, WABinary_1.getBinaryNodeChild)(node, 'key');
|
81
|
+
const identity = (0, WABinary_1.getBinaryNodeChildBuffer)(node, 'identity');
|
82
|
+
const jid = node.attrs.jid;
|
83
|
+
const registrationId = (0, WABinary_1.getBinaryNodeChildUInt)(node, 'registration', 4);
|
84
|
+
await repository.injectE2ESession({
|
85
|
+
jid,
|
86
|
+
session: {
|
87
|
+
registrationId: registrationId,
|
88
|
+
identityKey: (0, crypto_1.generateSignalPubKey)(identity),
|
89
|
+
signedPreKey: extractKey(signedKey),
|
90
|
+
preKey: extractKey(key)
|
91
|
+
}
|
92
|
+
});
|
93
|
+
}));
|
94
|
+
}
|
95
|
+
};
|
96
|
+
exports.parseAndInjectE2ESessions = parseAndInjectE2ESessions;
|
97
|
+
const extractDeviceJids = (result, myJid, excludeZeroDevices) => {
|
98
|
+
const { user: myUser, device: myDevice } = (0, WABinary_1.jidDecode)(myJid);
|
99
|
+
const extracted = [];
|
100
|
+
for (const userResult of result) {
|
101
|
+
const { devices, id } = userResult;
|
102
|
+
const { user } = (0, WABinary_1.jidDecode)(id);
|
103
|
+
const deviceList = devices === null || devices === void 0 ? void 0 : devices.deviceList;
|
104
|
+
if (Array.isArray(deviceList)) {
|
105
|
+
for (const { id: device, keyIndex } of deviceList) {
|
106
|
+
if ((!excludeZeroDevices || device !== 0) && // if zero devices are not-excluded, or device is non zero
|
107
|
+
(myUser !== user || myDevice !== device) && // either different user or if me user, not this device
|
108
|
+
(device === 0 || !!keyIndex) // ensure that "key-index" is specified for "non-zero" devices, produces a bad req otherwise
|
109
|
+
) {
|
110
|
+
extracted.push({ user, device });
|
111
|
+
}
|
112
|
+
}
|
113
|
+
}
|
114
|
+
}
|
115
|
+
return extracted;
|
116
|
+
};
|
117
|
+
exports.extractDeviceJids = extractDeviceJids;
|
118
|
+
/**
|
119
|
+
* get the next N keys for upload or processing
|
120
|
+
* @param count number of pre-keys to get or generate
|
121
|
+
*/
|
122
|
+
const getNextPreKeys = async ({ creds, keys }, count) => {
|
123
|
+
const { newPreKeys, lastPreKeyId, preKeysRange } = (0, exports.generateOrGetPreKeys)(creds, count);
|
124
|
+
const update = {
|
125
|
+
nextPreKeyId: Math.max(lastPreKeyId + 1, creds.nextPreKeyId),
|
126
|
+
firstUnuploadedPreKeyId: Math.max(creds.firstUnuploadedPreKeyId, lastPreKeyId + 1)
|
127
|
+
};
|
128
|
+
await keys.set({ 'pre-key': newPreKeys });
|
129
|
+
const preKeys = await (0, exports.getPreKeys)(keys, preKeysRange[0], preKeysRange[0] + preKeysRange[1]);
|
130
|
+
return { update, preKeys };
|
131
|
+
};
|
132
|
+
exports.getNextPreKeys = getNextPreKeys;
|
133
|
+
const getNextPreKeysNode = async (state, count) => {
|
134
|
+
const { creds } = state;
|
135
|
+
const { update, preKeys } = await (0, exports.getNextPreKeys)(state, count);
|
136
|
+
const node = {
|
137
|
+
tag: 'iq',
|
138
|
+
attrs: {
|
139
|
+
xmlns: 'encrypt',
|
140
|
+
type: 'set',
|
141
|
+
to: WABinary_1.S_WHATSAPP_NET,
|
142
|
+
},
|
143
|
+
content: [
|
144
|
+
{ tag: 'registration', attrs: {}, content: (0, generics_1.encodeBigEndian)(creds.registrationId) },
|
145
|
+
{ tag: 'type', attrs: {}, content: Defaults_1.KEY_BUNDLE_TYPE },
|
146
|
+
{ tag: 'identity', attrs: {}, content: creds.signedIdentityKey.public },
|
147
|
+
{ tag: 'list', attrs: {}, content: Object.keys(preKeys).map(k => (0, exports.xmppPreKey)(preKeys[+k], +k)) },
|
148
|
+
(0, exports.xmppSignedPreKey)(creds.signedPreKey)
|
149
|
+
]
|
150
|
+
};
|
151
|
+
return { update, node };
|
152
|
+
};
|
153
|
+
exports.getNextPreKeysNode = getNextPreKeysNode;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { AuthenticationState } from '../Types';
|
2
|
+
/**
|
3
|
+
* stores the full authentication state in a single folder.
|
4
|
+
* Far more efficient than singlefileauthstate
|
5
|
+
*
|
6
|
+
* Again, I wouldn't endorse this for any production level use other than perhaps a bot.
|
7
|
+
* Would recommend writing an auth state for use with a proper SQL or No-SQL DB
|
8
|
+
* */
|
9
|
+
export declare const useMultiFileAuthState: (folder: string) => Promise<{
|
10
|
+
state: AuthenticationState;
|
11
|
+
saveCreds: () => Promise<void>;
|
12
|
+
}>;
|
@@ -0,0 +1,125 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.useMultiFileAuthState = void 0;
|
4
|
+
const async_mutex_1 = require("async-mutex");
|
5
|
+
const promises_1 = require("fs/promises");
|
6
|
+
const path_1 = require("path");
|
7
|
+
const WAProto_1 = require("../../WAProto");
|
8
|
+
const auth_utils_1 = require("./auth-utils");
|
9
|
+
const generics_1 = require("./generics");
|
10
|
+
// We need to lock files due to the fact that we are using async functions to read and write files
|
11
|
+
// https://github.com/WhiskeySockets/Baileys/issues/794
|
12
|
+
// https://github.com/nodejs/node/issues/26338
|
13
|
+
// Use a Map to store mutexes for each file path
|
14
|
+
const fileLocks = new Map();
|
15
|
+
// Get or create a mutex for a specific file path
|
16
|
+
const getFileLock = (path) => {
|
17
|
+
let mutex = fileLocks.get(path);
|
18
|
+
if (!mutex) {
|
19
|
+
mutex = new async_mutex_1.Mutex();
|
20
|
+
fileLocks.set(path, mutex);
|
21
|
+
}
|
22
|
+
return mutex;
|
23
|
+
};
|
24
|
+
/**
|
25
|
+
* stores the full authentication state in a single folder.
|
26
|
+
* Far more efficient than singlefileauthstate
|
27
|
+
*
|
28
|
+
* Again, I wouldn't endorse this for any production level use other than perhaps a bot.
|
29
|
+
* Would recommend writing an auth state for use with a proper SQL or No-SQL DB
|
30
|
+
* */
|
31
|
+
const useMultiFileAuthState = async (folder) => {
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
33
|
+
const writeData = async (data, file) => {
|
34
|
+
const filePath = (0, path_1.join)(folder, fixFileName(file));
|
35
|
+
const mutex = getFileLock(filePath);
|
36
|
+
return mutex.acquire().then(async (release) => {
|
37
|
+
try {
|
38
|
+
await (0, promises_1.writeFile)(filePath, JSON.stringify(data, generics_1.BufferJSON.replacer));
|
39
|
+
}
|
40
|
+
finally {
|
41
|
+
release();
|
42
|
+
}
|
43
|
+
});
|
44
|
+
};
|
45
|
+
const readData = async (file) => {
|
46
|
+
try {
|
47
|
+
const filePath = (0, path_1.join)(folder, fixFileName(file));
|
48
|
+
const mutex = getFileLock(filePath);
|
49
|
+
return await mutex.acquire().then(async (release) => {
|
50
|
+
try {
|
51
|
+
const data = await (0, promises_1.readFile)(filePath, { encoding: 'utf-8' });
|
52
|
+
return JSON.parse(data, generics_1.BufferJSON.reviver);
|
53
|
+
}
|
54
|
+
finally {
|
55
|
+
release();
|
56
|
+
}
|
57
|
+
});
|
58
|
+
}
|
59
|
+
catch (error) {
|
60
|
+
return null;
|
61
|
+
}
|
62
|
+
};
|
63
|
+
const removeData = async (file) => {
|
64
|
+
try {
|
65
|
+
const filePath = (0, path_1.join)(folder, fixFileName(file));
|
66
|
+
const mutex = getFileLock(filePath);
|
67
|
+
return mutex.acquire().then(async (release) => {
|
68
|
+
try {
|
69
|
+
await (0, promises_1.unlink)(filePath);
|
70
|
+
}
|
71
|
+
catch (_a) {
|
72
|
+
}
|
73
|
+
finally {
|
74
|
+
release();
|
75
|
+
}
|
76
|
+
});
|
77
|
+
}
|
78
|
+
catch (_a) {
|
79
|
+
}
|
80
|
+
};
|
81
|
+
const folderInfo = await (0, promises_1.stat)(folder).catch(() => { });
|
82
|
+
if (folderInfo) {
|
83
|
+
if (!folderInfo.isDirectory()) {
|
84
|
+
throw new Error(`found something that is not a directory at ${folder}, either delete it or specify a different location`);
|
85
|
+
}
|
86
|
+
}
|
87
|
+
else {
|
88
|
+
await (0, promises_1.mkdir)(folder, { recursive: true });
|
89
|
+
}
|
90
|
+
const fixFileName = (file) => { var _a; return (_a = file === null || file === void 0 ? void 0 : file.replace(/\//g, '__')) === null || _a === void 0 ? void 0 : _a.replace(/:/g, '-'); };
|
91
|
+
const creds = await readData('creds.json') || (0, auth_utils_1.initAuthCreds)();
|
92
|
+
return {
|
93
|
+
state: {
|
94
|
+
creds,
|
95
|
+
keys: {
|
96
|
+
get: async (type, ids) => {
|
97
|
+
const data = {};
|
98
|
+
await Promise.all(ids.map(async (id) => {
|
99
|
+
let value = await readData(`${type}-${id}.json`);
|
100
|
+
if (type === 'app-state-sync-key' && value) {
|
101
|
+
value = WAProto_1.proto.Message.AppStateSyncKeyData.fromObject(value);
|
102
|
+
}
|
103
|
+
data[id] = value;
|
104
|
+
}));
|
105
|
+
return data;
|
106
|
+
},
|
107
|
+
set: async (data) => {
|
108
|
+
const tasks = [];
|
109
|
+
for (const category in data) {
|
110
|
+
for (const id in data[category]) {
|
111
|
+
const value = data[category][id];
|
112
|
+
const file = `${category}-${id}.json`;
|
113
|
+
tasks.push(value ? writeData(value, file) : removeData(file));
|
114
|
+
}
|
115
|
+
}
|
116
|
+
await Promise.all(tasks);
|
117
|
+
}
|
118
|
+
}
|
119
|
+
},
|
120
|
+
saveCreds: async () => {
|
121
|
+
return writeData(creds, 'creds.json');
|
122
|
+
}
|
123
|
+
};
|
124
|
+
};
|
125
|
+
exports.useMultiFileAuthState = useMultiFileAuthState;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { proto } from '../../WAProto';
|
2
|
+
import type { AuthenticationCreds, SignalCreds, SocketConfig } from '../Types';
|
3
|
+
import { BinaryNode } from '../WABinary';
|
4
|
+
export declare const generateMobileNode: (config: SocketConfig) => proto.IClientPayload;
|
5
|
+
export declare const generateLoginNode: (userJid: string, config: SocketConfig) => proto.IClientPayload;
|
6
|
+
export declare const generateRegistrationNode: ({ registrationId, signedPreKey, signedIdentityKey }: SignalCreds, config: SocketConfig) => proto.ClientPayload;
|
7
|
+
export declare const configureSuccessfulPairing: (stanza: BinaryNode, { advSecretKey, signedIdentityKey, signalIdentities }: Pick<AuthenticationCreds, "advSecretKey" | "signedIdentityKey" | "signalIdentities">) => {
|
8
|
+
creds: Partial<AuthenticationCreds>;
|
9
|
+
reply: BinaryNode;
|
10
|
+
};
|
11
|
+
export declare const encodeSignedDeviceIdentity: (account: proto.IADVSignedDeviceIdentity, includeSignatureKey: boolean) => Uint8Array<ArrayBufferLike>;
|
@@ -0,0 +1,207 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.encodeSignedDeviceIdentity = exports.configureSuccessfulPairing = exports.generateRegistrationNode = exports.generateLoginNode = exports.generateMobileNode = void 0;
|
4
|
+
const boom_1 = require("@hapi/boom");
|
5
|
+
const crypto_1 = require("crypto");
|
6
|
+
const WAProto_1 = require("../../WAProto");
|
7
|
+
const Defaults_1 = require("../Defaults");
|
8
|
+
const WABinary_1 = require("../WABinary");
|
9
|
+
const crypto_2 = require("./crypto");
|
10
|
+
const generics_1 = require("./generics");
|
11
|
+
const signal_1 = require("./signal");
|
12
|
+
const getUserAgent = (config) => {
|
13
|
+
var _a, _b;
|
14
|
+
const osVersion = config.mobile ? '15.3.1' : '0.1';
|
15
|
+
const version = config.mobile ? [2, 24, 6] : config.version;
|
16
|
+
const device = config.mobile ? 'iPhone_7' : 'Desktop';
|
17
|
+
const manufacturer = config.mobile ? 'Apple' : '';
|
18
|
+
const platform = config.mobile ? WAProto_1.proto.ClientPayload.UserAgent.Platform.IOS : WAProto_1.proto.ClientPayload.UserAgent.Platform.WEB;
|
19
|
+
const phoneId = config.mobile ? { phoneId: config.auth.creds.phoneId } : {};
|
20
|
+
return {
|
21
|
+
appVersion: {
|
22
|
+
primary: version[0],
|
23
|
+
secondary: version[1],
|
24
|
+
tertiary: version[2],
|
25
|
+
},
|
26
|
+
platform,
|
27
|
+
releaseChannel: WAProto_1.proto.ClientPayload.UserAgent.ReleaseChannel.RELEASE,
|
28
|
+
mcc: ((_a = config.auth.creds.registration) === null || _a === void 0 ? void 0 : _a.phoneNumberMobileCountryCode) || '000',
|
29
|
+
mnc: ((_b = config.auth.creds.registration) === null || _b === void 0 ? void 0 : _b.phoneNumberMobileNetworkCode) || '000',
|
30
|
+
osVersion: osVersion,
|
31
|
+
manufacturer,
|
32
|
+
device,
|
33
|
+
osBuildNumber: osVersion,
|
34
|
+
localeLanguageIso6391: 'en',
|
35
|
+
localeCountryIso31661Alpha2: config.countryCode,
|
36
|
+
...phoneId
|
37
|
+
};
|
38
|
+
};
|
39
|
+
const PLATFORM_MAP = {
|
40
|
+
'Mac OS': WAProto_1.proto.ClientPayload.WebInfo.WebSubPlatform.DARWIN,
|
41
|
+
'Windows': WAProto_1.proto.ClientPayload.WebInfo.WebSubPlatform.WIN32
|
42
|
+
};
|
43
|
+
const getWebInfo = (config) => {
|
44
|
+
let webSubPlatform = WAProto_1.proto.ClientPayload.WebInfo.WebSubPlatform.WEB_BROWSER;
|
45
|
+
if (config.syncFullHistory && PLATFORM_MAP[config.browser[0]]) {
|
46
|
+
webSubPlatform = PLATFORM_MAP[config.browser[0]];
|
47
|
+
}
|
48
|
+
return { webSubPlatform };
|
49
|
+
};
|
50
|
+
const getClientPayload = (config) => {
|
51
|
+
const payload = {
|
52
|
+
connectType: WAProto_1.proto.ClientPayload.ConnectType.WIFI_UNKNOWN,
|
53
|
+
connectReason: WAProto_1.proto.ClientPayload.ConnectReason.USER_ACTIVATED,
|
54
|
+
userAgent: getUserAgent(config),
|
55
|
+
};
|
56
|
+
if (!config.mobile) {
|
57
|
+
payload.webInfo = getWebInfo(config);
|
58
|
+
}
|
59
|
+
return payload;
|
60
|
+
};
|
61
|
+
const generateMobileNode = (config) => {
|
62
|
+
if (!config.auth.creds) {
|
63
|
+
throw new boom_1.Boom('No registration data found', { data: config });
|
64
|
+
}
|
65
|
+
const payload = {
|
66
|
+
...getClientPayload(config),
|
67
|
+
sessionId: Math.floor(Math.random() * 999999999 + 1),
|
68
|
+
shortConnect: true,
|
69
|
+
connectAttemptCount: 0,
|
70
|
+
device: 0,
|
71
|
+
dnsSource: {
|
72
|
+
appCached: false,
|
73
|
+
dnsMethod: WAProto_1.proto.ClientPayload.DNSSource.DNSResolutionMethod.SYSTEM,
|
74
|
+
},
|
75
|
+
passive: false, // XMPP heartbeat setting (false: server actively pings) (true: client actively pings)
|
76
|
+
pushName: 'test',
|
77
|
+
username: Number(`${config.auth.creds.registration.phoneNumberCountryCode}${config.auth.creds.registration.phoneNumberNationalNumber}`),
|
78
|
+
};
|
79
|
+
return WAProto_1.proto.ClientPayload.fromObject(payload);
|
80
|
+
};
|
81
|
+
exports.generateMobileNode = generateMobileNode;
|
82
|
+
const generateLoginNode = (userJid, config) => {
|
83
|
+
const { user, device } = (0, WABinary_1.jidDecode)(userJid);
|
84
|
+
const payload = {
|
85
|
+
...getClientPayload(config),
|
86
|
+
passive: false,
|
87
|
+
pull: true,
|
88
|
+
username: +user,
|
89
|
+
device: device,
|
90
|
+
};
|
91
|
+
return WAProto_1.proto.ClientPayload.fromObject(payload);
|
92
|
+
};
|
93
|
+
exports.generateLoginNode = generateLoginNode;
|
94
|
+
const getPlatformType = (platform) => {
|
95
|
+
const platformType = platform.toUpperCase();
|
96
|
+
return WAProto_1.proto.DeviceProps.PlatformType[platformType] || WAProto_1.proto.DeviceProps.PlatformType.DESKTOP;
|
97
|
+
};
|
98
|
+
const generateRegistrationNode = ({ registrationId, signedPreKey, signedIdentityKey }, config) => {
|
99
|
+
// the app version needs to be md5 hashed
|
100
|
+
// and passed in
|
101
|
+
const appVersionBuf = (0, crypto_1.createHash)('md5')
|
102
|
+
.update(config.version.join('.')) // join as string
|
103
|
+
.digest();
|
104
|
+
const companion = {
|
105
|
+
os: config.browser[0],
|
106
|
+
platformType: getPlatformType(config.browser[1]),
|
107
|
+
requireFullSync: config.syncFullHistory,
|
108
|
+
};
|
109
|
+
const companionProto = WAProto_1.proto.DeviceProps.encode(companion).finish();
|
110
|
+
const registerPayload = {
|
111
|
+
...getClientPayload(config),
|
112
|
+
passive: false,
|
113
|
+
pull: false,
|
114
|
+
devicePairingData: {
|
115
|
+
buildHash: appVersionBuf,
|
116
|
+
deviceProps: companionProto,
|
117
|
+
eRegid: (0, generics_1.encodeBigEndian)(registrationId),
|
118
|
+
eKeytype: Defaults_1.KEY_BUNDLE_TYPE,
|
119
|
+
eIdent: signedIdentityKey.public,
|
120
|
+
eSkeyId: (0, generics_1.encodeBigEndian)(signedPreKey.keyId, 3),
|
121
|
+
eSkeyVal: signedPreKey.keyPair.public,
|
122
|
+
eSkeySig: signedPreKey.signature,
|
123
|
+
},
|
124
|
+
};
|
125
|
+
return WAProto_1.proto.ClientPayload.fromObject(registerPayload);
|
126
|
+
};
|
127
|
+
exports.generateRegistrationNode = generateRegistrationNode;
|
128
|
+
const configureSuccessfulPairing = (stanza, { advSecretKey, signedIdentityKey, signalIdentities }) => {
|
129
|
+
const msgId = stanza.attrs.id;
|
130
|
+
const pairSuccessNode = (0, WABinary_1.getBinaryNodeChild)(stanza, 'pair-success');
|
131
|
+
const deviceIdentityNode = (0, WABinary_1.getBinaryNodeChild)(pairSuccessNode, 'device-identity');
|
132
|
+
const platformNode = (0, WABinary_1.getBinaryNodeChild)(pairSuccessNode, 'platform');
|
133
|
+
const deviceNode = (0, WABinary_1.getBinaryNodeChild)(pairSuccessNode, 'device');
|
134
|
+
const businessNode = (0, WABinary_1.getBinaryNodeChild)(pairSuccessNode, 'biz');
|
135
|
+
if (!deviceIdentityNode || !deviceNode) {
|
136
|
+
throw new boom_1.Boom('Missing device-identity or device in pair success node', { data: stanza });
|
137
|
+
}
|
138
|
+
const bizName = businessNode === null || businessNode === void 0 ? void 0 : businessNode.attrs.name;
|
139
|
+
const jid = deviceNode.attrs.jid;
|
140
|
+
const { details, hmac, accountType } = WAProto_1.proto.ADVSignedDeviceIdentityHMAC.decode(deviceIdentityNode.content);
|
141
|
+
const isHostedAccount = accountType !== undefined && accountType === WAProto_1.proto.ADVEncryptionType.HOSTED;
|
142
|
+
const hmacPrefix = isHostedAccount ? Buffer.from([6, 5]) : Buffer.alloc(0);
|
143
|
+
const advSign = (0, crypto_2.hmacSign)(Buffer.concat([hmacPrefix, details]), Buffer.from(advSecretKey, 'base64'));
|
144
|
+
if (Buffer.compare(hmac, advSign) !== 0) {
|
145
|
+
throw new boom_1.Boom('Invalid account signature');
|
146
|
+
}
|
147
|
+
const account = WAProto_1.proto.ADVSignedDeviceIdentity.decode(details);
|
148
|
+
const { accountSignatureKey, accountSignature, details: deviceDetails } = account;
|
149
|
+
const accountMsg = Buffer.concat([Buffer.from([6, 0]), deviceDetails, signedIdentityKey.public]);
|
150
|
+
if (!crypto_2.Curve.verify(accountSignatureKey, accountMsg, accountSignature)) {
|
151
|
+
throw new boom_1.Boom('Failed to verify account signature');
|
152
|
+
}
|
153
|
+
const devicePrefix = isHostedAccount ? Buffer.from([6, 6]) : Buffer.from([6, 1]);
|
154
|
+
const deviceMsg = Buffer.concat([devicePrefix, deviceDetails, signedIdentityKey.public, accountSignatureKey]);
|
155
|
+
account.deviceSignature = crypto_2.Curve.sign(signedIdentityKey.private, deviceMsg);
|
156
|
+
const identity = (0, signal_1.createSignalIdentity)(jid, accountSignatureKey);
|
157
|
+
const accountEnc = (0, exports.encodeSignedDeviceIdentity)(account, false);
|
158
|
+
const deviceIdentity = WAProto_1.proto.ADVDeviceIdentity.decode(account.details);
|
159
|
+
const reply = {
|
160
|
+
tag: 'iq',
|
161
|
+
attrs: {
|
162
|
+
to: WABinary_1.S_WHATSAPP_NET,
|
163
|
+
type: 'result',
|
164
|
+
id: msgId,
|
165
|
+
},
|
166
|
+
content: [
|
167
|
+
{
|
168
|
+
tag: 'pair-device-sign',
|
169
|
+
attrs: {},
|
170
|
+
content: [
|
171
|
+
{
|
172
|
+
tag: 'device-identity',
|
173
|
+
attrs: { 'key-index': deviceIdentity.keyIndex.toString() },
|
174
|
+
content: accountEnc
|
175
|
+
}
|
176
|
+
]
|
177
|
+
}
|
178
|
+
]
|
179
|
+
};
|
180
|
+
const authUpdate = {
|
181
|
+
account,
|
182
|
+
me: { id: jid, name: bizName },
|
183
|
+
signalIdentities: [
|
184
|
+
...(signalIdentities || []),
|
185
|
+
identity
|
186
|
+
],
|
187
|
+
platform: platformNode === null || platformNode === void 0 ? void 0 : platformNode.attrs.name
|
188
|
+
};
|
189
|
+
return {
|
190
|
+
creds: authUpdate,
|
191
|
+
reply
|
192
|
+
};
|
193
|
+
};
|
194
|
+
exports.configureSuccessfulPairing = configureSuccessfulPairing;
|
195
|
+
const encodeSignedDeviceIdentity = (account, includeSignatureKey) => {
|
196
|
+
var _a;
|
197
|
+
account = { ...account };
|
198
|
+
// set to null if we are not to include the signature key
|
199
|
+
// or if we are including the signature key but it is empty
|
200
|
+
if (!includeSignatureKey || !((_a = account.accountSignatureKey) === null || _a === void 0 ? void 0 : _a.length)) {
|
201
|
+
account.accountSignatureKey = null;
|
202
|
+
}
|
203
|
+
return WAProto_1.proto.ADVSignedDeviceIdentity
|
204
|
+
.encode(account)
|
205
|
+
.finish();
|
206
|
+
};
|
207
|
+
exports.encodeSignedDeviceIdentity = encodeSignedDeviceIdentity;
|
@@ -0,0 +1,27 @@
|
|
1
|
+
export declare const TAGS: {
|
2
|
+
LIST_EMPTY: number;
|
3
|
+
DICTIONARY_0: number;
|
4
|
+
DICTIONARY_1: number;
|
5
|
+
DICTIONARY_2: number;
|
6
|
+
DICTIONARY_3: number;
|
7
|
+
INTEROP_JID: number;
|
8
|
+
FB_JID: number;
|
9
|
+
AD_JID: number;
|
10
|
+
LIST_8: number;
|
11
|
+
LIST_16: number;
|
12
|
+
JID_PAIR: number;
|
13
|
+
HEX_8: number;
|
14
|
+
BINARY_8: number;
|
15
|
+
BINARY_20: number;
|
16
|
+
BINARY_32: number;
|
17
|
+
NIBBLE_8: number;
|
18
|
+
PACKED_MAX: number;
|
19
|
+
};
|
20
|
+
export declare const DOUBLE_BYTE_TOKENS: readonly [readonly ["read-self", "active", "fbns", "protocol", "reaction", "screen_width", "heartbeat", "deviceid", "2:47DEQpj8", "uploadfieldstat", "voip_settings", "retry", "priority", "longitude", "conflict", "false", "ig_professional", "replaced", "preaccept", "cover_photo", "uncompressed", "encopt", "ppic", "04", "passive", "status-revoke-drop", "keygen", "540", "offer", "rate", "opus", "latitude", "w:gp2", "ver", "4", "business_profile", "medium", "sender", "prev_v_id", "email", "website", "invited", "sign_credential", "05", "transport", "skey", "reason", "peer_abtest_bucket", "America/Sao_Paulo", "appid", "refresh", "100", "06", "404", "101", "104", "107", "102", "109", "103", "member_add_mode", "105", "transaction-id", "110", "106", "outgoing", "108", "111", "tokens", "followers", "ig_handle", "self_pid", "tue", "dec", "thu", "joinable", "peer_pid", "mon", "features", "wed", "peer_device_presence", "pn", "delete", "07", "fri", "audio_duration", "admin", "connected", "delta", "rcat", "disable", "collection", "08", "480", "sat", "phash", "all", "invite", "accept", "critical_unblock_low", "group_update", "signed_credential", "blinded_credential", "eph_setting", "net", "09", "background_location", "refresh_id", "Asia/Kolkata", "privacy_mode_ts", "account_sync", "voip_payload_type", "service_areas", "acs_public_key", "v_id", "0a", "fallback_class", "relay", "actual_actors", "metadata", "w:biz", "5", "connected-limit", "notice", "0b", "host_storage", "fb_page", "subject", "privatestats", "invis", "groupadd", "010", "note.m4r", "uuid", "0c", "8000", "sun", "372", "1020", "stage", "1200", "720", "canonical", "fb", "011", "video_duration", "0d", "1140", "superadmin", "012", "Opening.m4r", "keystore_attestation", "dleq_proof", "013", "timestamp", "ab_key", "w:sync:app:state", "0e", "vertical", "600", "p_v_id", "6", "likes", "014", "500", "1260", "creator", "0f", "rte", "destination", "group", "group_info", "syncd_anti_tampering_fatal_exception_enabled", "015", "dl_bw", "Asia/Jakarta", "vp8/h.264", "online", "1320", "fb:multiway", "10", "timeout", "016", "nse_retry", "urn:xmpp:whatsapp:dirty", "017", "a_v_id", "web_shops_chat_header_button_enabled", "nse_call", "inactive-upgrade", "none", "web", "groups", "2250", "mms_hot_content_timespan_in_seconds", "contact_blacklist", "nse_read", "suspended_group_deletion_notification", "binary_version", "018", "https://www.whatsapp.com/otp/copy/", "reg_push", "shops_hide_catalog_attachment_entrypoint", "server_sync", ".", "ephemeral_messages_allowed_values", "019", "mms_vcache_aggregation_enabled", "iphone", "America/Argentina/Buenos_Aires", "01a", "mms_vcard_autodownload_size_kb", "nse_ver", "shops_header_dropdown_menu_item", "dhash", "catalog_status", "communities_mvp_new_iqs_serverprop", "blocklist", "default", "11", "ephemeral_messages_enabled", "01b", "original_dimensions", "8", "mms4_media_retry_notification_encryption_enabled", "mms4_server_error_receipt_encryption_enabled", "original_image_url", "sync", "multiway", "420", "companion_enc_static", "shops_profile_drawer_entrypoint", "01c", "vcard_as_document_size_kb", "status_video_max_duration", "request_image_url", "01d", "regular_high", "s_t", "abt", "share_ext_min_preliminary_image_quality", "01e", "32", "syncd_key_rotation_enabled", "data_namespace", "md_downgrade_read_receipts2", "patch", "polltype", "ephemeral_messages_setting", "userrate", "15", "partial_pjpeg_bw_threshold", "played-self", "catalog_exists", "01f", "mute_v2"], readonly ["reject", "dirty", "announcement", "020", "13", "9", "status_video_max_bitrate", "fb:thrift_iq", "offline_batch", "022", "full", "ctwa_first_business_reply_logging", "h.264", "smax_id", "group_description_length", "https://www.whatsapp.com/otp/code", "status_image_max_edge", "smb_upsell_business_profile_enabled", "021", "web_upgrade_to_md_modal", "14", "023", "s_o", "smaller_video_thumbs_status_enabled", "media_max_autodownload", "960", "blocking_status", "peer_msg", "joinable_group_call_client_version", "group_call_video_maximization_enabled", "return_snapshot", "high", "America/Mexico_City", "entry_point_block_logging_enabled", "pop", "024", "1050", "16", "1380", "one_tap_calling_in_group_chat_size", "regular_low", "inline_joinable_education_enabled", "hq_image_max_edge", "locked", "America/Bogota", "smb_biztools_deeplink_enabled", "status_image_quality", "1088", "025", "payments_upi_intent_transaction_limit", "voip", "w:g2", "027", "md_pin_chat_enabled", "026", "multi_scan_pjpeg_download_enabled", "shops_product_grid", "transaction_id", "ctwa_context_enabled", "20", "fna", "hq_image_quality", "alt_jpeg_doc_detection_quality", "group_call_max_participants", "pkey", "America/Belem", "image_max_kbytes", "web_cart_v1_1_order_message_changes_enabled", "ctwa_context_enterprise_enabled", "urn:xmpp:whatsapp:account", "840", "Asia/Kuala_Lumpur", "max_participants", "video_remux_after_repair_enabled", "stella_addressbook_restriction_type", "660", "900", "780", "context_menu_ios13_enabled", "mute-state", "ref", "payments_request_messages", "029", "frskmsg", "vcard_max_size_kb", "sample_buffer_gif_player_enabled", "match_last_seen", "510", "4983", "video_max_bitrate", "028", "w:comms:chat", "17", "frequently_forwarded_max", "groups_privacy_blacklist", "Asia/Karachi", "02a", "web_download_document_thumb_mms_enabled", "02b", "hist_sync", "biz_block_reasons_version", "1024", "18", "web_is_direct_connection_for_plm_transparent", "view_once_write", "file_max_size", "paid_convo_id", "online_privacy_setting", "video_max_edge", "view_once_read", "enhanced_storage_management", "multi_scan_pjpeg_encoding_enabled", "ctwa_context_forward_enabled", "video_transcode_downgrade_enable", "template_doc_mime_types", "hq_image_bw_threshold", "30", "body", "u_aud_limit_sil_restarts_ctrl", "other", "participating", "w:biz:directory", "1110", "vp8", "4018", "meta", "doc_detection_image_max_edge", "image_quality", "1170", "02c", "smb_upsell_chat_banner_enabled", "key_expiry_time_second", "pid", "stella_interop_enabled", "19", "linked_device_max_count", "md_device_sync_enabled", "02d", "02e", "360", "enhanced_block_enabled", "ephemeral_icon_in_forwarding", "paid_convo_status", "gif_provider", "project_name", "server-error", "canonical_url_validation_enabled", "wallpapers_v2", "syncd_clear_chat_delete_chat_enabled", "medianotify", "02f", "shops_required_tos_version", "vote", "reset_skey_on_id_change", "030", "image_max_edge", "multicast_limit_global", "ul_bw", "21", "25", "5000", "poll", "570", "22", "031", "1280", "WhatsApp", "032", "bloks_shops_enabled", "50", "upload_host_switching_enabled", "web_ctwa_context_compose_enabled", "ptt_forwarded_features_enabled", "unblocked", "partial_pjpeg_enabled", "fbid:devices", "height", "ephemeral_group_query_ts", "group_join_permissions", "order", "033", "alt_jpeg_status_quality", "migrate", "popular-bank", "win_uwp_deprecation_killswitch_enabled", "web_download_status_thumb_mms_enabled", "blocking", "url_text", "035", "web_forwarding_limit_to_groups", "1600", "val", "1000", "syncd_msg_date_enabled", "bank-ref-id", "max_subject", "payments_web_enabled", "web_upload_document_thumb_mms_enabled", "size", "request", "ephemeral", "24", "receipt_agg", "ptt_remember_play_position", "sampling_weight", "enc_rekey", "mute_always", "037", "034", "23", "036", "action", "click_to_chat_qr_enabled", "width", "disabled", "038", "md_blocklist_v2", "played_self_enabled", "web_buttons_message_enabled", "flow_id", "clear", "450", "fbid:thread", "bloks_session_state", "America/Lima", "attachment_picker_refresh", "download_host_switching_enabled", "1792", "u_aud_limit_sil_restarts_test2", "custom_urls", "device_fanout", "optimistic_upload", "2000", "key_cipher_suite", "web_smb_upsell_in_biz_profile_enabled", "e", "039", "siri_post_status_shortcut", "pair-device", "lg", "lc", "stream_attribution_url", "model", "mspjpeg_phash_gen", "catalog_send_all", "new_multi_vcards_ui", "share_biz_vcard_enabled", "-", "clean", "200", "md_blocklist_v2_server", "03b", "03a", "web_md_migration_experience", "ptt_conversation_waveform", "u_aud_limit_sil_restarts_test1"], readonly ["64", "ptt_playback_speed_enabled", "web_product_list_message_enabled", "paid_convo_ts", "27", "manufacturer", "psp-routing", "grp_uii_cleanup", "ptt_draft_enabled", "03c", "business_initiated", "web_catalog_products_onoff", "web_upload_link_thumb_mms_enabled", "03e", "mediaretry", "35", "hfm_string_changes", "28", "America/Fortaleza", "max_keys", "md_mhfs_days", "streaming_upload_chunk_size", "5541", "040", "03d", "2675", "03f", "...", "512", "mute", "48", "041", "alt_jpeg_quality", "60", "042", "md_smb_quick_reply", "5183", "c", "1343", "40", "1230", "043", "044", "mms_cat_v1_forward_hot_override_enabled", "user_notice", "ptt_waveform_send", "047", "Asia/Calcutta", "250", "md_privacy_v2", "31", "29", "128", "md_messaging_enabled", "046", "crypto", "690", "045", "enc_iv", "75", "failure", "ptt_oot_playback", "AIzaSyDR5yfaG7OG8sMTUj8kfQEb8T9pN8BM6Lk", "w", "048", "2201", "web_large_files_ui", "Asia/Makassar", "812", "status_collapse_muted", "1334", "257", "2HP4dm", "049", "patches", "1290", "43cY6T", "America/Caracas", "web_sticker_maker", "campaign", "ptt_pausable_enabled", "33", "42", "attestation", "biz", "04b", "query_linked", "s", "125", "04a", "810", "availability", "1411", "responsiveness_v2_m1", "catalog_not_created", "34", "America/Santiago", "1465", "enc_p", "04d", "status_info", "04f", "key_version", "..", "04c", "04e", "md_group_notification", "1598", "1215", "web_cart_enabled", "37", "630", "1920", "2394", "-1", "vcard", "38", "elapsed", "36", "828", "peer", "pricing_category", "1245", "invalid", "stella_ios_enabled", "2687", "45", "1528", "39", "u_is_redial_audio_1104_ctrl", "1025", "1455", "58", "2524", "2603", "054", "bsp_system_message_enabled", "web_pip_redesign", "051", "verify_apps", "1974", "1272", "1322", "1755", "052", "70", "050", "1063", "1135", "1361", "80", "1096", "1828", "1851", "1251", "1921", "key_config_id", "1254", "1566", "1252", "2525", "critical_block", "1669", "max_available", "w:auth:backup:token", "product", "2530", "870", "1022", "participant_uuid", "web_cart_on_off", "1255", "1432", "1867", "41", "1415", "1440", "240", "1204", "1608", "1690", "1846", "1483", "1687", "1749", "69", "url_number", "053", "1325", "1040", "365", "59", "Asia/Riyadh", "1177", "test_recommended", "057", "1612", "43", "1061", "1518", "1635", "055", "1034", "1375", "750", "1430", "event_code", "1682", "503", "55", "865", "78", "1309", "1365", "44", "America/Guayaquil", "535", "LIMITED", "1377", "1613", "1420", "1599", "1822", "05a", "1681", "password", "1111", "1214", "1376", "1478", "47", "1082", "4282", "Europe/Istanbul", "1307", "46", "058", "1124", "256", "rate-overlimit", "retail", "u_a_socket_err_fix_succ_test", "1292", "1370", "1388", "520", "861", "psa", "regular", "1181", "1766", "05b", "1183", "1213", "1304", "1537"], readonly ["1724", "profile_picture", "1071", "1314", "1605", "407", "990", "1710", "746", "pricing_model", "056", "059", "061", "1119", "6027", "65", "877", "1607", "05d", "917", "seen", "1516", "49", "470", "973", "1037", "1350", "1394", "1480", "1796", "keys", "794", "1536", "1594", "2378", "1333", "1524", "1825", "116", "309", "52", "808", "827", "909", "495", "1660", "361", "957", "google", "1357", "1565", "1967", "996", "1775", "586", "736", "1052", "1670", "bank", "177", "1416", "2194", "2222", "1454", "1839", "1275", "53", "997", "1629", "6028", "smba", "1378", "1410", "05c", "1849", "727", "create", "1559", "536", "1106", "1310", "1944", "670", "1297", "1316", "1762", "en", "1148", "1295", "1551", "1853", "1890", "1208", "1784", "7200", "05f", "178", "1283", "1332", "381", "643", "1056", "1238", "2024", "2387", "179", "981", "1547", "1705", "05e", "290", "903", "1069", "1285", "2436", "062", "251", "560", "582", "719", "56", "1700", "2321", "325", "448", "613", "777", "791", "51", "488", "902", "Asia/Almaty", "is_hidden", "1398", "1527", "1893", "1999", "2367", "2642", "237", "busy", "065", "067", "233", "590", "993", "1511", "54", "723", "860", "363", "487", "522", "605", "995", "1321", "1691", "1865", "2447", "2462", "NON_TRANSACTIONAL", "433", "871", "432", "1004", "1207", "2032", "2050", "2379", "2446", "279", "636", "703", "904", "248", "370", "691", "700", "1068", "1655", "2334", "060", "063", "364", "533", "534", "567", "1191", "1210", "1473", "1827", "069", "701", "2531", "514", "prev_dhash", "064", "496", "790", "1046", "1139", "1505", "1521", "1108", "207", "544", "637", "final", "1173", "1293", "1694", "1939", "1951", "1993", "2353", "2515", "504", "601", "857", "modify", "spam_request", "p_121_aa_1101_test4", "866", "1427", "1502", "1638", "1744", "2153", "068", "382", "725", "1704", "1864", "1990", "2003", "Asia/Dubai", "508", "531", "1387", "1474", "1632", "2307", "2386", "819", "2014", "066", "387", "1468", "1706", "2186", "2261", "471", "728", "1147", "1372", "1961"]];
|
21
|
+
export declare const SINGLE_BYTE_TOKENS: string[];
|
22
|
+
export declare const TOKEN_MAP: {
|
23
|
+
[token: string]: {
|
24
|
+
dict?: number;
|
25
|
+
index: number;
|
26
|
+
};
|
27
|
+
};
|