ruby-baileys 0.0.0-stage → 1.5.17
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 +23 -0
- package/NOTICE.md +14 -0
- package/README.md +6265 -2
- package/WAProto/GenerateStatics.sh +3 -0
- package/WAProto/WAProto.proto +5479 -0
- package/WAProto/fix-imports.js +81 -0
- package/WAProto/index.d.ts +16877 -0
- package/WAProto/index.js +122159 -0
- package/assets/ruby_aspirant.jpg +0 -0
- package/assets/ruby_aspirant_4k.jpg +88 -0
- package/assets/ruby_aspirant_full.jpg +0 -0
- package/assets/ruby_aspirant_render.png +1 -0
- package/assets/ruby_aspirants_hd.jpg +0 -0
- package/assets/thumb.jpg +0 -0
- package/engine-requirements.js +14 -0
- package/index.cjs +29 -0
- package/index.d.ts +2 -0
- package/package.json +178 -4
- package/src/Defaults/index.d.ts +153 -0
- package/src/Defaults/index.js +165 -0
- package/src/MessageBuilder/bot-signature.d.ts +22 -0
- package/src/MessageBuilder/bot-signature.js +123 -0
- package/src/MessageBuilder/extras.d.ts +396 -0
- package/src/MessageBuilder/extras.js +1229 -0
- package/src/MessageBuilder/index.d.ts +210 -0
- package/src/MessageBuilder/index.js +3521 -0
- package/src/MessageBuilder/metaai.d.ts +438 -0
- package/src/MessageBuilder/metaai.js +891 -0
- package/src/Signal/Group/ciphertext-message.d.ts +10 -0
- package/src/Signal/Group/ciphertext-message.js +12 -0
- package/src/Signal/Group/group-session-builder.d.ts +8 -0
- package/src/Signal/Group/group-session-builder.js +28 -0
- package/src/Signal/Group/group_cipher.d.ts +11 -0
- package/src/Signal/Group/group_cipher.js +79 -0
- package/src/Signal/Group/index.d.ts +12 -0
- package/src/Signal/Group/index.js +12 -0
- package/src/Signal/Group/keyhelper.d.ts +7 -0
- package/src/Signal/Group/keyhelper.js +18 -0
- package/src/Signal/Group/sender-chain-key.d.ts +14 -0
- package/src/Signal/Group/sender-chain-key.js +26 -0
- package/src/Signal/Group/sender-key-distribution-message.d.ts +17 -0
- package/src/Signal/Group/sender-key-distribution-message.js +63 -0
- package/src/Signal/Group/sender-key-message.d.ts +19 -0
- package/src/Signal/Group/sender-key-message.js +66 -0
- package/src/Signal/Group/sender-key-name.d.ts +12 -0
- package/src/Signal/Group/sender-key-name.js +48 -0
- package/src/Signal/Group/sender-key-record.d.ts +13 -0
- package/src/Signal/Group/sender-key-record.js +41 -0
- package/src/Signal/Group/sender-key-state.d.ts +17 -0
- package/src/Signal/Group/sender-key-state.js +84 -0
- package/src/Signal/Group/sender-message-key.d.ts +12 -0
- package/src/Signal/Group/sender-message-key.js +26 -0
- package/src/Signal/libsignal.d.ts +55 -0
- package/src/Signal/libsignal.js +429 -0
- package/src/Signal/lid-mapping.d.ts +21 -0
- package/src/Signal/lid-mapping.js +275 -0
- package/src/Socket/Client/index.d.ts +3 -0
- package/src/Socket/Client/index.js +3 -0
- package/src/Socket/Client/types.d.ts +6 -0
- package/src/Socket/Client/types.js +10 -0
- package/src/Socket/Client/websocket.d.ts +13 -0
- package/src/Socket/Client/websocket.js +54 -0
- package/src/Socket/business.d.ts +432 -0
- package/src/Socket/business.js +380 -0
- package/src/Socket/chats.d.ts +248 -0
- package/src/Socket/chats.js +1485 -0
- package/src/Socket/communities.d.ts +599 -0
- package/src/Socket/communities.js +422 -0
- package/src/Socket/groups.d.ts +299 -0
- package/src/Socket/groups.js +340 -0
- package/src/Socket/index.d.ts +582 -0
- package/src/Socket/index.js +48 -0
- package/src/Socket/messages-recv.d.ts +371 -0
- package/src/Socket/messages-recv.js +1803 -0
- package/src/Socket/messages-send.d.ts +391 -0
- package/src/Socket/messages-send.js +1575 -0
- package/src/Socket/mex.d.ts +2 -0
- package/src/Socket/mex.js +45 -0
- package/src/Socket/newsletter.d.ts +469 -0
- package/src/Socket/newsletter.js +643 -0
- package/src/Socket/socket.d.ts +78 -0
- package/src/Socket/socket.js +1088 -0
- package/src/Store/index.d.ts +4 -0
- package/src/Store/index.js +4 -0
- package/src/Store/make-in-memory-store.d.ts +63 -0
- package/src/Store/make-in-memory-store.js +398 -0
- package/src/Store/make-ordered-dictionary.d.ts +13 -0
- package/src/Store/make-ordered-dictionary.js +79 -0
- package/src/Store/object-repository.d.ts +11 -0
- package/src/Store/object-repository.js +24 -0
- package/src/Types/Auth.d.ts +2 -0
- package/src/Types/Auth.js +2 -0
- package/src/Types/Bussines.d.ts +2 -0
- package/src/Types/Bussines.js +2 -0
- package/src/Types/Call.d.ts +2 -0
- package/src/Types/Call.js +2 -0
- package/src/Types/Chat.d.ts +3 -0
- package/src/Types/Chat.js +25 -0
- package/src/Types/Contact.d.ts +2 -0
- package/src/Types/Contact.js +2 -0
- package/src/Types/Events.d.ts +2 -0
- package/src/Types/Events.js +1 -0
- package/src/Types/GroupMetadata.d.ts +6 -0
- package/src/Types/GroupMetadata.js +7 -0
- package/src/Types/Label.d.ts +3 -0
- package/src/Types/Label.js +25 -0
- package/src/Types/LabelAssociation.d.ts +3 -0
- package/src/Types/LabelAssociation.js +7 -0
- package/src/Types/Message.d.ts +14 -0
- package/src/Types/Message.js +24 -0
- package/src/Types/Mex.d.ts +3 -0
- package/src/Types/Mex.js +96 -0
- package/src/Types/Product.d.ts +2 -0
- package/src/Types/Product.js +2 -0
- package/src/Types/Signal.d.ts +2 -0
- package/src/Types/Signal.js +1 -0
- package/src/Types/Socket.d.ts +2 -0
- package/src/Types/Socket.js +1 -0
- package/src/Types/State.d.ts +6 -0
- package/src/Types/State.js +55 -0
- package/src/Types/USync.d.ts +2 -0
- package/src/Types/USync.js +1 -0
- package/src/Types/index.d.ts +14 -0
- package/src/Types/index.js +26 -0
- package/src/Utils/auth-store.d.ts +30 -0
- package/src/Utils/auth-store.js +77 -0
- package/src/Utils/auth-utils.d.ts +59 -0
- package/src/Utils/auth-utils.js +274 -0
- package/src/Utils/browser-utils.d.ts +10 -0
- package/src/Utils/browser-utils.js +29 -0
- package/src/Utils/business.d.ts +50 -0
- package/src/Utils/business.js +227 -0
- package/src/Utils/chat-utils.d.ts +409 -0
- package/src/Utils/chat-utils.js +847 -0
- package/src/Utils/companion-reg-client-utils.d.ts +5 -0
- package/src/Utils/companion-reg-client-utils.js +40 -0
- package/src/Utils/crypto.d.ts +40 -0
- package/src/Utils/crypto.js +111 -0
- package/src/Utils/decode-wa-message.d.ts +100 -0
- package/src/Utils/decode-wa-message.js +374 -0
- package/src/Utils/event-buffer.d.ts +23 -0
- package/src/Utils/event-buffer.js +625 -0
- package/src/Utils/generics.d.ts +64 -0
- package/src/Utils/generics.js +376 -0
- package/src/Utils/group-metadata-cache.d.ts +5 -0
- package/src/Utils/group-metadata-cache.js +26 -0
- package/src/Utils/history.d.ts +76 -0
- package/src/Utils/history.js +132 -0
- package/src/Utils/html-app.d.ts +19 -0
- package/src/Utils/html-app.js +97 -0
- package/src/Utils/html-multiplayer.d.ts +10 -0
- package/src/Utils/html-multiplayer.js +95 -0
- package/src/Utils/identity-change-handler.d.ts +14 -0
- package/src/Utils/identity-change-handler.js +49 -0
- package/src/Utils/index.d.ts +45 -0
- package/src/Utils/index.js +45 -0
- package/src/Utils/link-preview-metadata.d.ts +47 -0
- package/src/Utils/link-preview-metadata.js +89 -0
- package/src/Utils/link-preview.d.ts +13 -0
- package/src/Utils/link-preview.js +80 -0
- package/src/Utils/logger.d.ts +3 -0
- package/src/Utils/logger.js +3 -0
- package/src/Utils/lt-hash.d.ts +7 -0
- package/src/Utils/lt-hash.js +4 -0
- package/src/Utils/make-mutex.d.ts +7 -0
- package/src/Utils/make-mutex.js +33 -0
- package/src/Utils/message-retry-manager.d.ts +80 -0
- package/src/Utils/message-retry-manager.js +256 -0
- package/src/Utils/messages-media.d.ts +137 -0
- package/src/Utils/messages-media.js +815 -0
- package/src/Utils/messages.d.ts +63 -0
- package/src/Utils/messages.js +2149 -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 +116 -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 +21 -0
- package/src/Utils/noise-handler.js +201 -0
- package/src/Utils/offline-node-processor.d.ts +10 -0
- package/src/Utils/offline-node-processor.js +34 -0
- package/src/Utils/optional-media.d.ts +3 -0
- package/src/Utils/optional-media.js +46 -0
- package/src/Utils/payment-messages.d.ts +66 -0
- package/src/Utils/payment-messages.js +161 -0
- package/src/Utils/pre-key-manager.d.ts +26 -0
- package/src/Utils/pre-key-manager.js +96 -0
- package/src/Utils/process-message.d.ts +61 -0
- package/src/Utils/process-message.js +689 -0
- package/src/Utils/reporting-utils.d.ts +13 -0
- package/src/Utils/reporting-utils.js +257 -0
- package/src/Utils/scheduled-message.d.ts +51 -0
- package/src/Utils/scheduled-message.js +113 -0
- package/src/Utils/sender-key-memory.d.ts +20 -0
- package/src/Utils/sender-key-memory.js +52 -0
- package/src/Utils/signal.d.ts +83 -0
- package/src/Utils/signal.js +194 -0
- package/src/Utils/stanza-ack.d.ts +17 -0
- package/src/Utils/stanza-ack.js +31 -0
- package/src/Utils/status-stickers.d.ts +127 -0
- package/src/Utils/status-stickers.js +261 -0
- package/src/Utils/sync-action-utils.d.ts +3 -0
- package/src/Utils/sync-action-utils.js +45 -0
- package/src/Utils/tc-token-utils.d.ts +30 -0
- package/src/Utils/tc-token-utils.js +156 -0
- package/src/Utils/ttl-cache.d.ts +29 -0
- package/src/Utils/ttl-cache.js +121 -0
- package/src/Utils/use-mongo-auth-state.d.ts +22 -0
- package/src/Utils/use-mongo-auth-state.js +68 -0
- package/src/Utils/use-multi-file-auth-state.d.ts +12 -0
- package/src/Utils/use-multi-file-auth-state.js +107 -0
- package/src/Utils/use-mysql-auth-state.d.ts +20 -0
- package/src/Utils/use-mysql-auth-state.js +80 -0
- package/src/Utils/use-postgres-auth-state.d.ts +20 -0
- package/src/Utils/use-postgres-auth-state.js +80 -0
- package/src/Utils/use-redis-auth-state.d.ts +20 -0
- package/src/Utils/use-redis-auth-state.js +90 -0
- package/src/Utils/use-single-file-auth-state.d.ts +11 -0
- package/src/Utils/use-single-file-auth-state.js +109 -0
- package/src/Utils/use-sqlite-auth-state.d.ts +13 -0
- package/src/Utils/use-sqlite-auth-state.js +121 -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 +59 -0
- package/src/Utils/validate-connection.d.ts +44 -0
- package/src/Utils/validate-connection.js +208 -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 +25 -0
- package/src/Voip/audio-feeder.js +269 -0
- package/src/Voip/index.d.ts +89 -0
- package/src/Voip/index.js +937 -0
- package/src/Voip/relay-transport.d.ts +6 -0
- package/src/Voip/relay-transport.js +825 -0
- package/src/Voip/signaling.d.ts +12 -0
- package/src/Voip/signaling.js +1100 -0
- package/src/Voip/types.d.ts +3 -0
- package/src/Voip/types.js +13 -0
- package/src/Voip/video-feeder.d.ts +25 -0
- package/src/Voip/video-feeder.js +269 -0
- package/src/Voip/wasm-engine.d.ts +27 -0
- package/src/Voip/wasm-engine.js +1308 -0
- package/src/Voip/worker-bootstrap.js +1024 -0
- package/src/WABinary/constants.d.ts +23 -0
- package/src/WABinary/constants.js +1301 -0
- package/src/WABinary/decode.d.ts +10 -0
- package/src/WABinary/decode.js +262 -0
- package/src/WABinary/encode.d.ts +3 -0
- package/src/WABinary/encode.js +220 -0
- package/src/WABinary/generic-utils.d.ts +77 -0
- package/src/WABinary/generic-utils.js +214 -0
- package/src/WABinary/index.d.ts +6 -0
- package/src/WABinary/index.js +6 -0
- package/src/WABinary/jid-utils.d.ts +31 -0
- package/src/WABinary/jid-utils.js +98 -0
- package/src/WABinary/types.d.ts +2 -0
- package/src/WABinary/types.js +1 -0
- package/src/WAM/BinaryInfo.d.ts +8 -0
- package/src/WAM/BinaryInfo.js +10 -0
- package/src/WAM/constants.d.ts +34927 -0
- package/src/WAM/constants.js +22853 -0
- package/src/WAM/encode.d.ts +2 -0
- package/src/WAM/encode.js +149 -0
- package/src/WAM/index.d.ts +4 -0
- package/src/WAM/index.js +4 -0
- package/src/WAUSync/Protocols/USyncContactProtocol.d.ts +37 -0
- package/src/WAUSync/Protocols/USyncContactProtocol.js +51 -0
- package/src/WAUSync/Protocols/USyncDeviceProtocol.d.ts +23 -0
- package/src/WAUSync/Protocols/USyncDeviceProtocol.js +52 -0
- package/src/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +13 -0
- package/src/WAUSync/Protocols/USyncDisappearingModeProtocol.js +27 -0
- package/src/WAUSync/Protocols/USyncStatusProtocol.d.ts +13 -0
- package/src/WAUSync/Protocols/USyncStatusProtocol.js +38 -0
- package/src/WAUSync/Protocols/USyncUsernameProtocol.d.ts +10 -0
- package/src/WAUSync/Protocols/USyncUsernameProtocol.js +24 -0
- package/src/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +39 -0
- package/src/WAUSync/Protocols/UsyncBotProfileProtocol.js +50 -0
- package/src/WAUSync/Protocols/UsyncLIDProtocol.d.ts +15 -0
- package/src/WAUSync/Protocols/UsyncLIDProtocol.js +29 -0
- package/src/WAUSync/Protocols/index.d.ts +6 -0
- package/src/WAUSync/Protocols/index.js +6 -0
- package/src/WAUSync/USyncQuery.d.ts +21 -0
- package/src/WAUSync/USyncQuery.js +94 -0
- package/src/WAUSync/USyncUser.d.ts +17 -0
- package/src/WAUSync/USyncUser.js +31 -0
- package/src/WAUSync/index.d.ts +4 -0
- package/src/WAUSync/index.js +4 -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 +49 -0
- package/src/index.js +54 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/* Elaina Baileys maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
|
+
import { proto } from '../../WAProto/index.js';
|
|
3
|
+
import { makeLibSignalRepository } from '../Signal/libsignal.js';
|
|
4
|
+
import { Browsers } from '../Utils/browser-utils.js';
|
|
5
|
+
import logger from '../Utils/logger.js';
|
|
6
|
+
const version = [2, 3000, 1049236237];
|
|
7
|
+
export const UNAUTHORIZED_CODES = [401, 403, 419];
|
|
8
|
+
export const BIZ_BOT_SUPPORT_PAYLOAD = '{"version":1,"is_ai_message":true,"should_upload_client_logs":false,"should_show_system_message":false,"ticket_id":"7004947587700716","citation_items":[],"ticket_locale":"us"}';
|
|
9
|
+
export const DEFAULT_ORIGIN = 'https://web.whatsapp.com';
|
|
10
|
+
export const CALL_VIDEO_PREFIX = 'https://call.whatsapp.com/video/';
|
|
11
|
+
export const CALL_AUDIO_PREFIX = 'https://call.whatsapp.com/voice/';
|
|
12
|
+
export const DONATE_URL = 'https://www.npmjs.com/package/@rexxhayanasi/elaina-baileys';
|
|
13
|
+
export const LIBRARY_NAME = 'rexxhayanasi/elaina-baileys';
|
|
14
|
+
export const DEF_CALLBACK_PREFIX = 'CB:';
|
|
15
|
+
export const DEF_TAG_PREFIX = 'TAG:';
|
|
16
|
+
export const PHONE_CONNECTION_CB = 'CB:Pong';
|
|
17
|
+
export const WA_ADV_ACCOUNT_SIG_PREFIX = Buffer.from([6, 0]);
|
|
18
|
+
export const WA_ADV_DEVICE_SIG_PREFIX = Buffer.from([6, 1]);
|
|
19
|
+
export const WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX = Buffer.from([6, 5]);
|
|
20
|
+
export const WA_ADV_HOSTED_DEVICE_SIG_PREFIX = Buffer.from([6, 6]);
|
|
21
|
+
export const WA_DEFAULT_EPHEMERAL = 7 * 24 * 60 * 60;
|
|
22
|
+
|
|
23
|
+
export const STATUS_EXPIRY_SECONDS = 24 * 60 * 60;
|
|
24
|
+
|
|
25
|
+
export const PLACEHOLDER_MAX_AGE_SECONDS = 14 * 24 * 60 * 60;
|
|
26
|
+
export const NOISE_MODE = 'Noise_XX_25519_AESGCM_SHA256\0\0\0\0';
|
|
27
|
+
export const DICT_VERSION = 3;
|
|
28
|
+
export const KEY_BUNDLE_TYPE = Buffer.from([5]);
|
|
29
|
+
export const NOISE_WA_HEADER = Buffer.from([87, 65, 6, DICT_VERSION]);
|
|
30
|
+
|
|
31
|
+
export const URL_REGEX = /https:\/\/(?![^:@\/\s]+:[^:@\/\s]+@)[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}(:\d+)?(\/[^\s]*)?/g;
|
|
32
|
+
export const WA_CERT_DETAILS = {
|
|
33
|
+
SERIAL: 0,
|
|
34
|
+
ISSUER: 'WhatsAppLongTerm1',
|
|
35
|
+
PUBLIC_KEY: Buffer.from('142375574d0a587166aae71ebe516437c4a28b73e3695c6ce1f7f9545da8ee6b', 'hex')
|
|
36
|
+
};
|
|
37
|
+
export const PROCESSABLE_HISTORY_TYPES = [
|
|
38
|
+
proto.HistorySync.HistorySyncType.INITIAL_BOOTSTRAP,
|
|
39
|
+
proto.HistorySync.HistorySyncType.PUSH_NAME,
|
|
40
|
+
proto.HistorySync.HistorySyncType.RECENT,
|
|
41
|
+
proto.HistorySync.HistorySyncType.FULL,
|
|
42
|
+
proto.HistorySync.HistorySyncType.ON_DEMAND,
|
|
43
|
+
proto.HistorySync.HistorySyncType.NON_BLOCKING_DATA,
|
|
44
|
+
proto.HistorySync.HistorySyncType.INITIAL_STATUS_V3
|
|
45
|
+
];
|
|
46
|
+
export const DEFAULT_CACHE_TTLS = {
|
|
47
|
+
SIGNAL_STORE: 5 * 60,
|
|
48
|
+
MSG_RETRY: 60 * 60,
|
|
49
|
+
CALL_OFFER: 5 * 60,
|
|
50
|
+
USER_DEVICES: 5 * 60,
|
|
51
|
+
OUTBOUND_RESEND: 60
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const MAX_OUTBOUND_RESEND_ENTRIES = 512;
|
|
55
|
+
export const MEMBER_LABEL_MAX_LENGTH = 30;
|
|
56
|
+
export const DEFAULT_CACHE_MAX_KEYS = 20000;
|
|
57
|
+
|
|
58
|
+
export const PAIRING_RESPONSE_GRACE_MS = 30000;
|
|
59
|
+
export const DEFAULT_CONNECTION_CONFIG = {
|
|
60
|
+
version: version,
|
|
61
|
+
browser: Browsers.macOS('Chrome'),
|
|
62
|
+
waWebSocketUrl: 'wss://web.whatsapp.com/ws/chat',
|
|
63
|
+
connectTimeoutMs: 20000,
|
|
64
|
+
keepAliveIntervalMs: 15000,
|
|
65
|
+
logger: logger.child({ class: 'elaina' }),
|
|
66
|
+
emitOwnEvents: true,
|
|
67
|
+
AnchorGuard: false,
|
|
68
|
+
AnchorGuardConfig: {},
|
|
69
|
+
defaultQueryTimeoutMs: 60000,
|
|
70
|
+
customUploadHosts: [],
|
|
71
|
+
retryRequestDelayMs: 250,
|
|
72
|
+
maxMsgRetryCount: 3,
|
|
73
|
+
maxEventListeners: 64,
|
|
74
|
+
ackRetryDelayMs: 750,
|
|
75
|
+
maxAckRetryCount: 3,
|
|
76
|
+
maxRetryQueueSize: 64,
|
|
77
|
+
pairingCodeTimeoutMs: 180000,
|
|
78
|
+
fireInitQueries: true,
|
|
79
|
+
auth: undefined,
|
|
80
|
+
markOnlineOnConnect: true,
|
|
81
|
+
syncFullHistory: true,
|
|
82
|
+
patchMessageBeforeSending: msg => msg,
|
|
83
|
+
shouldSyncHistoryMessage: ({ syncType }) => {
|
|
84
|
+
return syncType !== proto.HistorySync.HistorySyncType.FULL;
|
|
85
|
+
},
|
|
86
|
+
shouldIgnoreJid: () => false,
|
|
87
|
+
linkPreviewImageThumbnailWidth: 192,
|
|
88
|
+
transactionOpts: { maxCommitRetries: 10, delayBetweenTriesMs: 3000 },
|
|
89
|
+
generateHighQualityLinkPreview: true,
|
|
90
|
+
enableAutoSessionRecreation: true,
|
|
91
|
+
enableRecentMessageCache: true,
|
|
92
|
+
options: {},
|
|
93
|
+
appStateMacVerification: {
|
|
94
|
+
patch: false,
|
|
95
|
+
snapshot: false
|
|
96
|
+
},
|
|
97
|
+
countryCode: 'US',
|
|
98
|
+
getMessage: async () => undefined,
|
|
99
|
+
cachedGroupMetadata: async () => undefined,
|
|
100
|
+
makeSignalRepository: makeLibSignalRepository
|
|
101
|
+
};
|
|
102
|
+
export const MEDIA_PATH_MAP = {
|
|
103
|
+
image: '/mms/image',
|
|
104
|
+
video: '/mms/video',
|
|
105
|
+
document: '/mms/document',
|
|
106
|
+
audio: '/mms/audio',
|
|
107
|
+
sticker: '/mms/image',
|
|
108
|
+
'sticker-pack': '/mms/sticker-pack',
|
|
109
|
+
'thumbnail-sticker-pack': '/mms/thumbnail-sticker-pack',
|
|
110
|
+
'thumbnail-link': '/mms/image',
|
|
111
|
+
'thumbnail-image': '/mms/image',
|
|
112
|
+
'thumbnail-video': '/mms/video',
|
|
113
|
+
'thumbnail-document': '/mms/document',
|
|
114
|
+
'product-catalog-image': '/product/image',
|
|
115
|
+
'md-app-state': '',
|
|
116
|
+
'md-msg-hist': '/mms/md-app-state',
|
|
117
|
+
'biz-cover-photo': '/pps/biz-cover-photo'
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export const NEWSLETTER_MEDIA_PATH_MAP = {
|
|
121
|
+
image: '/newsletter/newsletter-image',
|
|
122
|
+
video: '/newsletter/newsletter-video',
|
|
123
|
+
document: '/newsletter/newsletter-document',
|
|
124
|
+
audio: '/newsletter/newsletter-audio',
|
|
125
|
+
sticker: '/newsletter/newsletter-image',
|
|
126
|
+
'thumbnail-link': '/newsletter/newsletter-thumbnail-link'
|
|
127
|
+
};
|
|
128
|
+
export const MEDIA_HKDF_KEY_MAPPING = {
|
|
129
|
+
audio: 'Audio',
|
|
130
|
+
document: 'Document',
|
|
131
|
+
gif: 'Video',
|
|
132
|
+
image: 'Image',
|
|
133
|
+
ppic: '',
|
|
134
|
+
product: 'Image',
|
|
135
|
+
ptt: 'Audio',
|
|
136
|
+
'sticker-pack': 'Sticker Pack',
|
|
137
|
+
'thumbnail-sticker-pack': 'Sticker Pack Thumbnail',
|
|
138
|
+
sticker: 'Image',
|
|
139
|
+
video: 'Video',
|
|
140
|
+
'thumbnail-document': 'Document Thumbnail',
|
|
141
|
+
'thumbnail-image': 'Image Thumbnail',
|
|
142
|
+
'thumbnail-video': 'Video Thumbnail',
|
|
143
|
+
'thumbnail-link': 'Link Thumbnail',
|
|
144
|
+
'md-msg-hist': 'History',
|
|
145
|
+
'md-app-state': 'App State',
|
|
146
|
+
'product-catalog-image': 'Product Catalog Image',
|
|
147
|
+
'payment-bg-image': 'Payment Background',
|
|
148
|
+
ptv: 'Video',
|
|
149
|
+
'biz-cover-photo': 'Image',
|
|
150
|
+
location: 'Location',
|
|
151
|
+
contact: 'Contact',
|
|
152
|
+
'voip-token': 'Voip Token'
|
|
153
|
+
};
|
|
154
|
+
export const MEDIA_KEYS = Object.keys(MEDIA_PATH_MAP);
|
|
155
|
+
|
|
156
|
+
export const HISTORY_SYNC_PAUSED_TIMEOUT_MS = 120000;
|
|
157
|
+
export const MIN_PREKEY_COUNT = 5;
|
|
158
|
+
export const INITIAL_PREKEY_COUNT = 812;
|
|
159
|
+
export const UPLOAD_TIMEOUT = 30000;
|
|
160
|
+
export const TimeMs = {
|
|
161
|
+
Minute: 60 * 1000,
|
|
162
|
+
Hour: 60 * 60 * 1000,
|
|
163
|
+
Day: 24 * 60 * 60 * 1000,
|
|
164
|
+
Week: 7 * 24 * 60 * 60 * 1000
|
|
165
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const BOT_SIGNATURE_VERSION: '1';
|
|
2
|
+
export declare const BOT_SIGNATURE_USE_CASE_WA_BOT_MSG: 1;
|
|
3
|
+
export declare const BOT_SIGNATURE_ROOT_VERSION: string;
|
|
4
|
+
export declare const BOT_SIGNATURE_ROOT_CERTIFICATE: string;
|
|
5
|
+
|
|
6
|
+
export declare function loadBotSignatureRoot(): import('crypto').X509Certificate;
|
|
7
|
+
|
|
8
|
+
export declare function constructSignaturePayload(options: {
|
|
9
|
+
botFbid: string;
|
|
10
|
+
messageDigest: Buffer | Uint8Array;
|
|
11
|
+
version?: string;
|
|
12
|
+
}): Buffer;
|
|
13
|
+
|
|
14
|
+
export declare function verifyBotSignature(options: {
|
|
15
|
+
botJid?: string;
|
|
16
|
+
unifiedResponseBytes?: Buffer | Uint8Array;
|
|
17
|
+
proof?: any;
|
|
18
|
+
at?: number;
|
|
19
|
+
root?: import('crypto').X509Certificate;
|
|
20
|
+
}): { status: 'passed' | 'failed'; reason?: string };
|
|
21
|
+
|
|
22
|
+
export declare function isParsableCertificateChain(chain?: unknown): boolean;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/* Elaina Baileys maintained distribution. Upstream notices and license are preserved in LICENSE and NOTICE.md. */
|
|
2
|
+
import { X509Certificate, verify as cryptoVerify } from 'crypto'
|
|
3
|
+
|
|
4
|
+
export const BOT_SIGNATURE_VERSION = '1'
|
|
5
|
+
export const BOT_SIGNATURE_USE_CASE_WA_BOT_MSG = 1
|
|
6
|
+
export const BOT_SIGNATURE_ROOT_VERSION = '2025-10'
|
|
7
|
+
|
|
8
|
+
export const BOT_SIGNATURE_ROOT_CERTIFICATE = `-----BEGIN CERTIFICATE-----
|
|
9
|
+
MIIC7TCCApOgAwIBAgIUAtu5QuxmVhfGT8LPkjfm40mSl0AwCgYIKoZIzj0EAwIw
|
|
10
|
+
dzEgMB4GA1UEAwwXTWV0YSBXQSBGZWF0dXJlIFJvb3QgQ0ExCzAJBgNVBAYTAlVT
|
|
11
|
+
MRMwEQYDVQQIDApDYWxpZm9ybmlhMRMwEQYDVQQHDApNZW5sbyBQYXJrMRwwGgYD
|
|
12
|
+
VQQKDBNNZXRhIFBsYXRmb3JtcyBJbmMuMCAXDTI1MDkwNDE3MzEyNFoYDzIwNjUw
|
|
13
|
+
OTA0MTczMTI0WjB3MSAwHgYDVQQDDBdNZXRhIFdBIEZlYXR1cmUgUm9vdCBDQTEL
|
|
14
|
+
MAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExEzARBgNVBAcMCk1lbmxv
|
|
15
|
+
IFBhcmsxHDAaBgNVBAoME01ldGEgUGxhdGZvcm1zIEluYy4wWTATBgcqhkjOPQIB
|
|
16
|
+
BggqhkjOPQMBBwNCAAT60blw90ebreMkw8+Wpcs0ETAkr1VQjoZoyi7PSSQbsoiP
|
|
17
|
+
qYRnzfRrR+xiahaXbYU83qXiTHjVUiOU9wDxI83qo4H6MIH3MA8GA1UdEwEB/wQF
|
|
18
|
+
MAMBAf8wHQYDVR0OBBYEFNO7KMTVSYUxkL6VS3LyWJw7m76zMIG0BgNVHSMEgaww
|
|
19
|
+
gamAFNO7KMTVSYUxkL6VS3LyWJw7m76zoXukeTB3MSAwHgYDVQQDDBdNZXRhIFdB
|
|
20
|
+
IEZlYXR1cmUgUm9vdCBDQTELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3Ju
|
|
21
|
+
aWExEzARBgNVBAcMCk1lbmxvIFBhcmsxHDAaBgNVBAoME01ldGEgUGxhdGZvcm1z
|
|
22
|
+
IEluYy6CFALbuULsZlYXxk/Cz5I35uNJkpdAMA4GA1UdDwEB/wQEAwIBhjAKBggq
|
|
23
|
+
hkjOPQQDAgNIADBFAiAINhjk9DbP416vx/WjqdUfexgic08aQsxnpDDsNE5M0gIh
|
|
24
|
+
ANorq7KwCQVMtS2or5uKJAQsx1FxCHyDafq2GCk9t0AN
|
|
25
|
+
-----END CERTIFICATE-----`
|
|
26
|
+
|
|
27
|
+
let rootCertificate = null
|
|
28
|
+
|
|
29
|
+
export const loadBotSignatureRoot = () => {
|
|
30
|
+
if (!rootCertificate) {
|
|
31
|
+
rootCertificate = new X509Certificate(BOT_SIGNATURE_ROOT_CERTIFICATE)
|
|
32
|
+
}
|
|
33
|
+
return rootCertificate
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const constructSignaturePayload = ({ botFbid, messageDigest, version = BOT_SIGNATURE_VERSION }) =>
|
|
37
|
+
Buffer.concat([Buffer.from(version, 'utf8'), Buffer.from(String(botFbid), 'utf8'), Buffer.from(messageDigest)])
|
|
38
|
+
|
|
39
|
+
export const isParsableCertificateChain = (chain) => {
|
|
40
|
+
if (!Array.isArray(chain) || !chain.length) {
|
|
41
|
+
return false
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
for (const entry of chain) {
|
|
45
|
+
new X509Certificate(Buffer.from(entry))
|
|
46
|
+
}
|
|
47
|
+
return true
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return false
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const failed = reason => ({ status: 'failed', reason })
|
|
55
|
+
|
|
56
|
+
const validAt = (certificate, at) => {
|
|
57
|
+
const from = Date.parse(certificate.validFrom)
|
|
58
|
+
const to = Date.parse(certificate.validTo)
|
|
59
|
+
return Number.isFinite(from) && Number.isFinite(to) && at >= from && at <= to
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const verifyBotSignature = ({ botJid, unifiedResponseBytes, proof, at = Date.now(), root = loadBotSignatureRoot() } = {}) => {
|
|
63
|
+
if (!proof) {
|
|
64
|
+
return failed('no WA_BOT_MSG proof')
|
|
65
|
+
}
|
|
66
|
+
if (Number(proof.version) !== 1) {
|
|
67
|
+
return failed(`unsupported signature version ${proof.version}`)
|
|
68
|
+
}
|
|
69
|
+
if (!proof.signature?.length) {
|
|
70
|
+
return failed('proof carries no signature')
|
|
71
|
+
}
|
|
72
|
+
if (!proof.certificateChain?.length) {
|
|
73
|
+
return failed('empty certificate chain')
|
|
74
|
+
}
|
|
75
|
+
if (!unifiedResponseBytes?.length) {
|
|
76
|
+
return failed('no unified response bytes to verify')
|
|
77
|
+
}
|
|
78
|
+
const botFbid = String(botJid ?? '').split('@')[0]
|
|
79
|
+
if (!botFbid) {
|
|
80
|
+
return failed('no bot jid, the fbid is part of the signed payload')
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
let chain
|
|
84
|
+
try {
|
|
85
|
+
chain = proof.certificateChain.map(entry => new X509Certificate(Buffer.from(entry)))
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
return failed(`certificate did not parse: ${error.message}`)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const [leaf] = chain
|
|
92
|
+
if (!validAt(leaf, at)) {
|
|
93
|
+
return failed('leaf certificate is outside its validity window')
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const full = [...chain, root]
|
|
97
|
+
for (let index = 0; index < full.length - 1; index += 1) {
|
|
98
|
+
const issuer = full[index + 1]
|
|
99
|
+
if (!validAt(issuer, at)) {
|
|
100
|
+
return failed(`issuer at position ${index + 1} is outside its validity window`)
|
|
101
|
+
}
|
|
102
|
+
let ok = false
|
|
103
|
+
try {
|
|
104
|
+
ok = full[index].verify(issuer.publicKey)
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
return failed(`chain verification threw at position ${index}: ${error.message}`)
|
|
108
|
+
}
|
|
109
|
+
if (!ok) {
|
|
110
|
+
return failed(`chain broken at position ${index}`)
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const payload = constructSignaturePayload({ botFbid, messageDigest: unifiedResponseBytes })
|
|
115
|
+
let ok = false
|
|
116
|
+
try {
|
|
117
|
+
ok = cryptoVerify(null, payload, leaf.publicKey, Buffer.from(proof.signature))
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
return failed(`signature verification threw: ${error.message}`)
|
|
121
|
+
}
|
|
122
|
+
return ok ? { status: 'passed' } : failed('signature does not match the unified response bytes')
|
|
123
|
+
}
|
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
export declare const AI_RICH_LAYOUTS: readonly string[];
|
|
2
|
+
export declare const AI_RICH_PRIMITIVES: readonly string[];
|
|
3
|
+
export declare const AI_RICH_INLINE_ENTITIES: readonly string[];
|
|
4
|
+
export declare const AI_RICH_ITEMS: readonly string[];
|
|
5
|
+
export declare const AI_RICH_PRIMITIVES_WEB_RENDERED: readonly string[];
|
|
6
|
+
export declare const AI_RICH_PRIMITIVE_INTERFACE: 'GenAIUXPrimitive';
|
|
7
|
+
export declare const AI_RICH_PRIMITIVES_WITHOUT_SCHEMA: readonly string[];
|
|
8
|
+
export declare const AI_RICH_HTML_PRIMITIVE: 'GenAIaeacdsnwHtmlPrimitive';
|
|
9
|
+
|
|
10
|
+
export declare const DividerType: Readonly<{ DOT: 'DOT'; HORIZONTAL_LINE: 'HORIZONTAL_LINE' }>;
|
|
11
|
+
export declare const ImagineType: Readonly<{ IMAGINE: 'IMAGINE'; ANIMATE: 'ANIMATE'; MEMU: 'MEMU' }>;
|
|
12
|
+
export declare const ImagineStatus: Readonly<{ GENERATING: 'GENERATING'; READY: 'READY'; FAILED: 'FAILED' }>;
|
|
13
|
+
export declare const ThinkingIcon: Readonly<{ THINKING: 'THINKING'; WEB_SEARCH: 'WEB_SEARCH'; META_SEARCH: 'META_SEARCH' }>;
|
|
14
|
+
export declare const TaskStatus: Readonly<{ PENDING: 'PENDING'; RUNNING: 'RUNNING'; DONE: 'DONE' }>;
|
|
15
|
+
export declare const FooterActionType: Readonly<Record<string, string>>;
|
|
16
|
+
export declare const AddonActionType: Readonly<Record<string, string>>;
|
|
17
|
+
|
|
18
|
+
export declare function dividerSection(options?: { dividerType?: string }): any;
|
|
19
|
+
export declare function spacerSection(options?: { spacing?: number }): any;
|
|
20
|
+
export declare function imageSection(url: string, options?: {
|
|
21
|
+
fallbackUrl?: string;
|
|
22
|
+
previewUrl?: string;
|
|
23
|
+
previewFallbackUrl?: string;
|
|
24
|
+
}): any;
|
|
25
|
+
export declare function taskSection(options: {
|
|
26
|
+
taskId: string | number;
|
|
27
|
+
title?: string;
|
|
28
|
+
subtitle?: string;
|
|
29
|
+
status?: string;
|
|
30
|
+
}): any;
|
|
31
|
+
export declare function latexSection(expression: string, options?: {
|
|
32
|
+
image?: string;
|
|
33
|
+
width?: number;
|
|
34
|
+
height?: number;
|
|
35
|
+
fontHeight?: number;
|
|
36
|
+
padding?: number;
|
|
37
|
+
}): any;
|
|
38
|
+
export declare function thinkingSection(title: string, options?: {
|
|
39
|
+
icon?: string;
|
|
40
|
+
inProgress?: boolean;
|
|
41
|
+
metaSearchApps?: string[];
|
|
42
|
+
thoughtDurationSec?: number;
|
|
43
|
+
}): any;
|
|
44
|
+
export declare function progressSection(title: string, options?: {
|
|
45
|
+
icon?: string;
|
|
46
|
+
inProgress?: boolean;
|
|
47
|
+
metaSearchApps?: string[];
|
|
48
|
+
thoughtDurationSec?: number;
|
|
49
|
+
}): any;
|
|
50
|
+
|
|
51
|
+
export declare function lockHeight(height: number): string;
|
|
52
|
+
|
|
53
|
+
export declare const HTML_APP_BRIDGE: 'AndroidBridge';
|
|
54
|
+
|
|
55
|
+
export declare function dataUri(bytes: Buffer | Uint8Array, mimetype: string): string;
|
|
56
|
+
|
|
57
|
+
export declare function htmlMedia(bytes: Buffer | Uint8Array, options: {
|
|
58
|
+
mimetype: string;
|
|
59
|
+
tag?: 'video' | 'audio' | 'img';
|
|
60
|
+
label?: string;
|
|
61
|
+
poster?: string;
|
|
62
|
+
id?: string;
|
|
63
|
+
attributes?: string;
|
|
64
|
+
}): string;
|
|
65
|
+
|
|
66
|
+
export interface AutoHeightOptions {
|
|
67
|
+
min?: number;
|
|
68
|
+
max?: number;
|
|
69
|
+
settleMs?: number;
|
|
70
|
+
maxReports?: number;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export declare function autoHeight(options?: AutoHeightOptions): string;
|
|
74
|
+
|
|
75
|
+
export interface ScrollControlsOptions {
|
|
76
|
+
/** CSS selector for the pane to scroll. Defaults to the #__wrap that height creates. */
|
|
77
|
+
target?: string;
|
|
78
|
+
/** Pixels per tap, and per repeat while held. */
|
|
79
|
+
step?: number;
|
|
80
|
+
/** Repeat interval while a button is held down, at least 16. */
|
|
81
|
+
holdMs?: number;
|
|
82
|
+
/** Button edge length in pixels, at least 24. */
|
|
83
|
+
size?: number;
|
|
84
|
+
side?: 'right' | 'left';
|
|
85
|
+
inset?: number;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* On-screen scroll buttons. Touch scrolling inside the bubble is taken by the
|
|
90
|
+
* chat list behind it, so a page taller than its bubble cannot be scrolled by
|
|
91
|
+
* dragging; these move the pane programmatically instead. Hidden when the
|
|
92
|
+
* content already fits.
|
|
93
|
+
*/
|
|
94
|
+
export declare function scrollControls(options?: ScrollControlsOptions): string;
|
|
95
|
+
|
|
96
|
+
export declare const AI_RICH_HTML_PRIMITIVE_CLASS: 'FOAHtmlPrimitive';
|
|
97
|
+
|
|
98
|
+
export declare function htmlSection(html: string, options?: {
|
|
99
|
+
trustedSources?: string[];
|
|
100
|
+
height?: number;
|
|
101
|
+
typename?: string;
|
|
102
|
+
}): any;
|
|
103
|
+
|
|
104
|
+
export declare function sendHtmlApp(sock: any, jid: string, html: string, options?: {
|
|
105
|
+
title?: string;
|
|
106
|
+
label?: string;
|
|
107
|
+
trustedSources?: string[];
|
|
108
|
+
height?: number;
|
|
109
|
+
autoHeight?: boolean | AutoHeightOptions;
|
|
110
|
+
scrollButtons?: boolean | ScrollControlsOptions;
|
|
111
|
+
typename?: string;
|
|
112
|
+
id?: string;
|
|
113
|
+
bypassDownload?: boolean;
|
|
114
|
+
guard?: boolean | 'warn';
|
|
115
|
+
[key: string]: any;
|
|
116
|
+
}): Promise<any>;
|
|
117
|
+
|
|
118
|
+
export declare const HTML_MIME_TYPE: 'text/html';
|
|
119
|
+
|
|
120
|
+
export declare function sendHtmlDocument(sock: any, jid: string, html: string, options?: {
|
|
121
|
+
fileName?: string;
|
|
122
|
+
caption?: string;
|
|
123
|
+
[key: string]: any;
|
|
124
|
+
}): Promise<any>;
|
|
125
|
+
|
|
126
|
+
export interface FileSectionOptions {
|
|
127
|
+
title?: string;
|
|
128
|
+
fileExtension?: string;
|
|
129
|
+
fileLength?: number;
|
|
130
|
+
pageCount?: number;
|
|
131
|
+
previewImage?: any;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export declare function fileSection(url: string, options?: FileSectionOptions): any;
|
|
135
|
+
export declare function fileLinkSection(url: string, options?: FileSectionOptions): any;
|
|
136
|
+
|
|
137
|
+
export interface BotMediaMetadata {
|
|
138
|
+
fileSha256?: string;
|
|
139
|
+
mediaKey?: string;
|
|
140
|
+
fileEncSha256?: string;
|
|
141
|
+
directPath?: string;
|
|
142
|
+
mediaKeyTimestamp?: number;
|
|
143
|
+
mimetype?: string;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export declare function botMediaMetadata(documentMessage: any): BotMediaMetadata;
|
|
147
|
+
|
|
148
|
+
export declare function prepareFileArtifact(sock: any, content: string | Uint8Array, options?: {
|
|
149
|
+
mimetype?: string;
|
|
150
|
+
fileName?: string;
|
|
151
|
+
title?: string;
|
|
152
|
+
id?: string;
|
|
153
|
+
}): Promise<{
|
|
154
|
+
mediaId: string;
|
|
155
|
+
media: BotMediaMetadata;
|
|
156
|
+
documentMessage: any;
|
|
157
|
+
section: any;
|
|
158
|
+
mediaDetails: { id: string; previewMedia: BotMediaMetadata; highResMedia: BotMediaMetadata };
|
|
159
|
+
}>;
|
|
160
|
+
|
|
161
|
+
export declare function sendHtmlArtifact(sock: any, jid: string, html: string, options?: {
|
|
162
|
+
fileName?: string;
|
|
163
|
+
title?: string;
|
|
164
|
+
label?: string;
|
|
165
|
+
id?: string;
|
|
166
|
+
bypassDownload?: boolean;
|
|
167
|
+
[key: string]: any;
|
|
168
|
+
}): Promise<{ message: any; mediaId: string }>;
|
|
169
|
+
|
|
170
|
+
export declare const SourceProvider: Readonly<{ UNKNOWN: 0; BING: 1; GOOGLE: 2; SUPPORT: 3; OTHER: 4 }>;
|
|
171
|
+
|
|
172
|
+
export interface SourceInput {
|
|
173
|
+
url: string;
|
|
174
|
+
title?: string;
|
|
175
|
+
query?: string;
|
|
176
|
+
favicon?: string;
|
|
177
|
+
thumbnail?: string;
|
|
178
|
+
citation?: number;
|
|
179
|
+
provider?: number;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export declare function botSourcesMetadata(sources: SourceInput[]): { sources: any[] };
|
|
183
|
+
|
|
184
|
+
export declare const EMBEDDED_SCREEN_PRESENTATION: Readonly<{ HALF_HEIGHT: 'HALF_HEIGHT'; FULL_HEIGHT: 'FULL_HEIGHT' }>;
|
|
185
|
+
|
|
186
|
+
export declare const EMBEDDED_SCREEN_TYPENAME: string;
|
|
187
|
+
export declare const EMBEDDED_SCREEN_TABBED_TYPENAME: string;
|
|
188
|
+
export declare const EMBEDDED_SCREEN_TAB_TYPENAME: string;
|
|
189
|
+
export declare const AI_RICH_SECTION_TYPENAME: string;
|
|
190
|
+
export declare const AI_RICH_UNIFIED_RESPONSE_TYPENAME: string;
|
|
191
|
+
export declare const AI_RICH_UNIFIED_RESPONSE_TYPENAME_APP: string;
|
|
192
|
+
export declare const AI_RICH_NESTED_UNIFIED_RESPONSE_TYPENAME: string;
|
|
193
|
+
export declare const EMBEDDED_SCREEN_SINGLE_TYPENAME: string;
|
|
194
|
+
export declare const EMBEDDED_SCREEN_CONTEXTUAL_TYPENAME: string;
|
|
195
|
+
export declare const AI_RICH_NODES: readonly string[];
|
|
196
|
+
export declare function collectTypenames(root: any, options?: { limit?: number }): string[];
|
|
197
|
+
|
|
198
|
+
export declare function embeddedTab(options?: {
|
|
199
|
+
id?: string;
|
|
200
|
+
header?: any;
|
|
201
|
+
tabHeader?: any;
|
|
202
|
+
sections?: any[];
|
|
203
|
+
typename?: string;
|
|
204
|
+
}): any;
|
|
205
|
+
|
|
206
|
+
export declare function embeddedTabbedContent(tabs: any[], options?: { typename?: string }): any;
|
|
207
|
+
|
|
208
|
+
export declare const AI_RICH_RESPONSE_KEYS: readonly string[];
|
|
209
|
+
|
|
210
|
+
export declare function embeddedScreen(options?: {
|
|
211
|
+
id?: string;
|
|
212
|
+
title?: string;
|
|
213
|
+
content?: any[];
|
|
214
|
+
tabs?: any[];
|
|
215
|
+
tabsTypename?: string;
|
|
216
|
+
typename?: string;
|
|
217
|
+
header?: any;
|
|
218
|
+
body?: any;
|
|
219
|
+
artifacts?: any[];
|
|
220
|
+
steps?: any[];
|
|
221
|
+
stepEntries?: any[];
|
|
222
|
+
sources?: any[];
|
|
223
|
+
pollId?: string;
|
|
224
|
+
}): any;
|
|
225
|
+
|
|
226
|
+
export declare function readEmbeddedTabs(screen: any): any[];
|
|
227
|
+
|
|
228
|
+
export declare function readEmbeddedSections(screen: any): any[];
|
|
229
|
+
|
|
230
|
+
export declare function footerActionSection(actionType: string, options?: {
|
|
231
|
+
buttonText?: string;
|
|
232
|
+
url?: string;
|
|
233
|
+
}): any;
|
|
234
|
+
|
|
235
|
+
export declare const A2UI_VERSION: 'v0.9';
|
|
236
|
+
export declare const A2UI_BASIC_CATALOG: string;
|
|
237
|
+
export declare const A2UI_ROOT_ID: 'root';
|
|
238
|
+
|
|
239
|
+
export interface A2UIComponent {
|
|
240
|
+
id: string;
|
|
241
|
+
component: string;
|
|
242
|
+
[key: string]: any;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export interface A2UIElement {
|
|
246
|
+
type: 'info_card' | 'list_card';
|
|
247
|
+
[key: string]: any;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export declare function a2uiText(id: string, text: string, options?: { variant?: string }): A2UIComponent;
|
|
251
|
+
export declare function a2uiImage(id: string, url: string, options?: { variant?: string; fit?: string }): A2UIComponent;
|
|
252
|
+
export declare function a2uiColumn(id: string, children?: string[]): A2UIComponent;
|
|
253
|
+
export declare function a2uiRow(id: string, children?: string[]): A2UIComponent;
|
|
254
|
+
export declare function a2uiCard(id: string, child: string): A2UIComponent;
|
|
255
|
+
export declare function a2uiInfoCard(element?: Record<string, any>): A2UIElement;
|
|
256
|
+
export declare function a2uiListCard(element?: Record<string, any>): A2UIElement;
|
|
257
|
+
export declare function a2uiFallback(components: any[]): string;
|
|
258
|
+
|
|
259
|
+
export declare function a2uiSurface(components: A2UIComponent[], options?: {
|
|
260
|
+
surfaceId?: string;
|
|
261
|
+
root?: string;
|
|
262
|
+
catalogId?: string;
|
|
263
|
+
sendDataModel?: boolean;
|
|
264
|
+
version?: string;
|
|
265
|
+
type?: string;
|
|
266
|
+
title?: string;
|
|
267
|
+
}): any;
|
|
268
|
+
|
|
269
|
+
export declare function a2uiWidget(components: A2UIComponent[], options?: {
|
|
270
|
+
uuid?: string;
|
|
271
|
+
surfaceId?: string;
|
|
272
|
+
root?: string;
|
|
273
|
+
catalogId?: string;
|
|
274
|
+
sendDataModel?: boolean;
|
|
275
|
+
version?: string;
|
|
276
|
+
type?: string;
|
|
277
|
+
title?: string;
|
|
278
|
+
fallback?: string;
|
|
279
|
+
data?: any;
|
|
280
|
+
}): BloksWidget;
|
|
281
|
+
|
|
282
|
+
export declare function sendA2UI(sock: any, jid: string, components: A2UIComponent[], options?: {
|
|
283
|
+
buttons?: any[];
|
|
284
|
+
contextInfo?: any;
|
|
285
|
+
uuid?: string;
|
|
286
|
+
surfaceId?: string;
|
|
287
|
+
root?: string;
|
|
288
|
+
catalogId?: string;
|
|
289
|
+
sendDataModel?: boolean;
|
|
290
|
+
type?: string;
|
|
291
|
+
title?: string;
|
|
292
|
+
fallback?: string;
|
|
293
|
+
messageId?: string;
|
|
294
|
+
additionalNodes?: any[];
|
|
295
|
+
[key: string]: any;
|
|
296
|
+
}): Promise<any>;
|
|
297
|
+
|
|
298
|
+
export declare function buildA2UISection(components: A2UIComponent[], options?: {
|
|
299
|
+
uuid?: string;
|
|
300
|
+
surfaceId?: string;
|
|
301
|
+
root?: string;
|
|
302
|
+
catalogId?: string;
|
|
303
|
+
sendDataModel?: boolean;
|
|
304
|
+
version?: string;
|
|
305
|
+
type?: string;
|
|
306
|
+
title?: string;
|
|
307
|
+
data?: any;
|
|
308
|
+
initialResponse?: string;
|
|
309
|
+
versioningId?: string;
|
|
310
|
+
}): any;
|
|
311
|
+
|
|
312
|
+
export declare function sendA2UIBloks(sock: any, jid: string, components: A2UIComponent[], options?: {
|
|
313
|
+
uuid?: string;
|
|
314
|
+
surfaceId?: string;
|
|
315
|
+
root?: string;
|
|
316
|
+
catalogId?: string;
|
|
317
|
+
sendDataModel?: boolean;
|
|
318
|
+
version?: string;
|
|
319
|
+
type?: string;
|
|
320
|
+
title?: string;
|
|
321
|
+
data?: any;
|
|
322
|
+
initialResponse?: string;
|
|
323
|
+
versioningId?: string;
|
|
324
|
+
[key: string]: any;
|
|
325
|
+
}): Promise<any>;
|
|
326
|
+
|
|
327
|
+
export declare const BLOKS_A2UI_TYPE: 'im_a2ui';
|
|
328
|
+
export declare const BLOKS_A2UI_REPLY_ACTION: 'a2ui_reply_action';
|
|
329
|
+
export declare const BLOKS_A2UI_SUPPORTED_ELEMENTS: readonly string[];
|
|
330
|
+
|
|
331
|
+
export interface BloksWidget {
|
|
332
|
+
type: string;
|
|
333
|
+
data: string;
|
|
334
|
+
uuid: string;
|
|
335
|
+
fallback: string;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
export declare function bloksSection(type: string, data?: string | Record<string, any>, options?: {
|
|
339
|
+
uuid?: string;
|
|
340
|
+
initialResponse?: string;
|
|
341
|
+
versioningId?: string;
|
|
342
|
+
}): any;
|
|
343
|
+
|
|
344
|
+
export declare function bloksWidget(options: {
|
|
345
|
+
type: string;
|
|
346
|
+
data?: string | Record<string, any>;
|
|
347
|
+
uuid?: string;
|
|
348
|
+
fallback?: string;
|
|
349
|
+
}): BloksWidget;
|
|
350
|
+
|
|
351
|
+
export declare function sendBloksWidget(sock: any, jid: string, options: {
|
|
352
|
+
type: string;
|
|
353
|
+
data?: string | Record<string, any>;
|
|
354
|
+
uuid?: string;
|
|
355
|
+
fallback?: string;
|
|
356
|
+
body?: string;
|
|
357
|
+
contextInfo?: any;
|
|
358
|
+
messageId?: string;
|
|
359
|
+
additionalNodes?: any[];
|
|
360
|
+
[key: string]: any;
|
|
361
|
+
}): Promise<any>;
|
|
362
|
+
|
|
363
|
+
export declare function decodeBloksWidget(msg: any): (BloksWidget & { params: any }) | null;
|
|
364
|
+
|
|
365
|
+
export interface RichMessageRead {
|
|
366
|
+
kind: 'airich' | 'a2ui' | 'bloks' | 'interactive';
|
|
367
|
+
text: string;
|
|
368
|
+
title: string;
|
|
369
|
+
buttons: { name: string; params: any }[];
|
|
370
|
+
html: string[];
|
|
371
|
+
typenames: string[];
|
|
372
|
+
sections: any[];
|
|
373
|
+
footerSections: any[];
|
|
374
|
+
embeddedScreens: any[];
|
|
375
|
+
embeddedTabs: any[];
|
|
376
|
+
submessages: any[];
|
|
377
|
+
responseId?: string;
|
|
378
|
+
a2ui?: { surfaceId: string; root?: string; catalogId?: string; version: string; components: A2UIComponent[] };
|
|
379
|
+
bloks?: { type: string; uuid: string; fallback: string; params: any };
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
export declare function readRichMessage(msg: any): RichMessageRead | null;
|
|
383
|
+
|
|
384
|
+
export declare function decodeAIRich(msg: any): {
|
|
385
|
+
responseId?: string;
|
|
386
|
+
layouts: string[];
|
|
387
|
+
typenames: string[];
|
|
388
|
+
footerTypenames: string[];
|
|
389
|
+
sections: any[];
|
|
390
|
+
footerSections: any[];
|
|
391
|
+
embeddedScreens: any[];
|
|
392
|
+
embeddedTabs: any[];
|
|
393
|
+
embeddedSections: any[];
|
|
394
|
+
submessages: any[];
|
|
395
|
+
unified: any;
|
|
396
|
+
} | null;
|