@nerxa/socketon 0.0.0-stage → 1.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/EXPERIMENTAL.md +350 -0
- package/LICENSE +24 -0
- package/README.md +6317 -2
- package/WAProto/index.d.ts +17301 -0
- package/WAProto/index.js +125088 -0
- package/engine-requirements.js +14 -0
- package/package.json +125 -4
- package/src/Defaults/index.d.ts +152 -0
- package/src/Defaults/index.js +164 -0
- package/src/MessageBuilder/bot-signature.d.ts +22 -0
- package/src/MessageBuilder/bot-signature.js +122 -0
- package/src/MessageBuilder/extras.d.ts +449 -0
- package/src/MessageBuilder/extras.js +1356 -0
- package/src/MessageBuilder/index.d.ts +210 -0
- package/src/MessageBuilder/index.js +3594 -0
- package/src/MessageBuilder/metaai.d.ts +438 -0
- package/src/MessageBuilder/metaai.js +890 -0
- package/src/Signal/Group/ciphertext-message.d.ts +9 -0
- package/src/Signal/Group/ciphertext-message.js +11 -0
- package/src/Signal/Group/group-session-builder.d.ts +7 -0
- package/src/Signal/Group/group-session-builder.js +27 -0
- package/src/Signal/Group/group_cipher.d.ts +11 -0
- package/src/Signal/Group/group_cipher.js +78 -0
- package/src/Signal/Group/index.d.ts +11 -0
- package/src/Signal/Group/index.js +11 -0
- package/src/Signal/Group/keyhelper.d.ts +6 -0
- package/src/Signal/Group/keyhelper.js +17 -0
- package/src/Signal/Group/sender-chain-key.d.ts +13 -0
- package/src/Signal/Group/sender-chain-key.js +25 -0
- package/src/Signal/Group/sender-key-distribution-message.d.ts +16 -0
- package/src/Signal/Group/sender-key-distribution-message.js +62 -0
- package/src/Signal/Group/sender-key-message.d.ts +18 -0
- package/src/Signal/Group/sender-key-message.js +65 -0
- package/src/Signal/Group/sender-key-name.d.ts +11 -0
- package/src/Signal/Group/sender-key-name.js +47 -0
- package/src/Signal/Group/sender-key-record.d.ts +12 -0
- package/src/Signal/Group/sender-key-record.js +40 -0
- package/src/Signal/Group/sender-key-state.d.ts +16 -0
- package/src/Signal/Group/sender-key-state.js +83 -0
- package/src/Signal/Group/sender-message-key.d.ts +11 -0
- package/src/Signal/Group/sender-message-key.js +25 -0
- package/src/Signal/libsignal.d.ts +54 -0
- package/src/Signal/libsignal.js +427 -0
- package/src/Signal/lid-mapping.d.ts +20 -0
- package/src/Signal/lid-mapping.js +274 -0
- package/src/Socket/Client/index.d.ts +2 -0
- package/src/Socket/Client/index.js +3 -0
- package/src/Socket/Client/tcp.js +177 -0
- package/src/Socket/Client/types.d.ts +5 -0
- package/src/Socket/Client/types.js +9 -0
- package/src/Socket/Client/websocket.d.ts +12 -0
- package/src/Socket/Client/websocket.js +53 -0
- package/src/Socket/business.d.ts +431 -0
- package/src/Socket/business.js +379 -0
- package/src/Socket/chats.d.ts +247 -0
- package/src/Socket/chats.js +1484 -0
- package/src/Socket/communities.d.ts +598 -0
- package/src/Socket/communities.js +421 -0
- package/src/Socket/email.js +145 -0
- package/src/Socket/groups.d.ts +298 -0
- package/src/Socket/groups.js +339 -0
- package/src/Socket/index.d.ts +581 -0
- package/src/Socket/index.js +77 -0
- package/src/Socket/messages-recv.d.ts +370 -0
- package/src/Socket/messages-recv.js +1864 -0
- package/src/Socket/messages-send.d.ts +390 -0
- package/src/Socket/messages-send.js +1574 -0
- package/src/Socket/mex.d.ts +1 -0
- package/src/Socket/mex.js +44 -0
- package/src/Socket/mobile-builders.js +72 -0
- package/src/Socket/mobile.js +424 -0
- package/src/Socket/newsletter.d.ts +468 -0
- package/src/Socket/newsletter.js +671 -0
- package/src/Socket/socket.d.ts +77 -0
- package/src/Socket/socket.js +1106 -0
- package/src/Store/index.d.ts +3 -0
- package/src/Store/index.js +3 -0
- package/src/Store/make-in-memory-store.d.ts +62 -0
- package/src/Store/make-in-memory-store.js +396 -0
- package/src/Store/make-ordered-dictionary.d.ts +12 -0
- package/src/Store/make-ordered-dictionary.js +78 -0
- package/src/Store/object-repository.d.ts +10 -0
- package/src/Store/object-repository.js +23 -0
- package/src/Types/Auth.d.ts +1 -0
- package/src/Types/Auth.js +1 -0
- package/src/Types/Bussines.d.ts +1 -0
- package/src/Types/Bussines.js +1 -0
- package/src/Types/Call.d.ts +1 -0
- package/src/Types/Call.js +1 -0
- package/src/Types/Chat.d.ts +2 -0
- package/src/Types/Chat.js +24 -0
- package/src/Types/Contact.d.ts +1 -0
- package/src/Types/Contact.js +1 -0
- package/src/Types/Events.d.ts +1 -0
- package/src/Types/Events.js +0 -0
- package/src/Types/GroupMetadata.d.ts +5 -0
- package/src/Types/GroupMetadata.js +6 -0
- package/src/Types/Label.d.ts +2 -0
- package/src/Types/Label.js +24 -0
- package/src/Types/LabelAssociation.d.ts +2 -0
- package/src/Types/LabelAssociation.js +6 -0
- package/src/Types/Message.d.ts +13 -0
- package/src/Types/Message.js +23 -0
- package/src/Types/Mex.d.ts +2 -0
- package/src/Types/Mex.js +95 -0
- package/src/Types/Product.d.ts +1 -0
- package/src/Types/Product.js +1 -0
- package/src/Types/Signal.d.ts +1 -0
- package/src/Types/Signal.js +0 -0
- package/src/Types/Socket.d.ts +1 -0
- package/src/Types/Socket.js +0 -0
- package/src/Types/State.d.ts +5 -0
- package/src/Types/State.js +54 -0
- package/src/Types/USync.d.ts +1 -0
- package/src/Types/USync.js +0 -0
- package/src/Types/index.d.ts +13 -0
- package/src/Types/index.js +25 -0
- package/src/Utils/auth-store.d.ts +29 -0
- package/src/Utils/auth-store.js +76 -0
- package/src/Utils/auth-utils.d.ts +58 -0
- package/src/Utils/auth-utils.js +273 -0
- package/src/Utils/browser-utils.d.ts +9 -0
- package/src/Utils/browser-utils.js +28 -0
- package/src/Utils/business.d.ts +49 -0
- package/src/Utils/business.js +226 -0
- package/src/Utils/chat-utils.d.ts +408 -0
- package/src/Utils/chat-utils.js +846 -0
- package/src/Utils/companion-reg-client-utils.d.ts +4 -0
- package/src/Utils/companion-reg-client-utils.js +39 -0
- package/src/Utils/crypto.d.ts +39 -0
- package/src/Utils/crypto.js +110 -0
- package/src/Utils/decode-wa-message.d.ts +99 -0
- package/src/Utils/decode-wa-message.js +373 -0
- package/src/Utils/event-buffer.d.ts +22 -0
- package/src/Utils/event-buffer.js +624 -0
- package/src/Utils/generics.d.ts +63 -0
- package/src/Utils/generics.js +375 -0
- package/src/Utils/group-metadata-cache.d.ts +4 -0
- package/src/Utils/group-metadata-cache.js +25 -0
- package/src/Utils/history.d.ts +75 -0
- package/src/Utils/history.js +131 -0
- package/src/Utils/html-app.d.ts +19 -0
- package/src/Utils/html-app.js +96 -0
- package/src/Utils/html-multiplayer.d.ts +10 -0
- package/src/Utils/html-multiplayer.js +94 -0
- package/src/Utils/identity-change-handler.d.ts +13 -0
- package/src/Utils/identity-change-handler.js +48 -0
- package/src/Utils/index.d.ts +44 -0
- package/src/Utils/index.js +44 -0
- package/src/Utils/link-preview-metadata.d.ts +47 -0
- package/src/Utils/link-preview-metadata.js +88 -0
- package/src/Utils/link-preview.d.ts +12 -0
- package/src/Utils/link-preview.js +79 -0
- package/src/Utils/logger.d.ts +2 -0
- package/src/Utils/logger.js +2 -0
- package/src/Utils/lt-hash.d.ts +6 -0
- package/src/Utils/lt-hash.js +3 -0
- package/src/Utils/make-mutex.d.ts +6 -0
- package/src/Utils/make-mutex.js +32 -0
- package/src/Utils/message-retry-manager.d.ts +79 -0
- package/src/Utils/message-retry-manager.js +255 -0
- package/src/Utils/messages-media.d.ts +136 -0
- package/src/Utils/messages-media.js +814 -0
- package/src/Utils/messages.d.ts +62 -0
- package/src/Utils/messages.js +2223 -0
- package/src/Utils/mobile-companion-crypto.js +191 -0
- package/src/Utils/modern-messages.d.ts +150 -0
- package/src/Utils/modern-messages.js +496 -0
- package/src/Utils/native-flow.d.ts +11 -0
- package/src/Utils/native-flow.js +115 -0
- package/src/Utils/newsletter-status.d.ts +158 -0
- package/src/Utils/newsletter-status.js +651 -0
- package/src/Utils/noise-handler.d.ts +20 -0
- package/src/Utils/noise-handler.js +200 -0
- package/src/Utils/offline-node-processor.d.ts +9 -0
- package/src/Utils/offline-node-processor.js +33 -0
- package/src/Utils/optional-media.d.ts +3 -0
- package/src/Utils/optional-media.js +45 -0
- package/src/Utils/payment-messages.d.ts +66 -0
- package/src/Utils/payment-messages.js +160 -0
- package/src/Utils/pre-key-manager.d.ts +25 -0
- package/src/Utils/pre-key-manager.js +95 -0
- package/src/Utils/process-message.d.ts +60 -0
- package/src/Utils/process-message.js +688 -0
- package/src/Utils/reporting-utils.d.ts +12 -0
- package/src/Utils/reporting-utils.js +256 -0
- package/src/Utils/scheduled-message.d.ts +51 -0
- package/src/Utils/scheduled-message.js +112 -0
- package/src/Utils/sender-key-memory.d.ts +19 -0
- package/src/Utils/sender-key-memory.js +51 -0
- package/src/Utils/signal.d.ts +82 -0
- package/src/Utils/signal.js +193 -0
- package/src/Utils/stanza-ack.d.ts +16 -0
- package/src/Utils/stanza-ack.js +30 -0
- package/src/Utils/status-stickers.d.ts +127 -0
- package/src/Utils/status-stickers.js +260 -0
- package/src/Utils/sync-action-utils.d.ts +2 -0
- package/src/Utils/sync-action-utils.js +44 -0
- package/src/Utils/tc-token-utils.d.ts +29 -0
- package/src/Utils/tc-token-utils.js +155 -0
- package/src/Utils/ttl-cache.d.ts +28 -0
- package/src/Utils/ttl-cache.js +120 -0
- package/src/Utils/use-mongo-auth-state.d.ts +21 -0
- package/src/Utils/use-mongo-auth-state.js +67 -0
- package/src/Utils/use-multi-file-auth-state.d.ts +11 -0
- package/src/Utils/use-multi-file-auth-state.js +106 -0
- package/src/Utils/use-mysql-auth-state.d.ts +19 -0
- package/src/Utils/use-mysql-auth-state.js +79 -0
- package/src/Utils/use-postgres-auth-state.d.ts +19 -0
- package/src/Utils/use-postgres-auth-state.js +79 -0
- package/src/Utils/use-redis-auth-state.d.ts +19 -0
- package/src/Utils/use-redis-auth-state.js +89 -0
- package/src/Utils/use-single-file-auth-state.d.ts +10 -0
- package/src/Utils/use-single-file-auth-state.js +108 -0
- package/src/Utils/use-sqlite-auth-state.d.ts +12 -0
- package/src/Utils/use-sqlite-auth-state.js +120 -0
- package/src/Utils/useNekoDBAuth.d.ts +19 -0
- package/src/Utils/useNekoDBAuth.js +111 -0
- package/src/Utils/username.d.ts +12 -0
- package/src/Utils/username.js +58 -0
- package/src/Utils/validate-connection.d.ts +43 -0
- package/src/Utils/validate-connection.js +277 -0
- package/src/Utils/voice-recognition.d.ts +53 -0
- package/src/Utils/voice-recognition.js +219 -0
- package/src/Voip/audio-feeder.d.ts +24 -0
- package/src/Voip/audio-feeder.js +268 -0
- package/src/Voip/index.d.ts +88 -0
- package/src/Voip/index.js +936 -0
- package/src/Voip/relay-transport.d.ts +5 -0
- package/src/Voip/relay-transport.js +824 -0
- package/src/Voip/signaling.d.ts +11 -0
- package/src/Voip/signaling.js +1099 -0
- package/src/Voip/types.d.ts +2 -0
- package/src/Voip/types.js +12 -0
- package/src/Voip/video-feeder.d.ts +24 -0
- package/src/Voip/video-feeder.js +268 -0
- package/src/Voip/wasm-engine.d.ts +26 -0
- package/src/Voip/wasm-engine.js +1307 -0
- package/src/Voip/worker-bootstrap.js +1023 -0
- package/src/WABinary/constants.d.ts +22 -0
- package/src/WABinary/constants.js +1300 -0
- package/src/WABinary/decode.d.ts +9 -0
- package/src/WABinary/decode.js +261 -0
- package/src/WABinary/encode.d.ts +2 -0
- package/src/WABinary/encode.js +219 -0
- package/src/WABinary/generic-utils.d.ts +76 -0
- package/src/WABinary/generic-utils.js +214 -0
- package/src/WABinary/index.d.ts +5 -0
- package/src/WABinary/index.js +5 -0
- package/src/WABinary/jid-utils.d.ts +30 -0
- package/src/WABinary/jid-utils.js +97 -0
- package/src/WABinary/types.d.ts +1 -0
- package/src/WABinary/types.js +0 -0
- package/src/WAM/BinaryInfo.d.ts +7 -0
- package/src/WAM/BinaryInfo.js +9 -0
- package/src/WAM/constants.d.ts +34926 -0
- package/src/WAM/constants.js +22852 -0
- package/src/WAM/encode.d.ts +1 -0
- package/src/WAM/encode.js +148 -0
- package/src/WAM/index.d.ts +3 -0
- package/src/WAM/index.js +3 -0
- package/src/WAUSync/Protocols/USyncContactProtocol.d.ts +36 -0
- package/src/WAUSync/Protocols/USyncContactProtocol.js +50 -0
- package/src/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -0
- package/src/WAUSync/Protocols/USyncDeviceProtocol.js +51 -0
- package/src/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
- package/src/WAUSync/Protocols/USyncDisappearingModeProtocol.js +26 -0
- package/src/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
- package/src/WAUSync/Protocols/USyncStatusProtocol.js +37 -0
- package/src/WAUSync/Protocols/USyncUsernameProtocol.d.ts +9 -0
- package/src/WAUSync/Protocols/USyncUsernameProtocol.js +23 -0
- package/src/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +38 -0
- package/src/WAUSync/Protocols/UsyncBotProfileProtocol.js +49 -0
- package/src/WAUSync/Protocols/UsyncLIDProtocol.d.ts +14 -0
- package/src/WAUSync/Protocols/UsyncLIDProtocol.js +28 -0
- package/src/WAUSync/Protocols/index.d.ts +5 -0
- package/src/WAUSync/Protocols/index.js +5 -0
- package/src/WAUSync/USyncQuery.d.ts +20 -0
- package/src/WAUSync/USyncQuery.js +93 -0
- package/src/WAUSync/USyncUser.d.ts +16 -0
- package/src/WAUSync/USyncUser.js +30 -0
- package/src/WAUSync/index.d.ts +3 -0
- package/src/WAUSync/index.js +3 -0
- package/src/assets/wasm/README.md +76 -0
- package/src/assets/wasm/loader.js +5 -0
- package/src/assets/wasm/whatsapp.wasm +0 -0
- package/src/assets/wasm/worker-modules.js +273 -0
- package/src/index.d.ts +43 -0
- package/src/index.js +48 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { getBinaryNodeChild } from '../WABinary/index.js';
|
|
2
|
+
import { USyncBotProfileProtocol } from './Protocols/UsyncBotProfileProtocol.js';
|
|
3
|
+
import { USyncLIDProtocol } from './Protocols/UsyncLIDProtocol.js';
|
|
4
|
+
import { USyncContactProtocol, USyncDeviceProtocol, USyncDisappearingModeProtocol, USyncStatusProtocol, USyncUsernameProtocol } from './Protocols/index.js';
|
|
5
|
+
export class USyncQuery {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.protocols = [];
|
|
8
|
+
this.users = [];
|
|
9
|
+
this.context = 'interactive';
|
|
10
|
+
this.mode = 'query';
|
|
11
|
+
}
|
|
12
|
+
withMode(mode) {
|
|
13
|
+
this.mode = mode;
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
withContext(context) {
|
|
17
|
+
this.context = context;
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
withUser(user) {
|
|
21
|
+
this.users.push(user);
|
|
22
|
+
return this;
|
|
23
|
+
}
|
|
24
|
+
parseUSyncQueryResult(result) {
|
|
25
|
+
if (result?.attrs.type !== 'result') {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const protocolMap = Object.fromEntries(this.protocols.map(protocol => {
|
|
29
|
+
return [protocol.name, protocol.parser];
|
|
30
|
+
}));
|
|
31
|
+
const queryResult = {
|
|
32
|
+
|
|
33
|
+
list: [],
|
|
34
|
+
sideList: []
|
|
35
|
+
};
|
|
36
|
+
const usyncNode = getBinaryNodeChild(result, 'usync');
|
|
37
|
+
|
|
38
|
+
const listNode = usyncNode ? getBinaryNodeChild(usyncNode, 'list') : undefined;
|
|
39
|
+
if (listNode?.content && Array.isArray(listNode.content)) {
|
|
40
|
+
queryResult.list = listNode.content.reduce((acc, node) => {
|
|
41
|
+
const id = node?.attrs.jid;
|
|
42
|
+
if (id) {
|
|
43
|
+
const data = Array.isArray(node?.content)
|
|
44
|
+
? Object.fromEntries(node.content
|
|
45
|
+
.map(content => {
|
|
46
|
+
const protocol = content.tag;
|
|
47
|
+
const parser = protocolMap[protocol];
|
|
48
|
+
if (parser) {
|
|
49
|
+
return [protocol, parser(content)];
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return [protocol, null];
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
.filter(([, b]) => b !== null))
|
|
56
|
+
: {};
|
|
57
|
+
acc.push({ ...data, id });
|
|
58
|
+
}
|
|
59
|
+
return acc;
|
|
60
|
+
}, []);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return queryResult;
|
|
64
|
+
}
|
|
65
|
+
withDeviceProtocol() {
|
|
66
|
+
this.protocols.push(new USyncDeviceProtocol());
|
|
67
|
+
return this;
|
|
68
|
+
}
|
|
69
|
+
withContactProtocol() {
|
|
70
|
+
this.protocols.push(new USyncContactProtocol());
|
|
71
|
+
return this;
|
|
72
|
+
}
|
|
73
|
+
withStatusProtocol() {
|
|
74
|
+
this.protocols.push(new USyncStatusProtocol());
|
|
75
|
+
return this;
|
|
76
|
+
}
|
|
77
|
+
withDisappearingModeProtocol() {
|
|
78
|
+
this.protocols.push(new USyncDisappearingModeProtocol());
|
|
79
|
+
return this;
|
|
80
|
+
}
|
|
81
|
+
withBotProfileProtocol() {
|
|
82
|
+
this.protocols.push(new USyncBotProfileProtocol());
|
|
83
|
+
return this;
|
|
84
|
+
}
|
|
85
|
+
withLIDProtocol() {
|
|
86
|
+
this.protocols.push(new USyncLIDProtocol());
|
|
87
|
+
return this;
|
|
88
|
+
}
|
|
89
|
+
withUsernameProtocol() {
|
|
90
|
+
this.protocols.push(new USyncUsernameProtocol());
|
|
91
|
+
return this;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export class USyncUser {
|
|
2
|
+
withId(id: any): this;
|
|
3
|
+
id: any;
|
|
4
|
+
withLid(lid: any): this;
|
|
5
|
+
lid: any;
|
|
6
|
+
withPhone(phone: any): this;
|
|
7
|
+
phone: any;
|
|
8
|
+
withUsername(username: any): this;
|
|
9
|
+
username: any;
|
|
10
|
+
withUsernameKey(usernameKey: any): this;
|
|
11
|
+
usernameKey: any;
|
|
12
|
+
withType(type: any): this;
|
|
13
|
+
type: any;
|
|
14
|
+
withPersonaId(personaId: any): this;
|
|
15
|
+
personaId: any;
|
|
16
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export class USyncUser {
|
|
2
|
+
withId(id) {
|
|
3
|
+
this.id = id;
|
|
4
|
+
return this;
|
|
5
|
+
}
|
|
6
|
+
withLid(lid) {
|
|
7
|
+
this.lid = lid;
|
|
8
|
+
return this;
|
|
9
|
+
}
|
|
10
|
+
withPhone(phone) {
|
|
11
|
+
this.phone = phone;
|
|
12
|
+
return this;
|
|
13
|
+
}
|
|
14
|
+
withUsername(username) {
|
|
15
|
+
this.username = username;
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
withUsernameKey(usernameKey) {
|
|
19
|
+
this.usernameKey = usernameKey;
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
withType(type) {
|
|
23
|
+
this.type = type;
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
26
|
+
withPersonaId(personaId) {
|
|
27
|
+
this.personaId = personaId;
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# WhatsApp Web VoIP resources
|
|
2
|
+
|
|
3
|
+
These three files are WhatsApp Web's own calling engine, unmodified. They are
|
|
4
|
+
here because `lib/Voip/` runs that engine to place and join calls; nothing in
|
|
5
|
+
this directory was written, generated, minified, packed or encrypted by this
|
|
6
|
+
project.
|
|
7
|
+
|
|
8
|
+
| File | Size | SHA-256 |
|
|
9
|
+
|---|---|---|
|
|
10
|
+
| `whatsapp.wasm` | 9 819 554 B | `5f1350997c0bf3213782a7bdd3c846529d328552bfa7b87f10224f021346ce35` |
|
|
11
|
+
| `loader.js` | 155 436 B | `f26ed41f30313d790b3022476b7e88c6d99941909c30d0a35c15619d98826bad` |
|
|
12
|
+
| `worker-modules.js` | 826 071 B | `4f52cd02c8310a19820176362d292687b02c4a9cf81cc78fbf8e5cc4a28f4e99` |
|
|
13
|
+
|
|
14
|
+
Verify with `npm run verify:assets`, which checks every file against the table
|
|
15
|
+
above and re-runs the scan below. It exits non-zero if a byte changed.
|
|
16
|
+
|
|
17
|
+
## Minified, not obfuscated
|
|
18
|
+
|
|
19
|
+
The two bundles are the output of Meta's production minifier, not a packer.
|
|
20
|
+
The difference is checkable: formatting either file with a JavaScript printer
|
|
21
|
+
is a faithful reprint — the token count comes back identical (26 006 for
|
|
22
|
+
`loader.js`, 134 964 for `worker-modules.js`) and the result is idempotent.
|
|
23
|
+
Packed or encrypted code does not survive that, because there is nothing to
|
|
24
|
+
parse until it unpacks itself at runtime.
|
|
25
|
+
|
|
26
|
+
What formatting does not recover is the identifier names, which the minifier
|
|
27
|
+
discarded at build time:
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
if (i >= a) return ((this.$1 = t), { value: t, done: !0 });
|
|
31
|
+
if (((this.$3 = i + 1), l === n)) return { value: i, done: !1 };
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
That is why these files are vendored as served rather than reformatted. A
|
|
35
|
+
reprint would double their size, still read as machine-generated, and cost the
|
|
36
|
+
one thing that actually settles the question — that the bytes here are the
|
|
37
|
+
bytes WhatsApp Web ships, which anyone can confirm against the checksums.
|
|
38
|
+
|
|
39
|
+
## Why a scanner may flag them
|
|
40
|
+
|
|
41
|
+
`loader.js` and `worker-modules.js` are minified browser bundles, and
|
|
42
|
+
`whatsapp.wasm` is a 9 MB binary, so a supply-chain scanner will call this
|
|
43
|
+
directory obfuscated code plus a large binary blob. That is a description of
|
|
44
|
+
the shape, not a finding. What matters is what the code can reach, and that is
|
|
45
|
+
checkable:
|
|
46
|
+
|
|
47
|
+
- **No dynamic code execution of its own.** Neither bundle contains `eval(` or
|
|
48
|
+
`new Function`. The one `require(` in `worker-modules.js` is
|
|
49
|
+
`window.top.require(...)`, a browser-side Facebook module registry lookup.
|
|
50
|
+
- **No child processes, no `process.env` reads.**
|
|
51
|
+
- **No outbound endpoints.** The only URLs in either file are documentation and
|
|
52
|
+
legal links (`emscripten.org`, `facebook.com/legal/...`).
|
|
53
|
+
- **The WASM cannot reach the network.** Its imports are 216 `env` callbacks
|
|
54
|
+
and 7 `wasi_snapshot_preview1` entries. The two that carry traffic —
|
|
55
|
+
`sendSignalingXMPP_js_sync` and `call_sendto` — are calls *into* JavaScript:
|
|
56
|
+
the module hands bytes to `lib/Voip/signaling.js` and
|
|
57
|
+
`lib/Voip/relay-transport.js`, which send them over the WhatsApp socket the
|
|
58
|
+
bot already authenticated. The module opens no socket itself.
|
|
59
|
+
- The `fetch` and `XMLHttpRequest` occurrences are emscripten's own loader
|
|
60
|
+
paths for fetching a `.wasm` over HTTP in a browser. `lib/Voip/wasm-engine.js`
|
|
61
|
+
hands the bytes over from disk, so those branches never run here.
|
|
62
|
+
|
|
63
|
+
What this project does around them is worth knowing too, because it is what a
|
|
64
|
+
scanner will attribute to the package: `wasm-engine.js` runs the loader inside
|
|
65
|
+
a `node:vm` context with a `worker_threads` pool, and `audio-feeder.js` spawns
|
|
66
|
+
`ffmpeg` to decode outgoing audio. Both are inherent to running a WebRTC engine
|
|
67
|
+
outside a browser.
|
|
68
|
+
|
|
69
|
+
## Refreshing them
|
|
70
|
+
|
|
71
|
+
They come from a logged-in WhatsApp Web session:
|
|
72
|
+
`WAWebVoipWebWasmWorkerResource` names the worker bundle URL, and the WASM sits
|
|
73
|
+
behind a `bx` resource id that only resolves once the page has booted, so the
|
|
74
|
+
fetch needs a real browser rather than a plain HTTP request. Replace all three
|
|
75
|
+
together — a `loader.js` from one release and a `worker-modules.js` from
|
|
76
|
+
another will not agree on bindings — and update the table above.
|