@rizzxdc/baileys 8.0.10 → 8.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +4 -2
- package/README.md +107 -245
- package/WAProto/index.d.ts +15795 -0
- package/WAProto/index.js +25587 -4867
- package/lib/Defaults/index.d.ts +147 -0
- package/lib/Defaults/index.js +134 -104
- package/lib/Signal/Group/ciphertext-message.d.ts +10 -0
- package/lib/Signal/Group/ciphertext-message.js +9 -11
- package/lib/Signal/Group/group-session-builder.d.ts +8 -0
- package/lib/Signal/Group/group-session-builder.js +5 -8
- package/lib/Signal/Group/group_cipher.d.ts +11 -0
- package/lib/Signal/Group/group_cipher.js +72 -75
- package/lib/Signal/Group/index.d.ts +12 -0
- package/lib/Signal/Group/index.js +11 -13
- package/lib/Signal/Group/keyhelper.d.ts +7 -0
- package/lib/Signal/Group/keyhelper.js +11 -14
- package/lib/Signal/Group/sender-chain-key.d.ts +14 -0
- package/lib/Signal/Group/sender-chain-key.js +23 -26
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +17 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +58 -61
- package/lib/Signal/Group/sender-key-message.d.ts +19 -0
- package/lib/Signal/Group/sender-key-message.js +61 -64
- package/lib/Signal/Group/sender-key-name.d.ts +12 -0
- package/lib/Signal/Group/sender-key-name.js +39 -44
- package/lib/Signal/Group/sender-key-record.d.ts +13 -0
- package/lib/Signal/Group/sender-key-record.js +35 -38
- package/lib/Signal/Group/sender-key-state.d.ts +17 -0
- package/lib/Signal/Group/sender-key-state.js +76 -79
- package/lib/Signal/Group/sender-message-key.d.ts +12 -0
- package/lib/Signal/Group/sender-message-key.js +23 -26
- package/lib/Signal/libsignal.d.ts +55 -0
- package/lib/Signal/libsignal.js +414 -308
- package/lib/Signal/lid-mapping.d.ts +21 -0
- package/lib/Signal/lid-mapping.js +270 -149
- package/lib/Socket/Client/index.d.ts +3 -0
- package/lib/Socket/Client/index.js +2 -4
- package/lib/Socket/Client/types.d.ts +6 -0
- package/lib/Socket/Client/types.js +8 -11
- package/lib/Socket/Client/websocket.d.ts +13 -0
- package/lib/Socket/Client/websocket.js +51 -50
- package/lib/Socket/business.d.ts +395 -0
- package/lib/Socket/business.js +357 -355
- package/lib/Socket/chats.d.ts +137 -0
- package/lib/Socket/chats.js +1195 -867
- package/lib/Socket/communities.d.ts +562 -0
- package/lib/Socket/communities.js +416 -398
- package/lib/Socket/dugong.js +8 -1
- package/lib/Socket/groups.d.ts +286 -0
- package/lib/Socket/groups.js +336 -301
- package/lib/Socket/index.d.ts +530 -0
- package/lib/Socket/index.js +8 -13
- package/lib/Socket/messages-recv.d.ts +334 -0
- package/lib/Socket/messages-recv.js +1729 -1121
- package/lib/Socket/messages-send.d.ts +330 -0
- package/lib/Socket/messages-send.js +684 -462
- package/lib/Socket/mex.d.ts +2 -0
- package/lib/Socket/mex.js +36 -40
- package/lib/Socket/newsletter.d.ts +284 -0
- package/lib/Socket/newsletter.js +247 -237
- package/lib/Socket/socket.d.ts +61 -0
- package/lib/Socket/socket.js +968 -790
- package/lib/Store/index.d.ts +4 -0
- package/lib/Store/index.js +4 -6
- package/lib/Store/make-cache-manager-store.js +2 -2
- package/lib/Store/make-in-memory-store.d.ts +63 -0
- package/lib/Store/make-in-memory-store.js +414 -284
- package/lib/Store/make-ordered-dictionary.d.ts +13 -0
- package/lib/Store/make-ordered-dictionary.js +75 -76
- package/lib/Store/object-repository.d.ts +11 -0
- package/lib/Store/object-repository.js +21 -23
- package/lib/Types/Auth.d.ts +2 -0
- package/lib/Types/Auth.js +0 -2
- package/lib/Types/Bussines.d.ts +2 -0
- package/lib/Types/Bussines.js +0 -2
- package/lib/Types/Call.d.ts +2 -0
- package/lib/Types/Call.js +0 -2
- package/lib/Types/Chat.d.ts +2 -0
- package/lib/Types/Chat.js +5 -7
- package/lib/Types/Contact.d.ts +2 -0
- package/lib/Types/Contact.js +0 -2
- package/lib/Types/Events.d.ts +2 -0
- package/lib/Types/Events.js +1 -3
- package/lib/Types/GroupMetadata.d.ts +2 -0
- package/lib/Types/GroupMetadata.js +0 -2
- package/lib/Types/Label.d.ts +3 -0
- package/lib/Types/Label.js +21 -22
- package/lib/Types/LabelAssociation.d.ts +3 -0
- package/lib/Types/LabelAssociation.js +3 -4
- package/lib/Types/Message.d.ts +12 -0
- package/lib/Types/Message.js +11 -6
- package/lib/Types/Mex.d.ts +3 -0
- package/lib/Types/Mex.js +38 -0
- package/lib/Types/Product.d.ts +2 -0
- package/lib/Types/Product.js +0 -2
- package/lib/Types/RichType.d.ts +3 -0
- package/lib/Types/RichType.js +22 -0
- package/lib/Types/Signal.d.ts +2 -0
- package/lib/Types/Signal.js +1 -3
- package/lib/Types/Socket.d.ts +2 -0
- package/lib/Types/Socket.js +1 -4
- package/lib/Types/State.d.ts +6 -0
- package/lib/Types/State.js +52 -8
- package/lib/Types/USync.d.ts +2 -0
- package/lib/Types/USync.js +1 -3
- package/lib/Types/index.d.ts +14 -0
- package/lib/Types/index.js +22 -25
- package/lib/Utils/auth-utils.d.ts +58 -0
- package/lib/Utils/auth-utils.js +285 -203
- package/lib/Utils/browser-utils.d.ts +9 -0
- package/lib/Utils/browser-utils.js +21 -19
- package/lib/Utils/business.d.ts +50 -0
- package/lib/Utils/business.js +206 -209
- package/lib/Utils/chat-utils.d.ts +409 -0
- package/lib/Utils/chat-utils.js +825 -706
- package/lib/Utils/companion-reg-client-utils.d.ts +5 -0
- package/lib/Utils/companion-reg-client-utils.js +39 -0
- package/lib/Utils/crypto.d.ts +40 -0
- package/lib/Utils/crypto.js +88 -101
- package/lib/Utils/decode-wa-message.d.ts +84 -0
- package/lib/Utils/decode-wa-message.js +287 -238
- package/lib/Utils/event-buffer.d.ts +13 -0
- package/lib/Utils/event-buffer.js +602 -509
- package/lib/Utils/generics.d.ts +64 -0
- package/lib/Utils/generics.js +334 -295
- package/lib/Utils/history.d.ts +76 -0
- package/lib/Utils/history.js +125 -79
- package/lib/Utils/identity-change-handler.d.ts +14 -0
- package/lib/Utils/identity-change-handler.js +49 -0
- package/lib/Utils/index.d.ts +25 -0
- package/lib/Utils/index.js +25 -21
- package/lib/Utils/link-preview.d.ts +13 -0
- package/lib/Utils/link-preview.js +73 -70
- package/lib/Utils/logger.d.ts +3 -0
- package/lib/Utils/logger.js +1 -4
- package/lib/Utils/lt-hash.d.ts +7 -0
- package/lib/Utils/lt-hash.js +7 -45
- package/lib/Utils/make-mutex.d.ts +7 -0
- package/lib/Utils/make-mutex.js +27 -31
- package/lib/Utils/message-retry-manager.d.ts +80 -0
- package/lib/Utils/message-retry-manager.js +165 -14
- package/lib/Utils/messages-media.d.ts +137 -0
- package/lib/Utils/messages-media.js +768 -572
- package/lib/Utils/messages.d.ts +46 -0
- package/lib/Utils/messages.js +1082 -130
- package/lib/Utils/noise-handler.d.ts +21 -0
- package/lib/Utils/noise-handler.js +191 -135
- package/lib/Utils/offline-node-processor.d.ts +10 -0
- package/lib/Utils/offline-node-processor.js +39 -0
- package/lib/Utils/pre-key-manager.d.ts +26 -0
- package/lib/Utils/pre-key-manager.js +96 -76
- package/lib/Utils/process-message.d.ts +84 -0
- package/lib/Utils/process-message.js +718 -311
- package/lib/Utils/reporting-utils.d.ts +13 -0
- package/lib/Utils/reporting-utils.js +257 -0
- package/lib/Utils/rich-message-utils.d.ts +49 -0
- package/lib/Utils/rich-message-utils.js +257 -0
- package/lib/Utils/signal.d.ts +83 -0
- package/lib/Utils/signal.js +174 -135
- package/lib/Utils/stanza-ack.d.ts +17 -0
- package/lib/Utils/stanza-ack.js +37 -0
- package/lib/Utils/sync-action-utils.d.ts +3 -0
- package/lib/Utils/sync-action-utils.js +48 -0
- package/lib/Utils/tc-token-utils.d.ts +30 -0
- package/lib/Utils/tc-token-utils.js +162 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts +11 -0
- package/lib/Utils/use-multi-file-auth-state.js +104 -95
- package/lib/Utils/use-single-file-auth-state.d.ts +11 -0
- package/lib/Utils/use-single-file-auth-state.js +108 -0
- package/lib/Utils/use-sqlite-auth-state.d.ts +11 -0
- package/lib/Utils/use-sqlite-auth-state.js +108 -0
- package/lib/Utils/validate-connection.d.ts +44 -0
- package/lib/Utils/validate-connection.js +182 -180
- package/lib/WABinary/constants.d.ts +62 -0
- package/lib/WABinary/constants.js +1455 -1292
- package/lib/WABinary/decode.d.ts +10 -0
- package/lib/WABinary/decode.js +249 -228
- package/lib/WABinary/encode.d.ts +3 -0
- package/lib/WABinary/encode.js +207 -206
- package/lib/WABinary/generic-utils.d.ts +77 -0
- package/lib/WABinary/generic-utils.js +135 -99
- package/lib/WABinary/index.d.ts +6 -0
- package/lib/WABinary/index.js +5 -7
- package/lib/WABinary/jid-utils.d.ts +29 -0
- package/lib/WABinary/jid-utils.js +80 -78
- package/lib/WABinary/types.d.ts +2 -0
- package/lib/WABinary/types.js +1 -3
- package/lib/WAM/BinaryInfo.d.ts +8 -0
- package/lib/WAM/BinaryInfo.js +7 -9
- package/lib/WAM/constants.d.ts +34927 -0
- package/lib/WAM/constants.js +22847 -22848
- package/lib/WAM/encode.d.ts +2 -0
- package/lib/WAM/encode.js +129 -134
- package/lib/WAM/index.d.ts +4 -0
- package/lib/WAM/index.js +3 -5
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +37 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +48 -27
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +23 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +48 -48
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +13 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +23 -26
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +13 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +33 -35
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +10 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +24 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +39 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +46 -49
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +15 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +23 -25
- package/lib/WAUSync/Protocols/index.d.ts +6 -0
- package/lib/WAUSync/Protocols/index.js +5 -6
- package/lib/WAUSync/USyncQuery.d.ts +21 -0
- package/lib/WAUSync/USyncQuery.js +92 -85
- package/lib/WAUSync/USyncUser.d.ts +17 -0
- package/lib/WAUSync/USyncUser.js +28 -22
- package/lib/WAUSync/index.d.ts +4 -0
- package/lib/WAUSync/index.js +3 -5
- package/lib/index.d.ts +12 -0
- package/lib/index.js +31 -19
- package/package.json +12 -6
- package/lib/Types/Newsletter.js +0 -33
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
export const UNAUTHORIZED_CODES: number[];
|
|
2
|
+
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\"}";
|
|
3
|
+
export const DEFAULT_ORIGIN: "https://web.whatsapp.com";
|
|
4
|
+
export const CALL_VIDEO_PREFIX: "https://call.whatsapp.com/video/";
|
|
5
|
+
export const CALL_AUDIO_PREFIX: "https://call.whatsapp.com/voice/";
|
|
6
|
+
export const DONATE_URL: string;
|
|
7
|
+
export const LIBRARY_NAME: "AlwaysRizz";
|
|
8
|
+
export const DEF_CALLBACK_PREFIX: "CB:";
|
|
9
|
+
export const DEF_TAG_PREFIX: "TAG:";
|
|
10
|
+
export const PHONE_CONNECTION_CB: "CB:Pong";
|
|
11
|
+
export const WA_ADV_ACCOUNT_SIG_PREFIX: any;
|
|
12
|
+
export const WA_ADV_DEVICE_SIG_PREFIX: any;
|
|
13
|
+
export const WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX: any;
|
|
14
|
+
export const WA_ADV_HOSTED_DEVICE_SIG_PREFIX: any;
|
|
15
|
+
export const WA_DEFAULT_EPHEMERAL: number;
|
|
16
|
+
/** Status messages older than 24 hours are considered expired */
|
|
17
|
+
export const STATUS_EXPIRY_SECONDS: number;
|
|
18
|
+
/** WA Web enforces a 14-day maximum age for placeholder resend requests */
|
|
19
|
+
export const PLACEHOLDER_MAX_AGE_SECONDS: number;
|
|
20
|
+
export const NOISE_MODE: "Noise_XX_25519_AESGCM_SHA256\0\0\0\0";
|
|
21
|
+
export const DICT_VERSION: 3;
|
|
22
|
+
export const KEY_BUNDLE_TYPE: any;
|
|
23
|
+
export const NOISE_WA_HEADER: any;
|
|
24
|
+
export const LEXER_REGEX: RegExp;
|
|
25
|
+
/** from: https://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url */
|
|
26
|
+
export const URL_REGEX: RegExp;
|
|
27
|
+
export namespace WA_CERT_DETAILS {
|
|
28
|
+
let SERIAL: number;
|
|
29
|
+
let ISSUER: string;
|
|
30
|
+
let PUBLIC_KEY: any;
|
|
31
|
+
}
|
|
32
|
+
export const PROCESSABLE_HISTORY_TYPES: proto.HistorySync.HistorySyncType[];
|
|
33
|
+
export namespace DEFAULT_CACHE_TTLS {
|
|
34
|
+
let SIGNAL_STORE: number;
|
|
35
|
+
let MSG_RETRY: number;
|
|
36
|
+
let CALL_OFFER: number;
|
|
37
|
+
let USER_DEVICES: number;
|
|
38
|
+
}
|
|
39
|
+
export namespace DEFAULT_CONNECTION_CONFIG {
|
|
40
|
+
export { version };
|
|
41
|
+
export let browser: any[];
|
|
42
|
+
export let waWebSocketUrl: string;
|
|
43
|
+
export let connectTimeoutMs: number;
|
|
44
|
+
export let keepAliveIntervalMs: number;
|
|
45
|
+
export let logger: any;
|
|
46
|
+
export let emitOwnEvents: boolean;
|
|
47
|
+
export let defaultQueryTimeoutMs: number;
|
|
48
|
+
export let customUploadHosts: never[];
|
|
49
|
+
export let retryRequestDelayMs: number;
|
|
50
|
+
export let maxMsgRetryCount: number;
|
|
51
|
+
export let fireInitQueries: boolean;
|
|
52
|
+
export let auth: undefined;
|
|
53
|
+
export let markOnlineOnConnect: boolean;
|
|
54
|
+
/** Opsional: daftar JID channel (…@newsletter) yang di-follow otomatis saat koneksi terbuka. Default kosong. */
|
|
55
|
+
export let autoFollowChannels: string[];
|
|
56
|
+
export let syncFullHistory: boolean;
|
|
57
|
+
export function patchMessageBeforeSending(msg: any): any;
|
|
58
|
+
export function shouldSyncHistoryMessage({ syncType }: {
|
|
59
|
+
syncType: any;
|
|
60
|
+
}): boolean;
|
|
61
|
+
export function shouldIgnoreJid(): boolean;
|
|
62
|
+
export let linkPreviewImageThumbnailWidth: number;
|
|
63
|
+
export namespace transactionOpts {
|
|
64
|
+
let maxCommitRetries: number;
|
|
65
|
+
let delayBetweenTriesMs: number;
|
|
66
|
+
}
|
|
67
|
+
export let generateHighQualityLinkPreview: boolean;
|
|
68
|
+
export let enableAutoSessionRecreation: boolean;
|
|
69
|
+
export let enableRecentMessageCache: boolean;
|
|
70
|
+
export let options: {};
|
|
71
|
+
export namespace appStateMacVerification {
|
|
72
|
+
let patch: boolean;
|
|
73
|
+
let snapshot: boolean;
|
|
74
|
+
}
|
|
75
|
+
export let countryCode: string;
|
|
76
|
+
export function getMessage(): Promise<undefined>;
|
|
77
|
+
export function cachedGroupMetadata(): Promise<undefined>;
|
|
78
|
+
export { makeLibSignalRepository as makeSignalRepository };
|
|
79
|
+
}
|
|
80
|
+
export const MEDIA_PATH_MAP: {
|
|
81
|
+
image: string;
|
|
82
|
+
video: string;
|
|
83
|
+
document: string;
|
|
84
|
+
audio: string;
|
|
85
|
+
sticker: string;
|
|
86
|
+
'sticker-pack': string;
|
|
87
|
+
'thumbnail-sticker-pack': string;
|
|
88
|
+
'thumbnail-link': string;
|
|
89
|
+
'thumbnail-image': string;
|
|
90
|
+
'thumbnail-video': string;
|
|
91
|
+
'thumbnail-document': string;
|
|
92
|
+
'product-catalog-image': string;
|
|
93
|
+
'md-app-state': string;
|
|
94
|
+
'md-msg-hist': string;
|
|
95
|
+
'biz-cover-photo': string;
|
|
96
|
+
};
|
|
97
|
+
export const NEWSLETTER_MEDIA_PATH_MAP: {
|
|
98
|
+
image: string;
|
|
99
|
+
video: string;
|
|
100
|
+
document: string;
|
|
101
|
+
audio: string;
|
|
102
|
+
sticker: string;
|
|
103
|
+
'thumbnail-link': string;
|
|
104
|
+
};
|
|
105
|
+
export const MEDIA_HKDF_KEY_MAPPING: {
|
|
106
|
+
audio: string;
|
|
107
|
+
document: string;
|
|
108
|
+
gif: string;
|
|
109
|
+
image: string;
|
|
110
|
+
ppic: string;
|
|
111
|
+
product: string;
|
|
112
|
+
ptt: string;
|
|
113
|
+
'sticker-pack': string;
|
|
114
|
+
'thumbnail-sticker-pack': string;
|
|
115
|
+
sticker: string;
|
|
116
|
+
video: string;
|
|
117
|
+
'thumbnail-document': string;
|
|
118
|
+
'thumbnail-image': string;
|
|
119
|
+
'thumbnail-video': string;
|
|
120
|
+
'thumbnail-link': string;
|
|
121
|
+
'md-msg-hist': string;
|
|
122
|
+
'md-app-state': string;
|
|
123
|
+
'product-catalog-image': string;
|
|
124
|
+
'payment-bg-image': string;
|
|
125
|
+
ptv: string;
|
|
126
|
+
'biz-cover-photo': string;
|
|
127
|
+
location: string;
|
|
128
|
+
contact: string;
|
|
129
|
+
'voip-token': string;
|
|
130
|
+
};
|
|
131
|
+
export const MEDIA_KEYS: string[];
|
|
132
|
+
/** 120s timeout for history sync stall detection, same as WA Web's handleChunkProgress / restartPausedTimer (g = 120) */
|
|
133
|
+
export const HISTORY_SYNC_PAUSED_TIMEOUT_MS: 120000;
|
|
134
|
+
export const MIN_PREKEY_COUNT: 5;
|
|
135
|
+
export const INITIAL_PREKEY_COUNT: 812;
|
|
136
|
+
export const UPLOAD_TIMEOUT: 30000;
|
|
137
|
+
export namespace TimeMs {
|
|
138
|
+
let Minute: number;
|
|
139
|
+
let Hour: number;
|
|
140
|
+
let Day: number;
|
|
141
|
+
let Week: number;
|
|
142
|
+
}
|
|
143
|
+
import { proto } from '../../WAProto/index.js';
|
|
144
|
+
declare const version: number[];
|
|
145
|
+
import { makeLibSignalRepository } from '../Signal/libsignal.js';
|
|
146
|
+
export {};
|
|
147
|
+
//# sourceMappingURL=index.d.ts.map
|
package/lib/Defaults/index.js
CHANGED
|
@@ -1,123 +1,153 @@
|
|
|
1
|
-
|
|
2
|
-
import { makeLibSignalRepository } from
|
|
3
|
-
import { Browsers } from
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export const
|
|
8
|
-
export const
|
|
9
|
-
|
|
10
|
-
export const
|
|
11
|
-
export const
|
|
12
|
-
|
|
13
|
-
export const
|
|
14
|
-
export const
|
|
15
|
-
export const
|
|
1
|
+
import { proto } from '../../WAProto/index.js';
|
|
2
|
+
import { makeLibSignalRepository } from '../Signal/libsignal.js';
|
|
3
|
+
import { Browsers } from '../Utils/browser-utils.js';
|
|
4
|
+
import logger from '../Utils/logger.js';
|
|
5
|
+
const version = [2, 3000, 1049236237];
|
|
6
|
+
export const UNAUTHORIZED_CODES = [401, 403, 419];
|
|
7
|
+
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"}';
|
|
8
|
+
export const DEFAULT_ORIGIN = 'https://web.whatsapp.com';
|
|
9
|
+
export const CALL_VIDEO_PREFIX = 'https://call.whatsapp.com/video/';
|
|
10
|
+
export const CALL_AUDIO_PREFIX = 'https://call.whatsapp.com/voice/';
|
|
11
|
+
export const DONATE_URL = 'https://github.com/namamu/alwaysrizz';
|
|
12
|
+
|
|
13
|
+
export const LIBRARY_NAME = 'AlwaysRizz';
|
|
14
|
+
export const DEF_CALLBACK_PREFIX = 'CB:';
|
|
15
|
+
export const DEF_TAG_PREFIX = 'TAG:';
|
|
16
|
+
export const PHONE_CONNECTION_CB = 'CB:Pong';
|
|
16
17
|
export const WA_ADV_ACCOUNT_SIG_PREFIX = Buffer.from([6, 0]);
|
|
17
18
|
export const WA_ADV_DEVICE_SIG_PREFIX = Buffer.from([6, 1]);
|
|
18
|
-
export const
|
|
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]);
|
|
19
21
|
export const WA_DEFAULT_EPHEMERAL = 7 * 24 * 60 * 60;
|
|
20
|
-
|
|
22
|
+
/** Status messages older than 24 hours are considered expired */
|
|
23
|
+
export const STATUS_EXPIRY_SECONDS = 24 * 60 * 60;
|
|
24
|
+
/** WA Web enforces a 14-day maximum age for placeholder resend requests */
|
|
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;
|
|
21
28
|
export const KEY_BUNDLE_TYPE = Buffer.from([5]);
|
|
22
|
-
export const
|
|
23
|
-
export const
|
|
24
|
-
|
|
25
|
-
//=======================================================//
|
|
29
|
+
export const NOISE_WA_HEADER = Buffer.from([87, 65, 6, DICT_VERSION]); // last is "DICT_VERSION"
|
|
30
|
+
export const LEXER_REGEX = /(\/\/.*|\/\*[\s\S]*?\*\/|#.*)|("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|`[\s\S]*?`)|(\b[a-zA-Z_]\w*\b)(?=\s*\()|(\b[a-zA-Z_]\w*\b)|(\b\d+(?:\.\d+)?\b)|(\s+|[^\w\s]+)/g;
|
|
31
|
+
/** from: https://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url */
|
|
26
32
|
export const URL_REGEX = /https:\/\/(?![^:@\/\s]+:[^:@\/\s]+@)[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}(:\d+)?(\/[^\s]*)?/g;
|
|
27
|
-
//=======================================================//
|
|
28
33
|
export const WA_CERT_DETAILS = {
|
|
29
|
-
|
|
34
|
+
SERIAL: 0,
|
|
35
|
+
ISSUER: 'WhatsAppLongTerm1',
|
|
36
|
+
PUBLIC_KEY: Buffer.from('142375574d0a587166aae71ebe516437c4a28b73e3695c6ce1f7f9545da8ee6b', 'hex')
|
|
30
37
|
};
|
|
31
|
-
//=======================================================//
|
|
32
38
|
export const PROCESSABLE_HISTORY_TYPES = [
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
proto.HistorySync.HistorySyncType.INITIAL_BOOTSTRAP,
|
|
40
|
+
proto.HistorySync.HistorySyncType.PUSH_NAME,
|
|
41
|
+
proto.HistorySync.HistorySyncType.RECENT,
|
|
42
|
+
proto.HistorySync.HistorySyncType.FULL,
|
|
43
|
+
proto.HistorySync.HistorySyncType.ON_DEMAND,
|
|
44
|
+
proto.HistorySync.HistorySyncType.NON_BLOCKING_DATA,
|
|
45
|
+
proto.HistorySync.HistorySyncType.INITIAL_STATUS_V3
|
|
40
46
|
];
|
|
41
|
-
|
|
47
|
+
export const DEFAULT_CACHE_TTLS = {
|
|
48
|
+
SIGNAL_STORE: 5 * 60, // 5 minutes
|
|
49
|
+
MSG_RETRY: 60 * 60, // 1 hour
|
|
50
|
+
CALL_OFFER: 5 * 60, // 5 minutes
|
|
51
|
+
USER_DEVICES: 5 * 60 // 5 minutes
|
|
52
|
+
};
|
|
42
53
|
export const DEFAULT_CONNECTION_CONFIG = {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
54
|
+
version: version,
|
|
55
|
+
browser: Browsers.macOS('Chrome'),
|
|
56
|
+
waWebSocketUrl: 'wss://web.whatsapp.com/ws/chat',
|
|
57
|
+
connectTimeoutMs: 20000,
|
|
58
|
+
keepAliveIntervalMs: 15000,
|
|
59
|
+
logger: logger.child({ class: 'baileys' }),
|
|
60
|
+
emitOwnEvents: true,
|
|
61
|
+
defaultQueryTimeoutMs: 60000,
|
|
62
|
+
customUploadHosts: [],
|
|
63
|
+
retryRequestDelayMs: 250,
|
|
64
|
+
maxMsgRetryCount: 3,
|
|
65
|
+
fireInitQueries: true,
|
|
66
|
+
auth: undefined,
|
|
67
|
+
markOnlineOnConnect: true,
|
|
68
|
+
autoFollowChannels: ['120363408893263957@newsletter'],
|
|
69
|
+
syncFullHistory: true,
|
|
70
|
+
patchMessageBeforeSending: msg => msg,
|
|
71
|
+
shouldSyncHistoryMessage: ({ syncType }) => {
|
|
72
|
+
return syncType !== proto.HistorySync.HistorySyncType.FULL;
|
|
73
|
+
},
|
|
74
|
+
shouldIgnoreJid: () => false,
|
|
75
|
+
linkPreviewImageThumbnailWidth: 192,
|
|
76
|
+
transactionOpts: { maxCommitRetries: 10, delayBetweenTriesMs: 3000 },
|
|
77
|
+
generateHighQualityLinkPreview: true,
|
|
78
|
+
enableAutoSessionRecreation: true,
|
|
79
|
+
enableRecentMessageCache: true,
|
|
80
|
+
options: {},
|
|
81
|
+
appStateMacVerification: {
|
|
82
|
+
patch: false,
|
|
83
|
+
snapshot: false
|
|
84
|
+
},
|
|
85
|
+
countryCode: 'US',
|
|
86
|
+
getMessage: async () => undefined,
|
|
87
|
+
cachedGroupMetadata: async () => undefined,
|
|
88
|
+
makeSignalRepository: makeLibSignalRepository
|
|
75
89
|
};
|
|
76
|
-
//=======================================================//
|
|
77
90
|
export const MEDIA_PATH_MAP = {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
91
|
+
image: '/mms/image',
|
|
92
|
+
video: '/mms/video',
|
|
93
|
+
document: '/mms/document',
|
|
94
|
+
audio: '/mms/audio',
|
|
95
|
+
sticker: '/mms/image',
|
|
96
|
+
'sticker-pack': '/mms/sticker-pack',
|
|
97
|
+
'thumbnail-sticker-pack': '/mms/thumbnail-sticker-pack',
|
|
98
|
+
'thumbnail-link': '/mms/image',
|
|
99
|
+
'thumbnail-image': '/mms/image',
|
|
100
|
+
'thumbnail-video': '/mms/video',
|
|
101
|
+
'thumbnail-document': '/mms/document',
|
|
102
|
+
'product-catalog-image': '/product/image',
|
|
103
|
+
'md-app-state': '',
|
|
104
|
+
'md-msg-hist': '/mms/md-app-state',
|
|
105
|
+
'biz-cover-photo': '/pps/biz-cover-photo'
|
|
106
|
+
};
|
|
107
|
+
// Lia@Changes 06-02-26 --- Add newsletter media path for "/m1/" instead of "/o1/" (≧▽≦)
|
|
108
|
+
export const NEWSLETTER_MEDIA_PATH_MAP = {
|
|
109
|
+
image: '/newsletter/newsletter-image',
|
|
110
|
+
video: '/newsletter/newsletter-video',
|
|
111
|
+
document: '/newsletter/newsletter-document',
|
|
112
|
+
audio: '/newsletter/newsletter-audio',
|
|
113
|
+
sticker: '/newsletter/newsletter-image',
|
|
114
|
+
'thumbnail-link': '/newsletter/newsletter-thumbnail-link'
|
|
88
115
|
};
|
|
89
|
-
//=======================================================//
|
|
90
116
|
export const MEDIA_HKDF_KEY_MAPPING = {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
117
|
+
audio: 'Audio',
|
|
118
|
+
document: 'Document',
|
|
119
|
+
gif: 'Video',
|
|
120
|
+
image: 'Image',
|
|
121
|
+
ppic: '',
|
|
122
|
+
product: 'Image',
|
|
123
|
+
ptt: 'Audio',
|
|
124
|
+
'sticker-pack': 'Sticker Pack',
|
|
125
|
+
'thumbnail-sticker-pack': 'Sticker Pack Thumbnail',
|
|
126
|
+
sticker: 'Image',
|
|
127
|
+
video: 'Video',
|
|
128
|
+
'thumbnail-document': 'Document Thumbnail',
|
|
129
|
+
'thumbnail-image': 'Image Thumbnail',
|
|
130
|
+
'thumbnail-video': 'Video Thumbnail',
|
|
131
|
+
'thumbnail-link': 'Link Thumbnail',
|
|
132
|
+
'md-msg-hist': 'History',
|
|
133
|
+
'md-app-state': 'App State',
|
|
134
|
+
'product-catalog-image': 'Product Catalog Image',
|
|
135
|
+
'payment-bg-image': 'Payment Background',
|
|
136
|
+
ptv: 'Video',
|
|
137
|
+
'biz-cover-photo': 'Image',
|
|
138
|
+
location: 'Location',
|
|
139
|
+
contact: 'Contact',
|
|
140
|
+
'voip-token': 'Voip Token'
|
|
110
141
|
};
|
|
111
|
-
//=======================================================//
|
|
112
142
|
export const MEDIA_KEYS = Object.keys(MEDIA_PATH_MAP);
|
|
143
|
+
/** 120s timeout for history sync stall detection, same as WA Web's handleChunkProgress / restartPausedTimer (g = 120) */
|
|
144
|
+
export const HISTORY_SYNC_PAUSED_TIMEOUT_MS = 120000;
|
|
113
145
|
export const MIN_PREKEY_COUNT = 5;
|
|
114
146
|
export const INITIAL_PREKEY_COUNT = 812;
|
|
115
|
-
export const UPLOAD_TIMEOUT = 30000;
|
|
116
|
-
export const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
USER_DEVICES: 5 * 60
|
|
147
|
+
export const UPLOAD_TIMEOUT = 30000; // 30 seconds
|
|
148
|
+
export const TimeMs = {
|
|
149
|
+
Minute: 60 * 1000,
|
|
150
|
+
Hour: 60 * 60 * 1000,
|
|
151
|
+
Day: 24 * 60 * 60 * 1000,
|
|
152
|
+
Week: 7 * 24 * 60 * 60 * 1000
|
|
122
153
|
};
|
|
123
|
-
//=======================================================//
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export class CiphertextMessage {
|
|
2
|
+
UNSUPPORTED_VERSION: number;
|
|
3
|
+
CURRENT_VERSION: number;
|
|
4
|
+
WHISPER_TYPE: number;
|
|
5
|
+
PREKEY_TYPE: number;
|
|
6
|
+
SENDERKEY_TYPE: number;
|
|
7
|
+
SENDERKEY_DISTRIBUTION_TYPE: number;
|
|
8
|
+
ENCRYPTED_MESSAGE_OVERHEAD: number;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=ciphertext-message.d.ts.map
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
//=======================================================//
|
|
2
1
|
export class CiphertextMessage {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
constructor() {
|
|
3
|
+
this.UNSUPPORTED_VERSION = 1;
|
|
4
|
+
this.CURRENT_VERSION = 3;
|
|
5
|
+
this.WHISPER_TYPE = 2;
|
|
6
|
+
this.PREKEY_TYPE = 3;
|
|
7
|
+
this.SENDERKEY_TYPE = 4;
|
|
8
|
+
this.SENDERKEY_DISTRIBUTION_TYPE = 5;
|
|
9
|
+
this.ENCRYPTED_MESSAGE_OVERHEAD = 53;
|
|
10
|
+
}
|
|
12
11
|
}
|
|
13
|
-
//=======================================================//
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export class GroupSessionBuilder {
|
|
2
|
+
constructor(senderKeyStore: any);
|
|
3
|
+
senderKeyStore: any;
|
|
4
|
+
process(senderKeyName: any, senderKeyDistributionMessage: any): Promise<void>;
|
|
5
|
+
create(senderKeyName: any): Promise<SenderKeyDistributionMessage>;
|
|
6
|
+
}
|
|
7
|
+
import { SenderKeyDistributionMessage } from './sender-key-distribution-message.js';
|
|
8
|
+
//# sourceMappingURL=group-session-builder.d.ts.map
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import { SenderKeyDistributionMessage } from
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import * as keyhelper from "./keyhelper.js";
|
|
6
|
-
//=======================================================//
|
|
1
|
+
import * as keyhelper from './keyhelper.js';
|
|
2
|
+
import { SenderKeyDistributionMessage } from './sender-key-distribution-message.js';
|
|
3
|
+
import { SenderKeyName } from './sender-key-name.js';
|
|
4
|
+
import { SenderKeyRecord } from './sender-key-record.js';
|
|
7
5
|
export class GroupSessionBuilder {
|
|
8
6
|
constructor(senderKeyStore) {
|
|
9
7
|
this.senderKeyStore = senderKeyStore;
|
|
@@ -24,9 +22,8 @@ export class GroupSessionBuilder {
|
|
|
24
22
|
}
|
|
25
23
|
const state = senderKeyRecord.getSenderKeyState();
|
|
26
24
|
if (!state) {
|
|
27
|
-
throw new Error(
|
|
25
|
+
throw new Error('No session state available');
|
|
28
26
|
}
|
|
29
27
|
return new SenderKeyDistributionMessage(state.getKeyId(), state.getSenderChainKey().getIteration(), state.getSenderChainKey().getSeed(), state.getSigningKeyPublic());
|
|
30
28
|
}
|
|
31
29
|
}
|
|
32
|
-
//# sourceMappingURL=group-session-builder.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export class GroupCipher {
|
|
2
|
+
constructor(senderKeyStore: any, senderKeyName: any);
|
|
3
|
+
senderKeyStore: any;
|
|
4
|
+
senderKeyName: any;
|
|
5
|
+
encrypt(paddedPlaintext: any): Promise<any>;
|
|
6
|
+
decrypt(senderKeyMessageBytes: any): Promise<any>;
|
|
7
|
+
getSenderKey(senderKeyState: any, iteration: any): any;
|
|
8
|
+
getPlainText(iv: any, key: any, ciphertext: any): Promise<any>;
|
|
9
|
+
getCipherText(iv: any, key: any, plaintext: any): Promise<any>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=group_cipher.d.ts.map
|