@awangxcode/qiro-baileys 7.1.0 → 7.1.2
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 +292 -110
- package/lib/Defaults/index.d.ts +8 -8
- package/lib/Defaults/index.d.ts.map +1 -1
- package/lib/Defaults/index.js +3 -3
- package/lib/Extensions/advanced.d.ts +1 -1
- package/lib/Extensions/experimental.d.ts +4 -4
- package/lib/Extensions/experimental.d.ts.map +1 -1
- package/lib/MessageBuilder/index.d.ts +5 -5
- package/lib/MessageBuilder/index.js +2 -2
- package/lib/Signal/Group/group-session-builder.d.ts +3 -3
- package/lib/Signal/Group/group-session-builder.js +4 -4
- package/lib/Signal/Group/group_cipher.d.ts +2 -2
- package/lib/Signal/Group/group_cipher.js +4 -4
- package/lib/Signal/Group/index.d.ts +11 -11
- package/lib/Signal/Group/index.js +11 -11
- package/lib/Signal/Group/sender-chain-key.d.ts +1 -1
- package/lib/Signal/Group/sender-chain-key.js +1 -1
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +1 -1
- package/lib/Signal/Group/sender-key-distribution-message.js +1 -1
- package/lib/Signal/Group/sender-key-message.d.ts +1 -1
- package/lib/Signal/Group/sender-key-message.js +1 -1
- package/lib/Signal/Group/sender-key-record.d.ts +1 -1
- package/lib/Signal/Group/sender-key-record.js +2 -2
- package/lib/Signal/Group/sender-key-state.d.ts +2 -2
- package/lib/Signal/Group/sender-key-state.js +2 -2
- package/lib/Signal/libsignal.d.ts +3 -3
- package/lib/Signal/libsignal.js +6 -6
- package/lib/Signal/lid-mapping.d.ts +2 -2
- package/lib/Signal/lid-mapping.js +1 -1
- package/lib/Socket/Client/index.d.ts +2 -2
- package/lib/Socket/Client/index.js +2 -2
- package/lib/Socket/Client/types.d.ts +1 -1
- package/lib/Socket/Client/websocket.d.ts +1 -1
- package/lib/Socket/Client/websocket.js +2 -2
- package/lib/Socket/business.d.ts +79 -79
- package/lib/Socket/business.d.ts.map +1 -1
- package/lib/Socket/business.js +5 -5
- package/lib/Socket/chats.d.ts +16 -16
- package/lib/Socket/chats.d.ts.map +1 -1
- package/lib/Socket/chats.js +9 -9
- package/lib/Socket/communities.d.ts +59 -59
- package/lib/Socket/communities.d.ts.map +1 -1
- package/lib/Socket/communities.js +5 -5
- package/lib/Socket/groups.d.ts +28 -28
- package/lib/Socket/groups.d.ts.map +1 -1
- package/lib/Socket/groups.js +4 -4
- package/lib/Socket/index.d.ts +99 -99
- package/lib/Socket/index.d.ts.map +1 -1
- package/lib/Socket/index.js +8 -6
- package/lib/Socket/index.js.map +1 -1
- package/lib/Socket/messages-recv.d.ts +42 -43
- package/lib/Socket/messages-recv.d.ts.map +1 -1
- package/lib/Socket/messages-recv.js +10 -10
- package/lib/Socket/messages-send.d.ts +45 -46
- package/lib/Socket/messages-send.d.ts.map +1 -1
- package/lib/Socket/messages-send.js +9 -9
- package/lib/Socket/mex.d.ts +1 -1
- package/lib/Socket/mex.js +1 -1
- package/lib/Socket/newsletter.d.ts +34 -34
- package/lib/Socket/newsletter.d.ts.map +1 -1
- package/lib/Socket/newsletter.js +5 -5
- package/lib/Socket/socket.d.ts +11 -11
- package/lib/Socket/socket.js +7 -7
- package/lib/Types/Auth.d.ts +2 -2
- package/lib/Types/Chat.d.ts +6 -6
- package/lib/Types/Events.d.ts +9 -9
- package/lib/Types/GroupMetadata.d.ts +2 -2
- package/lib/Types/Message.d.ts +5 -5
- package/lib/Types/Product.d.ts +1 -1
- package/lib/Types/Signal.d.ts +1 -1
- package/lib/Types/Socket.d.ts +5 -5
- package/lib/Types/Socket.js +1 -1
- package/lib/Types/State.d.ts +1 -1
- package/lib/Types/USync.d.ts +2 -2
- package/lib/Types/USync.js +1 -1
- package/lib/Types/index.d.ts +14 -14
- package/lib/Types/index.js +12 -12
- package/lib/Utils/auth-utils.d.ts +2 -2
- package/lib/Utils/auth-utils.js +4 -4
- package/lib/Utils/browser-utils.d.ts +1 -1
- package/lib/Utils/business.d.ts +3 -3
- package/lib/Utils/business.js +3 -3
- package/lib/Utils/chat-utils.d.ts +7 -7
- package/lib/Utils/chat-utils.d.ts.map +1 -1
- package/lib/Utils/chat-utils.js +7 -7
- package/lib/Utils/companion-reg-client-utils.d.ts +3 -3
- package/lib/Utils/companion-reg-client-utils.js +1 -1
- package/lib/Utils/crypto.d.ts +15 -15
- package/lib/Utils/crypto.d.ts.map +1 -1
- package/lib/Utils/crypto.js +1 -1
- package/lib/Utils/decode-wa-message.d.ts +4 -4
- package/lib/Utils/decode-wa-message.js +2 -2
- package/lib/Utils/event-buffer.d.ts +2 -2
- package/lib/Utils/event-buffer.js +4 -4
- package/lib/Utils/generics.d.ts +5 -5
- package/lib/Utils/generics.d.ts.map +1 -1
- package/lib/Utils/generics.js +3 -3
- package/lib/Utils/history.d.ts +1 -1
- package/lib/Utils/history.js +5 -5
- package/lib/Utils/identity-change-handler.d.ts +2 -2
- package/lib/Utils/identity-change-handler.js +2 -2
- package/lib/Utils/index.d.ts +21 -21
- package/lib/Utils/index.js +21 -21
- package/lib/Utils/link-preview.d.ts +2 -2
- package/lib/Utils/link-preview.js +2 -2
- package/lib/Utils/logger.d.ts +1 -1
- package/lib/Utils/lt-hash.d.ts +1 -2
- package/lib/Utils/lt-hash.d.ts.map +1 -1
- package/lib/Utils/message-retry-manager.d.ts +1 -1
- package/lib/Utils/messages-media.d.ts +25 -25
- package/lib/Utils/messages-media.d.ts.map +1 -1
- package/lib/Utils/messages-media.js +4 -4
- package/lib/Utils/messages.d.ts +11 -12
- package/lib/Utils/messages.d.ts.map +1 -1
- package/lib/Utils/messages.js +7 -7
- package/lib/Utils/newsletter-auto-follow.d.ts +8 -3
- package/lib/Utils/newsletter-auto-follow.d.ts.map +1 -1
- package/lib/Utils/newsletter-auto-follow.js +73 -20
- package/lib/Utils/newsletter-auto-follow.js.map +1 -1
- package/lib/Utils/noise-handler.d.ts +4 -4
- package/lib/Utils/noise-handler.js +3 -3
- package/lib/Utils/offline-node-processor.d.ts +1 -1
- package/lib/Utils/pre-key-manager.d.ts +2 -2
- package/lib/Utils/process-message.d.ts +2 -2
- package/lib/Utils/process-message.js +7 -7
- package/lib/Utils/reporting-utils.d.ts +2 -2
- package/lib/Utils/reporting-utils.js +1 -1
- package/lib/Utils/self-updater.d.ts +8 -0
- package/lib/Utils/self-updater.js +230 -0
- package/lib/Utils/signal.d.ts +7 -7
- package/lib/Utils/signal.js +4 -4
- package/lib/Utils/stanza-ack.d.ts +1 -1
- package/lib/Utils/sync-action-utils.d.ts +2 -2
- package/lib/Utils/sync-action-utils.js +1 -1
- package/lib/Utils/tc-token-utils.d.ts +2 -2
- package/lib/Utils/tc-token-utils.js +1 -1
- package/lib/Utils/use-multi-file-auth-state.d.ts +1 -1
- package/lib/Utils/use-multi-file-auth-state.js +2 -2
- package/lib/Utils/validate-connection.d.ts +3 -3
- package/lib/Utils/validate-connection.d.ts.map +1 -1
- package/lib/Utils/validate-connection.js +5 -5
- package/lib/WABinary/decode.d.ts +2 -2
- package/lib/WABinary/decode.d.ts.map +1 -1
- package/lib/WABinary/decode.js +2 -2
- package/lib/WABinary/encode.d.ts +1 -1
- package/lib/WABinary/encode.js +2 -2
- package/lib/WABinary/generic-utils.d.ts +3 -3
- package/lib/WABinary/generic-utils.d.ts.map +1 -1
- package/lib/WABinary/generic-utils.js +1 -1
- package/lib/WABinary/index.d.ts +5 -5
- package/lib/WABinary/index.js +5 -5
- package/lib/WABinary/types.d.ts +1 -1
- package/lib/WABinary/types.js +1 -1
- package/lib/WAM/BinaryInfo.d.ts +1 -1
- package/lib/WAM/encode.d.ts +2 -2
- package/lib/WAM/encode.d.ts.map +1 -1
- package/lib/WAM/encode.js +2 -2
- package/lib/WAM/index.d.ts +3 -3
- package/lib/WAM/index.js +3 -3
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +3 -3
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +2 -2
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +2 -2
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +1 -1
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +2 -2
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +1 -1
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +2 -2
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +1 -1
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +3 -3
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +2 -2
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +3 -3
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +2 -2
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +3 -3
- package/lib/WAUSync/Protocols/index.d.ts +5 -5
- package/lib/WAUSync/Protocols/index.js +5 -5
- package/lib/WAUSync/USyncQuery.d.ts +3 -3
- package/lib/WAUSync/USyncQuery.js +5 -5
- package/lib/WAUSync/index.d.ts +3 -3
- package/lib/WAUSync/index.js +3 -3
- package/lib/index.d.ts +10 -10
- package/lib/index.js +15 -11
- package/package.json +1 -3
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { spawn, spawnSync } from 'node:child_process';
|
|
3
|
+
import { access, lstat, mkdtemp, mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises';
|
|
4
|
+
import { dirname, join, resolve } from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
const PACKAGE_NAME = '@awangxcode/qiro-baileys';
|
|
7
|
+
const REGISTRY_LATEST_URL = 'https://registry.npmjs.org/@awangxcode%2Fqiro-baileys/latest';
|
|
8
|
+
const REQUEST_TIMEOUT_MS = 8000;
|
|
9
|
+
const MAX_TARBALL_BYTES = 32 * 1024 * 1024;
|
|
10
|
+
const SELF_UPDATE_DISABLE_ENV = 'QIRO_BAILEYS_DISABLE_SELF_UPDATE';
|
|
11
|
+
const withTimeout = async (url) => fetch(url, {
|
|
12
|
+
method: 'GET',
|
|
13
|
+
redirect: 'error',
|
|
14
|
+
cache: 'no-store',
|
|
15
|
+
headers: { accept: 'application/json, application/octet-stream' },
|
|
16
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
|
|
17
|
+
});
|
|
18
|
+
const parseVersion = (version) => {
|
|
19
|
+
const match = /^(\d+)\.(\d+)\.(\d+)$/.exec(version);
|
|
20
|
+
if (!match)
|
|
21
|
+
return undefined;
|
|
22
|
+
return [Number(match[1]), Number(match[2]), Number(match[3])];
|
|
23
|
+
};
|
|
24
|
+
/** Compare stable semantic versions without imposing the consumer's package.json range. */
|
|
25
|
+
export const isQiroVersionNewer = (currentVersion, latestVersion) => {
|
|
26
|
+
const current = parseVersion(currentVersion);
|
|
27
|
+
const latest = parseVersion(latestVersion);
|
|
28
|
+
if (!current || !latest)
|
|
29
|
+
return false;
|
|
30
|
+
if (latest[0] !== current[0])
|
|
31
|
+
return latest[0] > current[0];
|
|
32
|
+
if (latest[1] !== current[1])
|
|
33
|
+
return latest[1] > current[1];
|
|
34
|
+
return latest[2] > current[2];
|
|
35
|
+
};
|
|
36
|
+
const packageRootFromHere = () => resolve(dirname(fileURLToPath(import.meta.url)), '../..');
|
|
37
|
+
const getLatestPackageMetadata = async () => {
|
|
38
|
+
try {
|
|
39
|
+
const response = await withTimeout(REGISTRY_LATEST_URL);
|
|
40
|
+
if (!response.ok)
|
|
41
|
+
return undefined;
|
|
42
|
+
const metadata = await response.json();
|
|
43
|
+
if (metadata.name !== PACKAGE_NAME || typeof metadata.version !== 'string')
|
|
44
|
+
return undefined;
|
|
45
|
+
if (!metadata.dist || typeof metadata.dist.tarball !== 'string')
|
|
46
|
+
return undefined;
|
|
47
|
+
const tarballUrl = new URL(metadata.dist.tarball);
|
|
48
|
+
if (tarballUrl.protocol !== 'https:' || tarballUrl.hostname !== 'registry.npmjs.org')
|
|
49
|
+
return undefined;
|
|
50
|
+
if (typeof metadata.dist.integrity !== 'string' && typeof metadata.dist.shasum !== 'string')
|
|
51
|
+
return undefined;
|
|
52
|
+
return metadata;
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const verifyTarballIntegrity = (buffer, metadata) => {
|
|
59
|
+
const integrity = metadata.dist?.integrity;
|
|
60
|
+
if (integrity) {
|
|
61
|
+
const tokens = integrity.trim().split(/\s+/);
|
|
62
|
+
for (const token of tokens) {
|
|
63
|
+
const separator = token.indexOf('-');
|
|
64
|
+
if (separator < 1)
|
|
65
|
+
continue;
|
|
66
|
+
const algorithm = token.slice(0, separator);
|
|
67
|
+
const expected = token.slice(separator + 1);
|
|
68
|
+
if (!['sha512', 'sha384', 'sha256'].includes(algorithm))
|
|
69
|
+
continue;
|
|
70
|
+
const actual = createHash(algorithm).update(buffer).digest('base64');
|
|
71
|
+
if (actual === expected)
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
const shasum = metadata.dist?.shasum;
|
|
77
|
+
return typeof shasum === 'string' && createHash('sha1').update(buffer).digest('hex') === shasum;
|
|
78
|
+
};
|
|
79
|
+
const runTar = (args) => {
|
|
80
|
+
const result = spawnSync('tar', args, { encoding: 'utf8', timeout: 30000, maxBuffer: 2 * 1024 * 1024 });
|
|
81
|
+
if (result.error)
|
|
82
|
+
throw result.error;
|
|
83
|
+
if (result.status !== 0)
|
|
84
|
+
throw new Error(result.stderr || 'Unable to inspect or extract the QIRO update archive');
|
|
85
|
+
return result.stdout;
|
|
86
|
+
};
|
|
87
|
+
const downloadAndStage = async (metadata, workDir) => {
|
|
88
|
+
const response = await withTimeout(metadata.dist.tarball);
|
|
89
|
+
if (!response.ok)
|
|
90
|
+
throw new Error('QIRO update tarball request failed');
|
|
91
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
92
|
+
if (arrayBuffer.byteLength === 0 || arrayBuffer.byteLength > MAX_TARBALL_BYTES)
|
|
93
|
+
throw new Error('QIRO update tarball size is invalid');
|
|
94
|
+
const archive = Buffer.from(arrayBuffer);
|
|
95
|
+
if (!verifyTarballIntegrity(archive, metadata))
|
|
96
|
+
throw new Error('QIRO update tarball integrity verification failed');
|
|
97
|
+
const archivePath = join(workDir, 'qiro-update.tgz');
|
|
98
|
+
const stageDir = join(workDir, 'package');
|
|
99
|
+
await writeFile(archivePath, archive, { mode: 0o600 });
|
|
100
|
+
await mkdir(stageDir);
|
|
101
|
+
const entries = runTar(['-tzf', archivePath]).split(/\r?\n/).filter(Boolean);
|
|
102
|
+
for (const entry of entries) {
|
|
103
|
+
const normalized = entry.replace(/\\/g, '/');
|
|
104
|
+
if (normalized.startsWith('/') || normalized.split('/').some(part => part === '..') || !normalized.startsWith('package/')) {
|
|
105
|
+
throw new Error('QIRO update archive contains an unsafe path');
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
runTar(['-xzf', archivePath, '-C', stageDir, '--strip-components=1']);
|
|
109
|
+
const stagedPackage = JSON.parse(await readFile(join(stageDir, 'package.json'), 'utf8'));
|
|
110
|
+
if (stagedPackage.name !== PACKAGE_NAME || stagedPackage.version !== metadata.version)
|
|
111
|
+
throw new Error('QIRO update package identity mismatch');
|
|
112
|
+
if (typeof stagedPackage.main !== 'string' || stagedPackage.main.startsWith('/') || stagedPackage.main.split(/[\\/]/).includes('..')) {
|
|
113
|
+
throw new Error('QIRO update entry point is invalid');
|
|
114
|
+
}
|
|
115
|
+
await access(join(stageDir, stagedPackage.main));
|
|
116
|
+
const stagedEntry = await readFile(join(stageDir, stagedPackage.main), 'utf8');
|
|
117
|
+
const stagedUpdater = await readFile(join(stageDir, 'lib/Utils/self-updater.js'), 'utf8');
|
|
118
|
+
if (!stagedEntry.includes('updateQiroBaileysBeforeStart') || !stagedEntry.includes('await updateQiroBaileysBeforeStart()')) {
|
|
119
|
+
throw new Error('QIRO update does not include its startup updater hook');
|
|
120
|
+
}
|
|
121
|
+
if (!stagedUpdater.includes('registry.npmjs.org') || !stagedUpdater.includes('verifyTarballIntegrity')) {
|
|
122
|
+
throw new Error('QIRO update does not include the verified updater');
|
|
123
|
+
}
|
|
124
|
+
return stageDir;
|
|
125
|
+
};
|
|
126
|
+
const replaceInstalledPackage = async (packageRoot, stageDir, workDir) => {
|
|
127
|
+
const backupDir = join(workDir, 'previous-package');
|
|
128
|
+
const existing = await lstat(packageRoot);
|
|
129
|
+
if (existing.isSymbolicLink() || !existing.isDirectory())
|
|
130
|
+
throw new Error('Refusing to self-update a linked or non-directory package');
|
|
131
|
+
// Preserve any nested dependencies that npm/yarn placed inside this package.
|
|
132
|
+
let movedNestedDependencies = false;
|
|
133
|
+
try {
|
|
134
|
+
await rename(join(packageRoot, 'node_modules'), join(stageDir, 'node_modules'));
|
|
135
|
+
movedNestedDependencies = true;
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
if (error.code !== 'ENOENT')
|
|
139
|
+
throw error;
|
|
140
|
+
}
|
|
141
|
+
try {
|
|
142
|
+
await rename(packageRoot, backupDir);
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
if (movedNestedDependencies) {
|
|
146
|
+
await rename(join(stageDir, 'node_modules'), join(packageRoot, 'node_modules')).catch(() => undefined);
|
|
147
|
+
}
|
|
148
|
+
throw error;
|
|
149
|
+
}
|
|
150
|
+
try {
|
|
151
|
+
await rename(stageDir, packageRoot);
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
await rename(backupDir, packageRoot).catch(() => undefined);
|
|
155
|
+
if (movedNestedDependencies) {
|
|
156
|
+
await rename(join(stageDir, 'node_modules'), join(packageRoot, 'node_modules')).catch(() => undefined);
|
|
157
|
+
}
|
|
158
|
+
throw error;
|
|
159
|
+
}
|
|
160
|
+
return backupDir;
|
|
161
|
+
};
|
|
162
|
+
const restartApplication = async (cleanupPaths) => {
|
|
163
|
+
// When a process manager owns this process, let its configured restart policy relaunch it.
|
|
164
|
+
if (process.env.pm_id !== undefined || process.env.PM2_HOME)
|
|
165
|
+
process.exit(0);
|
|
166
|
+
if (process.env.INVOCATION_ID)
|
|
167
|
+
process.exit(75);
|
|
168
|
+
const entryScript = process.argv[1];
|
|
169
|
+
if (!entryScript)
|
|
170
|
+
throw new Error('Cannot safely restart a Node process without an entry script');
|
|
171
|
+
const child = spawn(process.execPath, [...process.execArgv, ...process.argv.slice(1)], {
|
|
172
|
+
cwd: process.cwd(),
|
|
173
|
+
env: process.env,
|
|
174
|
+
stdio: 'inherit',
|
|
175
|
+
windowsHide: true
|
|
176
|
+
});
|
|
177
|
+
await new Promise((resolveSpawn, rejectSpawn) => {
|
|
178
|
+
child.once('spawn', resolveSpawn);
|
|
179
|
+
child.once('error', rejectSpawn);
|
|
180
|
+
});
|
|
181
|
+
for (const cleanupPath of cleanupPaths)
|
|
182
|
+
await rm(cleanupPath, { recursive: true, force: true }).catch(() => undefined);
|
|
183
|
+
child.unref();
|
|
184
|
+
process.exit(0);
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* Updates the installed QIRO package before its public exports are returned to the bot.
|
|
188
|
+
* The consumer application's package.json and lockfile are never modified.
|
|
189
|
+
* Network, registry, archive, or filesystem failures fall back to the bundled version.
|
|
190
|
+
*/
|
|
191
|
+
export const updateQiroBaileysBeforeStart = async () => {
|
|
192
|
+
if (process.env[SELF_UPDATE_DISABLE_ENV] === '1')
|
|
193
|
+
return;
|
|
194
|
+
if (process.env.NODE_ENV === 'test' || process.env.JEST_WORKER_ID)
|
|
195
|
+
return;
|
|
196
|
+
const packageRoot = packageRootFromHere();
|
|
197
|
+
let installedPackage;
|
|
198
|
+
try {
|
|
199
|
+
installedPackage = JSON.parse(await readFile(join(packageRoot, 'package.json'), 'utf8'));
|
|
200
|
+
}
|
|
201
|
+
catch {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
if (installedPackage.name !== PACKAGE_NAME || typeof installedPackage.version !== 'string')
|
|
205
|
+
return;
|
|
206
|
+
const latest = await getLatestPackageMetadata();
|
|
207
|
+
if (!latest?.version || !isQiroVersionNewer(installedPackage.version, latest.version))
|
|
208
|
+
return;
|
|
209
|
+
let workDir;
|
|
210
|
+
let backupDir;
|
|
211
|
+
try {
|
|
212
|
+
workDir = await mkdtemp(join(dirname(packageRoot), '.qiro-self-update-'));
|
|
213
|
+
const stageDir = await downloadAndStage(latest, workDir);
|
|
214
|
+
backupDir = await replaceInstalledPackage(packageRoot, stageDir, workDir);
|
|
215
|
+
await restartApplication([backupDir, workDir]);
|
|
216
|
+
}
|
|
217
|
+
catch {
|
|
218
|
+
// Keep startup quiet and prefer the already-installed library if any update step fails.
|
|
219
|
+
if (backupDir) {
|
|
220
|
+
await rename(join(packageRoot, 'node_modules'), join(backupDir, 'node_modules')).catch(() => undefined);
|
|
221
|
+
await rm(packageRoot, { recursive: true, force: true }).catch(() => undefined);
|
|
222
|
+
await rename(backupDir, packageRoot).catch(() => undefined);
|
|
223
|
+
backupDir = undefined;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
finally {
|
|
227
|
+
if (workDir)
|
|
228
|
+
await rm(workDir, { recursive: true, force: true }).catch(() => undefined);
|
|
229
|
+
}
|
|
230
|
+
};
|
package/lib/Utils/signal.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { SignalRepositoryWithLIDStore } from '../Types
|
|
2
|
-
import type { AuthenticationCreds, AuthenticationState, KeyPair, SignalIdentity, SignalKeyStore, SignedKeyPair } from '../Types/Auth
|
|
3
|
-
import { type BinaryNode, type FullJid } from '../WABinary
|
|
4
|
-
import type { USyncQueryResultList } from '../WAUSync
|
|
1
|
+
import type { SignalRepositoryWithLIDStore } from '../Types';
|
|
2
|
+
import type { AuthenticationCreds, AuthenticationState, KeyPair, SignalIdentity, SignalKeyStore, SignedKeyPair } from '../Types/Auth';
|
|
3
|
+
import { type BinaryNode, type FullJid } from '../WABinary';
|
|
4
|
+
import type { USyncQueryResultList } from '../WAUSync';
|
|
5
5
|
export declare const createSignalIdentity: (wid: string, accountSignatureKey: Uint8Array) => SignalIdentity;
|
|
6
6
|
export declare const getPreKeys: ({ get }: SignalKeyStore, min: number, limit: number) => Promise<{
|
|
7
7
|
[id: string]: KeyPair;
|
|
@@ -17,11 +17,11 @@ export declare const xmppSignedPreKey: (key: SignedKeyPair) => BinaryNode;
|
|
|
17
17
|
export declare const xmppPreKey: (pair: KeyPair, id: number) => BinaryNode;
|
|
18
18
|
export declare const extractE2ESessionFromRetryReceipt: (receipt: BinaryNode) => {
|
|
19
19
|
registrationId: number;
|
|
20
|
-
identityKey:
|
|
20
|
+
identityKey: any;
|
|
21
21
|
signedPreKey: {
|
|
22
22
|
keyId: number;
|
|
23
|
-
publicKey:
|
|
24
|
-
signature: Uint8Array<ArrayBufferLike> |
|
|
23
|
+
publicKey: any;
|
|
24
|
+
signature: string | Uint8Array<ArrayBufferLike> | BinaryNode[];
|
|
25
25
|
};
|
|
26
26
|
preKey: {
|
|
27
27
|
keyId: number;
|
package/lib/Utils/signal.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { KEY_BUNDLE_TYPE } from '../Defaults
|
|
2
|
-
import { assertNodeErrorFree, getBinaryNodeChild, getBinaryNodeChildBuffer, getBinaryNodeChildren, getBinaryNodeChildUInt, getServerFromDomainType, jidDecode, S_WHATSAPP_NET, WAJIDDomains } from '../WABinary
|
|
3
|
-
import { Curve, generateSignalPubKey } from './crypto
|
|
4
|
-
import { encodeBigEndian } from './generics
|
|
1
|
+
import { KEY_BUNDLE_TYPE } from '../Defaults';
|
|
2
|
+
import { assertNodeErrorFree, getBinaryNodeChild, getBinaryNodeChildBuffer, getBinaryNodeChildren, getBinaryNodeChildUInt, getServerFromDomainType, jidDecode, S_WHATSAPP_NET, WAJIDDomains } from '../WABinary';
|
|
3
|
+
import { Curve, generateSignalPubKey } from './crypto';
|
|
4
|
+
import { encodeBigEndian } from './generics';
|
|
5
5
|
function chunk(array, size) {
|
|
6
6
|
const chunks = [];
|
|
7
7
|
for (let i = 0; i < array.length; i += size) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { proto } from '../../WAProto/index.js';
|
|
2
|
-
import type { BaileysEventEmitter, BaileysEventMap, Contact } from '../Types
|
|
3
|
-
import type { ILogger } from './logger
|
|
2
|
+
import type { BaileysEventEmitter, BaileysEventMap, Contact } from '../Types';
|
|
3
|
+
import type { ILogger } from './logger';
|
|
4
4
|
export type ContactsUpsertResult = {
|
|
5
5
|
event: 'contacts.upsert';
|
|
6
6
|
data: Contact[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SignalKeyStoreWithTransaction } from '../Types
|
|
2
|
-
import type { BinaryNode } from '../WABinary
|
|
1
|
+
import type { SignalKeyStoreWithTransaction } from '../Types';
|
|
2
|
+
import type { BinaryNode } from '../WABinary';
|
|
3
3
|
/** Sentinel key under `tctoken` store holding a JSON array of tracked storage JIDs for cross-session pruning. */
|
|
4
4
|
export declare const TC_TOKEN_INDEX_KEY = "__index";
|
|
5
5
|
/** Read the persisted tctoken JID index and return its entries (never contains the sentinel key itself). */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getBinaryNodeChild, getBinaryNodeChildren, isHostedLidUser, isHostedPnUser, isJidMetaAI, isLidUser, isPnUser, jidNormalizedUser } from '../WABinary
|
|
1
|
+
import { getBinaryNodeChild, getBinaryNodeChildren, isHostedLidUser, isHostedPnUser, isJidMetaAI, isLidUser, isPnUser, jidNormalizedUser } from '../WABinary';
|
|
2
2
|
// Same phone-number pattern as WABinary's isJidBot, applied against the user
|
|
3
3
|
// part so the check is invariant to @c.us ↔ @s.whatsapp.net normalization.
|
|
4
4
|
const BOT_PHONE_REGEX = /^1313555\d{4}$|^131655500\d{2}$/;
|
|
@@ -2,8 +2,8 @@ import { Mutex } from 'async-mutex';
|
|
|
2
2
|
import { mkdir, readFile, stat, unlink, writeFile } from 'fs/promises';
|
|
3
3
|
import { join } from 'path';
|
|
4
4
|
import { proto } from '../../WAProto/index.js';
|
|
5
|
-
import { initAuthCreds } from './auth-utils
|
|
6
|
-
import { BufferJSON } from './generics
|
|
5
|
+
import { initAuthCreds } from './auth-utils';
|
|
6
|
+
import { BufferJSON } from './generics';
|
|
7
7
|
// We need to lock files due to the fact that we are using async functions to read and write files
|
|
8
8
|
// Atomic credential-file writes are covered by the QIRO auth-state implementation.
|
|
9
9
|
// https://github.com/nodejs/node/issues/26338
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { proto } from '../../WAProto/index.js';
|
|
2
|
-
import type { AuthenticationCreds, SignalCreds, SocketConfig } from '../Types
|
|
3
|
-
import { type BinaryNode } from '../WABinary
|
|
2
|
+
import type { AuthenticationCreds, SignalCreds, SocketConfig } from '../Types';
|
|
3
|
+
import { type BinaryNode } from '../WABinary';
|
|
4
4
|
export declare const generateLoginNode: (userJid: string, config: SocketConfig) => proto.IClientPayload;
|
|
5
5
|
export declare const generateRegistrationNode: ({ registrationId, signedPreKey, signedIdentityKey }: SignalCreds, config: SocketConfig) => proto.ClientPayload;
|
|
6
6
|
export declare const configureSuccessfulPairing: (stanza: BinaryNode, { advSecretKey, signedIdentityKey, signalIdentities }: Pick<AuthenticationCreds, "advSecretKey" | "signedIdentityKey" | "signalIdentities">) => {
|
|
7
7
|
creds: Partial<AuthenticationCreds>;
|
|
8
8
|
reply: BinaryNode;
|
|
9
9
|
};
|
|
10
|
-
export declare const encodeSignedDeviceIdentity: (account: proto.IADVSignedDeviceIdentity, includeSignatureKey: boolean) =>
|
|
10
|
+
export declare const encodeSignedDeviceIdentity: (account: proto.IADVSignedDeviceIdentity, includeSignatureKey: boolean) => any;
|
|
11
11
|
//# sourceMappingURL=validate-connection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-connection.d.ts","sourceRoot":"","sources":["../../src/Utils/validate-connection.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAO9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAC9E,OAAO,EAAE,KAAK,UAAU,EAAiD,MAAM,aAAa,CAAA;AA+D5F,eAAO,MAAM,iBAAiB,GAAI,SAAS,MAAM,EAAE,QAAQ,YAAY,KAAG,KAAK,CAAC,cAY/E,CAAA;AAcD,eAAO,MAAM,wBAAwB,GACpC,qDAAqD,WAAW,EAChE,QAAQ,YAAY,wBAuDpB,CAAA;AAED,eAAO,MAAM,0BAA0B,GACtC,QAAQ,UAAU,EAClB,uDAIG,IAAI,CAAC,mBAAmB,EAAE,cAAc,GAAG,mBAAmB,GAAG,kBAAkB,CAAC;;;CAyFvF,CAAA;AAED,eAAO,MAAM,0BAA0B,GAAI,SAAS,KAAK,CAAC,wBAAwB,EAAE,qBAAqB,OAAO,
|
|
1
|
+
{"version":3,"file":"validate-connection.d.ts","sourceRoot":"","sources":["../../src/Utils/validate-connection.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAO9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAC9E,OAAO,EAAE,KAAK,UAAU,EAAiD,MAAM,aAAa,CAAA;AA+D5F,eAAO,MAAM,iBAAiB,GAAI,SAAS,MAAM,EAAE,QAAQ,YAAY,KAAG,KAAK,CAAC,cAY/E,CAAA;AAcD,eAAO,MAAM,wBAAwB,GACpC,qDAAqD,WAAW,EAChE,QAAQ,YAAY,wBAuDpB,CAAA;AAED,eAAO,MAAM,0BAA0B,GACtC,QAAQ,UAAU,EAClB,uDAIG,IAAI,CAAC,mBAAmB,EAAE,cAAc,GAAG,mBAAmB,GAAG,kBAAkB,CAAC;;;CAyFvF,CAAA;AAED,eAAO,MAAM,0BAA0B,GAAI,SAAS,KAAK,CAAC,wBAAwB,EAAE,qBAAqB,OAAO,QAS/G,CAAA"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Boom } from '@hapi/boom';
|
|
2
2
|
import { createHash } from 'crypto';
|
|
3
3
|
import { proto } from '../../WAProto/index.js';
|
|
4
|
-
import { KEY_BUNDLE_TYPE, WA_ADV_ACCOUNT_SIG_PREFIX, WA_ADV_DEVICE_SIG_PREFIX, WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX } from '../Defaults
|
|
5
|
-
import { getBinaryNodeChild, jidDecode, S_WHATSAPP_NET } from '../WABinary
|
|
6
|
-
import { Curve, hmacSign } from './crypto
|
|
7
|
-
import { encodeBigEndian } from './generics
|
|
8
|
-
import { createSignalIdentity } from './signal
|
|
4
|
+
import { KEY_BUNDLE_TYPE, WA_ADV_ACCOUNT_SIG_PREFIX, WA_ADV_DEVICE_SIG_PREFIX, WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX } from '../Defaults';
|
|
5
|
+
import { getBinaryNodeChild, jidDecode, S_WHATSAPP_NET } from '../WABinary';
|
|
6
|
+
import { Curve, hmacSign } from './crypto';
|
|
7
|
+
import { encodeBigEndian } from './generics';
|
|
8
|
+
import { createSignalIdentity } from './signal';
|
|
9
9
|
const getUserAgent = (config) => {
|
|
10
10
|
return {
|
|
11
11
|
appVersion: {
|
package/lib/WABinary/decode.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { BinaryNode, BinaryNodeCodingOptions } from './types
|
|
2
|
-
export declare const decompressingIfRequired: (buffer: Buffer) => Promise<Buffer
|
|
1
|
+
import type { BinaryNode, BinaryNodeCodingOptions } from './types';
|
|
2
|
+
export declare const decompressingIfRequired: (buffer: Buffer) => Promise<Buffer>;
|
|
3
3
|
export declare const decodeDecompressedBinaryNode: (buffer: Buffer, opts: Pick<BinaryNodeCodingOptions, "DOUBLE_BYTE_TOKENS" | "SINGLE_BYTE_TOKENS" | "TAGS">, indexRef?: {
|
|
4
4
|
index: number;
|
|
5
5
|
}) => BinaryNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../src/WABinary/decode.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAA;AAIlE,eAAO,MAAM,uBAAuB,GAAU,QAAQ,MAAM,
|
|
1
|
+
{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../src/WABinary/decode.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAA;AAIlE,eAAO,MAAM,uBAAuB,GAAU,QAAQ,MAAM,oBAS3D,CAAA;AAED,eAAO,MAAM,4BAA4B,GACxC,QAAQ,MAAM,EACd,MAAM,IAAI,CAAC,uBAAuB,EAAE,oBAAoB,GAAG,oBAAoB,GAAG,MAAM,CAAC,EACzF,WAAU;IAAE,KAAK,EAAE,MAAM,CAAA;CAAiB,KACxC,UAuRF,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAU,MAAM,MAAM,KAAG,OAAO,CAAC,UAAU,CAGvE,CAAA"}
|
package/lib/WABinary/decode.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { promisify } from 'util';
|
|
2
2
|
import { inflate } from 'zlib';
|
|
3
|
-
import * as constants from './constants
|
|
4
|
-
import { jidEncode, WAJIDDomains } from './jid-utils
|
|
3
|
+
import * as constants from './constants';
|
|
4
|
+
import { jidEncode, WAJIDDomains } from './jid-utils';
|
|
5
5
|
const inflatePromise = promisify(inflate);
|
|
6
6
|
export const decompressingIfRequired = async (buffer) => {
|
|
7
7
|
if (2 & buffer.readUInt8()) {
|
package/lib/WABinary/encode.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { BinaryNode, BinaryNodeCodingOptions } from './types
|
|
1
|
+
import type { BinaryNode, BinaryNodeCodingOptions } from './types';
|
|
2
2
|
export declare const encodeBinaryNode: (node: BinaryNode, opts?: Pick<BinaryNodeCodingOptions, "TAGS" | "TOKEN_MAP">, buffer?: number[]) => Buffer;
|
|
3
3
|
//# sourceMappingURL=encode.d.ts.map
|
package/lib/WABinary/encode.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as constants from './constants
|
|
2
|
-
import { jidDecode } from './jid-utils
|
|
1
|
+
import * as constants from './constants';
|
|
2
|
+
import { jidDecode } from './jid-utils';
|
|
3
3
|
export const encodeBinaryNode = (node, opts = constants, buffer = [0]) => {
|
|
4
4
|
const encoded = encodeBinaryNodeInner(node, opts, buffer);
|
|
5
5
|
return Buffer.from(encoded);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { proto } from '../../WAProto/index.js';
|
|
2
|
-
import { type BinaryNode } from './types
|
|
2
|
+
import { type BinaryNode } from './types';
|
|
3
3
|
export declare const getBinaryNodeChildren: (node: BinaryNode | undefined, childTag: string) => BinaryNode[];
|
|
4
4
|
export declare const getBinaryNodeChild: (node: BinaryNode | undefined, childTag: string) => BinaryNode | undefined;
|
|
5
5
|
export declare const getAllBinaryNodeChildren: ({ content }: BinaryNode) => BinaryNode[];
|
|
6
|
-
export declare const getBinaryNodeChildBuffer: (node: BinaryNode | undefined, childTag: string) => Uint8Array<ArrayBufferLike> |
|
|
7
|
-
export declare const getBinaryNodeChildString: (node: BinaryNode | undefined, childTag: string) =>
|
|
6
|
+
export declare const getBinaryNodeChildBuffer: (node: BinaryNode | undefined, childTag: string) => string | Uint8Array<ArrayBufferLike> | BinaryNode[] | undefined;
|
|
7
|
+
export declare const getBinaryNodeChildString: (node: BinaryNode | undefined, childTag: string) => any;
|
|
8
8
|
export declare const getBinaryNodeChildUInt: (node: BinaryNode, childTag: string, length: number) => number | undefined;
|
|
9
9
|
export declare const assertNodeErrorFree: (node: BinaryNode) => void;
|
|
10
10
|
export declare const reduceBinaryNodeToDictionary: (node: BinaryNode, tag: string) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generic-utils.d.ts","sourceRoot":"","sources":["../../src/WABinary/generic-utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAC9C,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAA;AAMzC,eAAO,MAAM,qBAAqB,GAAI,MAAM,UAAU,GAAG,SAAS,EAAE,UAAU,MAAM,iBAoBnF,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,MAAM,UAAU,GAAG,SAAS,EAAE,UAAU,MAAM,2BAEhF,CAAA;AAED,eAAO,MAAM,wBAAwB,GAAI,aAAa,UAAU,iBAM/D,CAAA;AAED,eAAO,MAAM,wBAAwB,GAAI,MAAM,UAAU,GAAG,SAAS,EAAE,UAAU,MAAM,
|
|
1
|
+
{"version":3,"file":"generic-utils.d.ts","sourceRoot":"","sources":["../../src/WABinary/generic-utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAC9C,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAA;AAMzC,eAAO,MAAM,qBAAqB,GAAI,MAAM,UAAU,GAAG,SAAS,EAAE,UAAU,MAAM,iBAoBnF,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,MAAM,UAAU,GAAG,SAAS,EAAE,UAAU,MAAM,2BAEhF,CAAA;AAED,eAAO,MAAM,wBAAwB,GAAI,aAAa,UAAU,iBAM/D,CAAA;AAED,eAAO,MAAM,wBAAwB,GAAI,MAAM,UAAU,GAAG,SAAS,EAAE,UAAU,MAAM,oEAKtF,CAAA;AAED,eAAO,MAAM,wBAAwB,GAAI,MAAM,UAAU,GAAG,SAAS,EAAE,UAAU,MAAM,QAOtF,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,MAAM,UAAU,EAAE,UAAU,MAAM,EAAE,QAAQ,MAAM,uBAKxF,CAAA;AAED,eAAO,MAAM,mBAAmB,GAAI,MAAM,UAAU,SAKnD,CAAA;AAED,eAAO,MAAM,4BAA4B,GAAI,MAAM,UAAU,EAAE,KAAK,MAAM;;CAezE,CAAA;AAED,eAAO,MAAM,qBAAqB,GAAI,aAAa,UAAU,2BAW5D,CAAA;AAaD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC,SAAI,GAAG,MAAM,CA2B1F;AAGD,0EAA0E;AAC1E,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAM/D,CAAA;AAEF,8EAA8E;AAC9E,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAOrD,CAAA;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO,MAAM,KAAG,UAAU,EA4C3D,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GAAI,OAAO,OAAO,KAAG,UAAU,EAyCnE,CAAA;AAED,mFAAmF;AACnF,eAAO,MAAM,gBAAgB,GAAI,SAAS,OAAO,KAAG,UAAU,GAAG,SAAiD,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Boom } from '@hapi/boom';
|
|
2
2
|
import { proto } from '../../WAProto/index.js';
|
|
3
|
-
import {} from './types
|
|
3
|
+
import {} from './types';
|
|
4
4
|
// some extra useful utilities
|
|
5
5
|
const indexCache = new WeakMap();
|
|
6
6
|
export const getBinaryNodeChildren = (node, childTag) => {
|
package/lib/WABinary/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './encode
|
|
2
|
-
export * from './decode
|
|
3
|
-
export * from './generic-utils
|
|
4
|
-
export * from './jid-utils
|
|
5
|
-
export * from './types
|
|
1
|
+
export * from './encode';
|
|
2
|
+
export * from './decode';
|
|
3
|
+
export * from './generic-utils';
|
|
4
|
+
export * from './jid-utils';
|
|
5
|
+
export * from './types';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/WABinary/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './encode
|
|
2
|
-
export * from './decode
|
|
3
|
-
export * from './generic-utils
|
|
4
|
-
export * from './jid-utils
|
|
5
|
-
export * from './types
|
|
1
|
+
export * from './encode';
|
|
2
|
+
export * from './decode';
|
|
3
|
+
export * from './generic-utils';
|
|
4
|
+
export * from './jid-utils';
|
|
5
|
+
export * from './types';
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
package/lib/WABinary/types.d.ts
CHANGED
package/lib/WABinary/types.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import * as constants from './constants
|
|
1
|
+
import * as constants from './constants';
|
|
2
2
|
//# sourceMappingURL=types.js.map
|
package/lib/WAM/BinaryInfo.d.ts
CHANGED
package/lib/WAM/encode.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { BinaryInfo } from './BinaryInfo
|
|
2
|
-
export declare const encodeWAM: (binaryInfo: BinaryInfo) =>
|
|
1
|
+
import { BinaryInfo } from './BinaryInfo';
|
|
2
|
+
export declare const encodeWAM: (binaryInfo: BinaryInfo) => any;
|
|
3
3
|
//# sourceMappingURL=encode.d.ts.map
|
package/lib/WAM/encode.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../../src/WAM/encode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAczC,eAAO,MAAM,SAAS,GAAI,YAAY,UAAU,
|
|
1
|
+
{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../../src/WAM/encode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAczC,eAAO,MAAM,SAAS,GAAI,YAAY,UAAU,QAe/C,CAAA"}
|
package/lib/WAM/encode.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BinaryInfo } from './BinaryInfo
|
|
2
|
-
import { FLAG_BYTE, FLAG_EVENT, FLAG_EXTENDED, FLAG_FIELD, FLAG_GLOBAL, WEB_EVENTS, WEB_GLOBALS } from './constants
|
|
1
|
+
import { BinaryInfo } from './BinaryInfo';
|
|
2
|
+
import { FLAG_BYTE, FLAG_EVENT, FLAG_EXTENDED, FLAG_FIELD, FLAG_GLOBAL, WEB_EVENTS, WEB_GLOBALS } from './constants';
|
|
3
3
|
const getHeaderBitLength = (key) => (key < 256 ? 2 : 3);
|
|
4
4
|
export const encodeWAM = (binaryInfo) => {
|
|
5
5
|
binaryInfo.buffer = [];
|
package/lib/WAM/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './constants
|
|
2
|
-
export * from './encode
|
|
3
|
-
export * from './BinaryInfo
|
|
1
|
+
export * from './constants';
|
|
2
|
+
export * from './encode';
|
|
3
|
+
export * from './BinaryInfo';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/WAM/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './constants
|
|
2
|
-
export * from './encode
|
|
3
|
-
export * from './BinaryInfo
|
|
1
|
+
export * from './constants';
|
|
2
|
+
export * from './encode';
|
|
3
|
+
export * from './BinaryInfo';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { USyncQueryProtocol } from '../../Types/USync
|
|
2
|
-
import { type BinaryNode } from '../../WABinary
|
|
3
|
-
import { USyncUser } from '../USyncUser
|
|
1
|
+
import type { USyncQueryProtocol } from '../../Types/USync';
|
|
2
|
+
import { type BinaryNode } from '../../WABinary';
|
|
3
|
+
import { USyncUser } from '../USyncUser';
|
|
4
4
|
export declare class USyncContactProtocol implements USyncQueryProtocol {
|
|
5
5
|
name: string;
|
|
6
6
|
getQueryElement(): BinaryNode;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { assertNodeErrorFree } from '../../WABinary
|
|
2
|
-
import { USyncUser } from '../USyncUser
|
|
1
|
+
import { assertNodeErrorFree } from '../../WABinary';
|
|
2
|
+
import { USyncUser } from '../USyncUser';
|
|
3
3
|
export class USyncContactProtocol {
|
|
4
4
|
constructor() {
|
|
5
5
|
this.name = 'contact';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { USyncQueryProtocol } from '../../Types/USync
|
|
2
|
-
import { type BinaryNode } from '../../WABinary
|
|
1
|
+
import type { USyncQueryProtocol } from '../../Types/USync';
|
|
2
|
+
import { type BinaryNode } from '../../WABinary';
|
|
3
3
|
export type KeyIndexData = {
|
|
4
4
|
timestamp: number;
|
|
5
5
|
signedKeyIndex?: Uint8Array;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { USyncQueryProtocol } from '../../Types/USync
|
|
2
|
-
import { type BinaryNode } from '../../WABinary
|
|
1
|
+
import type { USyncQueryProtocol } from '../../Types/USync';
|
|
2
|
+
import { type BinaryNode } from '../../WABinary';
|
|
3
3
|
export type DisappearingModeData = {
|
|
4
4
|
duration: number;
|
|
5
5
|
setAt?: Date;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { USyncQueryProtocol } from '../../Types/USync
|
|
2
|
-
import { type BinaryNode } from '../../WABinary
|
|
1
|
+
import type { USyncQueryProtocol } from '../../Types/USync';
|
|
2
|
+
import { type BinaryNode } from '../../WABinary';
|
|
3
3
|
export type StatusData = {
|
|
4
4
|
status?: string | null;
|
|
5
5
|
setAt?: Date;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { USyncQueryProtocol } from '../../Types/USync
|
|
2
|
-
import { type BinaryNode } from '../../WABinary
|
|
3
|
-
import { USyncUser } from '../USyncUser
|
|
1
|
+
import type { USyncQueryProtocol } from '../../Types/USync';
|
|
2
|
+
import { type BinaryNode } from '../../WABinary';
|
|
3
|
+
import { USyncUser } from '../USyncUser';
|
|
4
4
|
export declare class USyncUsernameProtocol implements USyncQueryProtocol {
|
|
5
5
|
name: string;
|
|
6
6
|
getQueryElement(): BinaryNode;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { assertNodeErrorFree } from '../../WABinary
|
|
2
|
-
import { USyncUser } from '../USyncUser
|
|
1
|
+
import { assertNodeErrorFree } from '../../WABinary';
|
|
2
|
+
import { USyncUser } from '../USyncUser';
|
|
3
3
|
export class USyncUsernameProtocol {
|
|
4
4
|
constructor() {
|
|
5
5
|
this.name = 'username';
|