@oxidezap/whatsapp-rust-bridge 0.6.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/README.md +17 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +2 -0
- package/dist/proto-namespace.d.ts +34 -0
- package/dist/proto-reader.d.ts +20 -0
- package/dist/proto-types.d.ts +16917 -0
- package/dist/proto-types.js +1 -0
- package/dist/proto.d.ts +8 -0
- package/dist/whatsapp_rust_bridge.d.ts +3804 -0
- package/dist/whatsapp_rust_bridge_bg.wasm +0 -0
- package/dist/wire-info.d.ts +107 -0
- package/package.json +59 -0
|
@@ -0,0 +1,3804 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* The `ReadableStreamType` enum.
|
|
5
|
+
*
|
|
6
|
+
* *This API requires the following crate features to be activated: `ReadableStreamType`*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export type ReadableStreamType = "bytes";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* JS HTTP client callbacks. Implement using fetch() or any HTTP library.
|
|
13
|
+
*/
|
|
14
|
+
export interface JsHttpClientConfig {
|
|
15
|
+
execute(url: string, method: string, headers: Record<string, string>, body: Uint8Array | null): Promise<{ statusCode: number; body: Uint8Array }>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* JS transport callbacks for WebSocket management.
|
|
22
|
+
*
|
|
23
|
+
* Passed to `createWhatsAppClient` as the transport config.
|
|
24
|
+
*
|
|
25
|
+
* `connect(handle)` is called when the client needs a connection:
|
|
26
|
+
* - Create a WebSocket
|
|
27
|
+
* - Wire ws.onopen → handle.onConnected()
|
|
28
|
+
* - Wire ws.onmessage → handle.onData(data)
|
|
29
|
+
* - Wire ws.onclose → handle.onDisconnected()
|
|
30
|
+
*
|
|
31
|
+
* `send(data)` sends raw bytes over the active WebSocket.
|
|
32
|
+
* `sendBorrowed(data)`, when provided, is the zero-copy fast path. The view is
|
|
33
|
+
* borrowed from WASM memory and is valid ONLY for the synchronous duration of
|
|
34
|
+
* the call: implementations MUST consume/copy it before returning and MUST NOT
|
|
35
|
+
* retain it, re-enter WASM, or return a Promise. The mandatory `send` method is
|
|
36
|
+
* kept as the safe copying fallback for every other transport.
|
|
37
|
+
* `disconnect()` closes the WebSocket.
|
|
38
|
+
*/
|
|
39
|
+
export interface JsTransportHandle {
|
|
40
|
+
onConnected(): void;
|
|
41
|
+
onData(data: Uint8Array): void;
|
|
42
|
+
onDisconnected(): void;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Every Promise handed back to the bridge must settle, including on failure:
|
|
47
|
+
* reject rather than leaving it pending. The bridge awaits it through a
|
|
48
|
+
* wasm-bindgen `JsFuture`, whose resolve/reject pair is only released when the
|
|
49
|
+
* promise settles, so a promise that never settles retains two JS handles for
|
|
50
|
+
* the life of the process.
|
|
51
|
+
*/
|
|
52
|
+
export interface JsTransportCallbacks {
|
|
53
|
+
connect(handle: JsTransportHandle): void | Promise<void>;
|
|
54
|
+
send(data: Uint8Array): void | Promise<void>;
|
|
55
|
+
sendBorrowed?(data: Uint8Array): void;
|
|
56
|
+
disconnect(): void | Promise<void>;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Native crypto callbacks installed via `initWasmEngine` for large AES operations.
|
|
63
|
+
* Supply an implementation backed by the host platform's native crypto API.
|
|
64
|
+
*/
|
|
65
|
+
export interface JsCryptoCallbacks {
|
|
66
|
+
aesCbc256Encrypt(key: Uint8Array, iv: Uint8Array, plaintext: Uint8Array): Uint8Array;
|
|
67
|
+
aesCbc256Decrypt(key: Uint8Array, iv: Uint8Array, ciphertext: Uint8Array): Uint8Array;
|
|
68
|
+
aesGcm256Encrypt(key: Uint8Array, nonce: Uint8Array, aad: Uint8Array, plaintext: Uint8Array): Uint8Array;
|
|
69
|
+
aesGcm256Decrypt(key: Uint8Array, nonce: Uint8Array, aad: Uint8Array, ciphertextWithTag: Uint8Array): Uint8Array;
|
|
70
|
+
hmacSha256(key: Uint8Array, data: Uint8Array): Uint8Array;
|
|
71
|
+
hmacSha256TwoPart?(key: Uint8Array, first: Uint8Array, second: Uint8Array): Uint8Array;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
/** Neutral binary stanza representation accepted by the client boundary. */
|
|
77
|
+
export interface BinaryNode {
|
|
78
|
+
tag: string;
|
|
79
|
+
attrs: Record<string, string>;
|
|
80
|
+
content?: BinaryNode[] | string | Uint8Array;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
/** WhatsApp JID (Jabber ID) — identifies a user, group, or device. */
|
|
86
|
+
export interface Jid {
|
|
87
|
+
user: string;
|
|
88
|
+
server: string;
|
|
89
|
+
agent: number;
|
|
90
|
+
device: number;
|
|
91
|
+
integrator: number;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** Addressing mode for a group (phone number vs LID). */
|
|
95
|
+
export type AddressingMode = "pn" | "lid";
|
|
96
|
+
|
|
97
|
+
/** A batched app-state sync finished without leaving every collection synced. Collections are named as they appear on the wire (`critical_block`, `regular_high`, …) rather than as an enum, so the payload stays stable if the set of collections changes. `fatal` is the one a consumer usually has to act on: the server refused the collection, and repeating the request gets the same answer. WhatsApp Web treats that as grounds to notify the primary device and log out; this library will not end a session on its own, so it reports the refusal and keeps the connection. When `connected` is true the client dispatched [`Event::Connected`] anyway and is usable, minus whatever those collections carry — for `critical_block` that includes the push name, so presence stays unavailable until it syncs. */
|
|
98
|
+
export interface AppStateSyncFailed {
|
|
99
|
+
/** Refused outright by the server (400/404). Terminal for this connection. */
|
|
100
|
+
fatal: string[];
|
|
101
|
+
/** Did not sync, but a later attempt can. */
|
|
102
|
+
retryable: string[];
|
|
103
|
+
/** Another writer held the collection, so this sync did nothing for it. */
|
|
104
|
+
skipped: string[];
|
|
105
|
+
/** Whether the client went on to dispatch [`Event::Connected`]. */
|
|
106
|
+
connected: boolean;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** App state synchronization key for WhatsApp's app state protocol. */
|
|
110
|
+
export interface AppStateSyncKey {
|
|
111
|
+
key_data: Uint8Array;
|
|
112
|
+
fingerprint: Uint8Array;
|
|
113
|
+
timestamp: number | string;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface ArchiveUpdate {
|
|
117
|
+
/** The chat being archived or unarchived. */
|
|
118
|
+
jid: Jid;
|
|
119
|
+
timestamp: number;
|
|
120
|
+
action: ArchiveChatAction;
|
|
121
|
+
from_full_sync: boolean;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** How a [`MessageBatch`] was delivered. This describes the delivery shape, not a message's provenance: whether a stanza came from the offline queue is `info.is_offline` on each [`InboundMessage`]. */
|
|
125
|
+
export type BatchOrigin = "Live" | "OfflineDrain";
|
|
126
|
+
|
|
127
|
+
/** Action to perform on a blocklist entry. */
|
|
128
|
+
export type BlocklistAction = "block" | "unblock";
|
|
129
|
+
|
|
130
|
+
export type BotEditType = "first" | "inner" | "last";
|
|
131
|
+
|
|
132
|
+
export type BusinessHourMode = "open_24h" | "specific_hours" | "appointment_only" | string;
|
|
133
|
+
|
|
134
|
+
/** Parsed `<notification type="business">` stanza. */
|
|
135
|
+
export interface BusinessNotification {
|
|
136
|
+
from: Jid;
|
|
137
|
+
stanza_id: string;
|
|
138
|
+
timestamp: number | string;
|
|
139
|
+
notification_type: BusinessNotificationType;
|
|
140
|
+
jid?: Jid | null;
|
|
141
|
+
hash?: string | null;
|
|
142
|
+
verified_name?: VerifiedName | null;
|
|
143
|
+
product_ids: string[];
|
|
144
|
+
collection_ids: string[];
|
|
145
|
+
subscriptions: BusinessSubscription[];
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** Business notification type based on child element. */
|
|
149
|
+
export type BusinessNotificationType = "remove_jid" | "remove_hash" | "verified_name_jid" | "verified_name_hash" | "profile" | "profile_hash" | "product" | "collection" | "subscriptions" | "unknown";
|
|
150
|
+
|
|
151
|
+
/** Business status update notification. */
|
|
152
|
+
export interface BusinessStatusUpdate {
|
|
153
|
+
/** The business account whose status changed. */
|
|
154
|
+
jid: Jid;
|
|
155
|
+
update_type: BusinessUpdateType;
|
|
156
|
+
timestamp: number;
|
|
157
|
+
target_jid?: Jid | null;
|
|
158
|
+
hash?: string | null;
|
|
159
|
+
verified_name?: string | null;
|
|
160
|
+
product_ids: string[];
|
|
161
|
+
collection_ids: string[];
|
|
162
|
+
subscriptions: BusinessSubscription[];
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** Business subscription information (SMB features). */
|
|
166
|
+
export interface BusinessSubscription {
|
|
167
|
+
id: string;
|
|
168
|
+
status: string;
|
|
169
|
+
expiration_date?: number | string | null;
|
|
170
|
+
creation_time?: number | string | null;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** Type of business status update. */
|
|
174
|
+
export type BusinessUpdateType = "removed_as_business" | "verified_name_changed" | "profile_updated" | "products_updated" | "collections_updated" | "subscriptions_updated" | "unknown";
|
|
175
|
+
|
|
176
|
+
/** Minimal cached form of a Noise certificate. Mirrors the JSON shape WA Web persists in `waNoiseInfo.certificateChainBuffer` (only `key` plus the validity window — signatures and issuer_serial are intentionally dropped). */
|
|
177
|
+
export interface CachedNoiseCert {
|
|
178
|
+
/** 32-byte X25519 public key from `NoiseCertificate.Details.key`. */
|
|
179
|
+
key: Uint8Array;
|
|
180
|
+
/** Unix epoch seconds. Validation window from `NoiseCertificate.Details`. */
|
|
181
|
+
not_before: number | string;
|
|
182
|
+
not_after: number | string;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/** Cached form of the server's two-cert chain. `leaf.key` is the server static public key consumed by Noise IK; the intermediate is kept solely to mirror WA Web's expiry checks. */
|
|
186
|
+
export interface CachedServerCertChain {
|
|
187
|
+
intermediate: CachedNoiseCert;
|
|
188
|
+
leaf: CachedNoiseCert;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** Fields kept per-variant (not a shared `BasicCallMeta`) so the `serde` shape mirrors the stanza 1:1 for downstream JS consumers. */
|
|
192
|
+
export type CallAction =
|
|
193
|
+
| { type: "offer"; call_id: string; call_creator: Jid; caller_pn?: Jid | null; caller_country_code?: string | null; device_class?: string | null; joinable: boolean; is_video: boolean; audio: CallAudioCodec[]; group_jid?: Jid | null }
|
|
194
|
+
| { type: "offer_notice"; call_id: string; call_creator: Jid; is_video: boolean; is_group: boolean }
|
|
195
|
+
| { type: "preaccept"; call_id: string; call_creator: Jid; audio: CallAudioCodec[] }
|
|
196
|
+
| { type: "accept"; call_id: string; call_creator: Jid; audio: CallAudioCodec[] }
|
|
197
|
+
| { type: "reject"; call_id: string; call_creator: Jid; reason?: string | null }
|
|
198
|
+
| { type: "terminate"; call_id: string; call_creator: Jid; reason?: string | null; duration?: number | null; audio_duration?: number | null }
|
|
199
|
+
| { type: "transport"; call_id: string; call_creator: Jid; p2p_cand_round?: string | null; transport_message_type?: string | null }
|
|
200
|
+
| { type: "relaylatency"; call_id: string; call_creator: Jid }
|
|
201
|
+
| { type: "video"; call_id: string; call_creator: Jid; state: VideoState; orientation?: number | null; dec?: string | null }
|
|
202
|
+
| { type: "group_update"; update: GroupCallUpdate }
|
|
203
|
+
| { type: "enc_rekey"; rekey: GroupCallEncRekey }
|
|
204
|
+
| { type: "waiting_room_update"; room: WaitingRoom }
|
|
205
|
+
| { type: "user_action"; call_id: string; call_creator: Jid; raised: boolean }
|
|
206
|
+
| { type: "screen_share"; call_id: string; call_creator: Jid; screen_share: ScreenShare };
|
|
207
|
+
|
|
208
|
+
export interface CallAudioCodec {
|
|
209
|
+
enc: string;
|
|
210
|
+
rate: number;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** An incoming call we were ringing for was resolved on ANOTHER of our devices (multi-device): the caller dismissed this device with a `<terminate reason="accepted_elsewhere"|"rejected_elsewhere">`. Distinct from [`MissedCall`] (a genuinely unanswered call) so a consumer can render "answered on another device" instead of a missed call. Mirrors WA Web's AcceptedElsewhere / Rejected outcomes. */
|
|
214
|
+
export interface CallEndedElsewhere {
|
|
215
|
+
from: Jid;
|
|
216
|
+
/** The call id (from the `<offer>` action); distinct from the `<call>` stanza id. */
|
|
217
|
+
call_id: string;
|
|
218
|
+
timestamp: number;
|
|
219
|
+
outcome: ElsewhereOutcome;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/** Result of creating a reusable call link. */
|
|
223
|
+
export interface CallLink {
|
|
224
|
+
token: string;
|
|
225
|
+
media: CallLinkMedia;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/** Admission state returned after joining a reusable call link. */
|
|
229
|
+
export interface CallLinkJoin {
|
|
230
|
+
token: string;
|
|
231
|
+
media: CallLinkMedia;
|
|
232
|
+
call_id: string;
|
|
233
|
+
call_creator: Jid;
|
|
234
|
+
waiting_room_enabled: boolean;
|
|
235
|
+
in_waiting_room: boolean;
|
|
236
|
+
is_admin: boolean;
|
|
237
|
+
waiting_room?: WaitingRoom | null;
|
|
238
|
+
group?: GroupCallUpdate | null;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/** Audio/video mode of a reusable call link. */
|
|
242
|
+
export type CallLinkMedia = "audio" | "video";
|
|
243
|
+
|
|
244
|
+
/** Metadata returned without joining a reusable call link. */
|
|
245
|
+
export interface CallLinkPreview {
|
|
246
|
+
token: string;
|
|
247
|
+
media: CallLinkMedia;
|
|
248
|
+
creator: Jid;
|
|
249
|
+
creator_pn?: Jid | null;
|
|
250
|
+
waiting_room_enabled: boolean;
|
|
251
|
+
is_admin: boolean;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/** Identifies a specific message within a chat. */
|
|
255
|
+
export interface ChatMessageId {
|
|
256
|
+
chat: Jid;
|
|
257
|
+
id: string;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export type ChatPresence = "composing" | "paused";
|
|
261
|
+
|
|
262
|
+
export type ChatPresenceMedia = "" | "audio";
|
|
263
|
+
|
|
264
|
+
export interface ChatPresenceUpdate {
|
|
265
|
+
source: MessageSource;
|
|
266
|
+
state: ChatPresence;
|
|
267
|
+
media: ChatPresenceMedia;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/** Chat state type for typing indicators. */
|
|
271
|
+
export type ChatStateType = "composing" | "recording" | "paused";
|
|
272
|
+
|
|
273
|
+
/** A chat's messages were cleared (kept) on a linked device. */
|
|
274
|
+
export interface ClearChatUpdate {
|
|
275
|
+
/** The chat being cleared. */
|
|
276
|
+
jid: Jid;
|
|
277
|
+
/** From the index, not the proto — ClearChatAction only has messageRange. */
|
|
278
|
+
delete_starred: boolean;
|
|
279
|
+
/** From the index, not the proto. */
|
|
280
|
+
delete_media: boolean;
|
|
281
|
+
timestamp: number;
|
|
282
|
+
action: ClearChatAction;
|
|
283
|
+
from_full_sync: boolean;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
export interface ClientOutdated {
|
|
287
|
+
/** The whole `<failure>` stanza, so no attribute is lost to a log line. */
|
|
288
|
+
raw?: any | null;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
export interface ConnectFailure {
|
|
292
|
+
reason: ConnectFailureReason;
|
|
293
|
+
/** The server's `message` attribute on the `<failure>` stanza, when present. */
|
|
294
|
+
message?: string | null;
|
|
295
|
+
raw?: any | null;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/** Wire codes: 400=Generic, 401=LoggedOut, 402=TempBanned, 403=AccountLocked, 406=UnknownLogout, 405=ClientOutdated, 409=BadUserAgent, 413=CatExpired, 414=CatInvalid, 415=NotFound, 418=ClientUnknown, 500=InternalServerError, 501=Experimental, 503=ServiceUnavailable */
|
|
299
|
+
export type ConnectFailureReason = number;
|
|
300
|
+
|
|
301
|
+
/** A contact changed their phone number. Emitted from `<notification type="contacts"><modify old="..." new="..." old_lid="..." new_lid="..."/>`. The library updates the global LID-PN cache when both `old_lid` and `new_lid` are present, mirroring `WAWebDBCreateLidPnMappings`. No Signal session is wiped (WA Web `WAWebHandleContactNotification` also leaves sessions intact). Group participant updates arrive via separate `w:gp2` notifications, so per-group caches are not touched here. Consumers can subscribe and refresh their own caches if needed. */
|
|
302
|
+
export interface ContactNumberChanged {
|
|
303
|
+
/** Old phone number JID. */
|
|
304
|
+
old_jid: Jid;
|
|
305
|
+
/** New phone number JID. */
|
|
306
|
+
new_jid: Jid;
|
|
307
|
+
/** Old LID (if provided by server). */
|
|
308
|
+
old_lid?: Jid | null;
|
|
309
|
+
/** New LID (if provided by server). */
|
|
310
|
+
new_lid?: Jid | null;
|
|
311
|
+
timestamp: number;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/** Server requests a full contact re-sync. Emitted from `<notification type="contacts"><sync after="..."/>`. */
|
|
315
|
+
export interface ContactSyncRequested {
|
|
316
|
+
after?: number | null;
|
|
317
|
+
timestamp: number;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
export interface ContactUpdate {
|
|
321
|
+
/** The chat/contact this sync action applies to. */
|
|
322
|
+
jid: Jid;
|
|
323
|
+
timestamp: number;
|
|
324
|
+
action: ContactAction;
|
|
325
|
+
from_full_sync: boolean;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/** A contact's profile changed (server notification). Emitted from `<notification type="contacts"><update jid="..."/>`. WA Web resets cached presence and refreshes the profile picture on this event — consumers should invalidate any cached presence/profile data. Not to be confused with [`ContactUpdate`] which comes from app-state sync mutations (different source, different payload). */
|
|
329
|
+
export interface ContactUpdated {
|
|
330
|
+
/** The contact whose profile was updated. */
|
|
331
|
+
jid: Jid;
|
|
332
|
+
timestamp: number;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
export type DayOfWeek = "sun" | "mon" | "tue" | "wed" | "thu" | "fri" | "sat" | string;
|
|
336
|
+
|
|
337
|
+
export type DecryptFailMode = "show" | "hide";
|
|
338
|
+
|
|
339
|
+
export interface DeleteChatUpdate {
|
|
340
|
+
/** The chat being deleted. */
|
|
341
|
+
jid: Jid;
|
|
342
|
+
/** From the index, not the proto — DeleteChatAction only has messageRange. */
|
|
343
|
+
delete_media: boolean;
|
|
344
|
+
timestamp: number;
|
|
345
|
+
action: DeleteChatAction;
|
|
346
|
+
from_full_sync: boolean;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
export interface DeleteMessageForMeUpdate {
|
|
350
|
+
/** The chat containing the deleted message. */
|
|
351
|
+
chat_jid: Jid;
|
|
352
|
+
participant_jid?: Jid | null;
|
|
353
|
+
message_id: string;
|
|
354
|
+
from_me: boolean;
|
|
355
|
+
timestamp: number;
|
|
356
|
+
action: DeleteMessageForMeAction;
|
|
357
|
+
from_full_sync: boolean;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
export interface Device {
|
|
361
|
+
pn?: Jid | null;
|
|
362
|
+
lid?: Jid | null;
|
|
363
|
+
registration_id: number;
|
|
364
|
+
noise_key: KeyPair;
|
|
365
|
+
identity_key: KeyPair;
|
|
366
|
+
signed_pre_key: KeyPair;
|
|
367
|
+
signed_pre_key_id: number;
|
|
368
|
+
signed_pre_key_signature: Uint8Array;
|
|
369
|
+
adv_secret_key: Uint8Array;
|
|
370
|
+
account?: ADVSignedDeviceIdentity | null;
|
|
371
|
+
push_name: string;
|
|
372
|
+
app_version_primary: number;
|
|
373
|
+
app_version_secondary: number;
|
|
374
|
+
app_version_tertiary: number;
|
|
375
|
+
app_version_last_fetched_ms: number | string;
|
|
376
|
+
/** Edge routing info received from server, used for optimized reconnection. When present, this should be sent as a pre-intro before the Noise handshake. */
|
|
377
|
+
edge_routing_info?: Uint8Array | null;
|
|
378
|
+
/** Hash from the last props (A/B experiment config) fetch. Sent on subsequent connects to enable delta updates instead of full fetches. */
|
|
379
|
+
props_hash?: string | null;
|
|
380
|
+
/** Monotonically increasing counter for one-time pre-key ID generation. Matches WhatsApp Web's `NEXT_PK_ID` pattern: only increases, never resets. Advances at GENERATION time (WA Web `savePreKeys`), so it covers every key that exists in the store, uploaded or not. */
|
|
381
|
+
next_pre_key_id: number;
|
|
382
|
+
/** Watermark of the first generated-but-not-yet-uploaded one-time prekey, matching WA Web's `FIRST_UNUPLOAD_PK_ID`. `next_pre_key_id - this` is the pool of leftover keys an upload re-offers before generating new ones. `0` = unset (legacy device); initialised on the first upload. */
|
|
383
|
+
first_unupload_pre_key_id: number;
|
|
384
|
+
/** Persisted flag matching WA Web's `signal_sever_has_pre_keys` metadata. */
|
|
385
|
+
server_has_prekeys: boolean;
|
|
386
|
+
/** NCT salt provisioned by the server via app state sync or history sync. */
|
|
387
|
+
nct_salt?: Uint8Array | null;
|
|
388
|
+
/** Server cert chain cached from the last successful XX (or XX-fallback) handshake. Enables Noise IK on the next connect by exposing `leaf.key` as the server's static public key, and lets us reject stale entries via `not_after` before even attempting IK. `None` forces XX on the next connect. */
|
|
389
|
+
server_cert_chain?: CachedServerCertChain | null;
|
|
390
|
+
/** Login counter sent as `ClientPayload.lc` on every login. WA Web's `WAWebUserPrefsGeneral.getLoginCounter()` reads (and bumps) this from localStorage on each connect; the server uses it as an anti-abuse signal. Persisted so it survives restarts. */
|
|
391
|
+
login_counter: number;
|
|
392
|
+
/** WA Web's `WAIsAccountLidFieldMigrated` pref: whether the account is 1:1-LID-migrated. Set from `ClientPairingProps.isChatDbLidMigrated` at pair time or when the primary pushes migration mappings. Gates outbound DM wire addressing (LID vs PN); the Signal session layer stays LID-first regardless, mirroring WAWebSignalAddress. Once set it never reverts, like the WA Web pref. */
|
|
393
|
+
lid_migrated: boolean;
|
|
394
|
+
/** Wall-clock ms of the last signed-pre-key rotation, driving WA Web's `RotateKeyJob` cadence. Fresh devices baseline off creation; devices persisted before this field existed deserialize to `0`, which the rotation path treats as "seed the baseline, don't rotate yet". */
|
|
395
|
+
last_signed_pre_key_rotation_ms: number | string;
|
|
396
|
+
/** true means the account's `readreceipts` privacy is `none`, so DM read/played receipts go out as `*-self` (which don't notify the sender). Persisted so the value is known on reconnect before the privacy fetch completes; `false` (WA default `all`) sends plain `read`/`played`. */
|
|
397
|
+
read_receipts_disabled: boolean;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/** Device element from notification. Wire format: ```xml <device jid="185169143189667:75@lid" key-index="2" lid="..."/> ``` Device ID is extracted from the JID's device part (e.g., 75 from "user:75@lid"). Per WhatsApp Web: if both `jid` and `lid` attributes are present, the device IDs must match or the notification is rejected. */
|
|
401
|
+
export interface DeviceElement {
|
|
402
|
+
/** Device JID (contains user and device ID) */
|
|
403
|
+
jid: Jid;
|
|
404
|
+
/** Optional key index */
|
|
405
|
+
key_index?: number | null;
|
|
406
|
+
/** Optional LID (device ID must match jid's device ID if present) */
|
|
407
|
+
lid?: Jid | null;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/** Device information for registry tracking. */
|
|
411
|
+
export interface DeviceInfo {
|
|
412
|
+
/** The device ID (0 = primary device, 1+ = companion devices) */
|
|
413
|
+
device_id: number;
|
|
414
|
+
/** The key index, if known */
|
|
415
|
+
key_index?: number | null;
|
|
416
|
+
/** Whether the device uses the hosted PN/LID address space. */
|
|
417
|
+
is_hosted: boolean;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/** Device list record matching WhatsApp Web's DeviceListRecord structure. */
|
|
421
|
+
export interface DeviceListRecord {
|
|
422
|
+
/** The user part of the JID (phone number or LID) */
|
|
423
|
+
user: string;
|
|
424
|
+
/** List of known devices for this user */
|
|
425
|
+
devices: DeviceInfo[];
|
|
426
|
+
/** Timestamp when this record was last updated */
|
|
427
|
+
timestamp: number | string;
|
|
428
|
+
/** Participant hash from usync, if available */
|
|
429
|
+
phash?: string | null;
|
|
430
|
+
/** ADV raw_id from `ADVKeyIndexList` — used to detect identity changes. When this changes, all sessions and sender keys for the user must be cleared. */
|
|
431
|
+
raw_id?: number | null;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/** Device list update notification. Emitted when a user's device list changes (device added/removed/updated). */
|
|
435
|
+
export interface DeviceListUpdate {
|
|
436
|
+
/** The user whose device list changed (from attribute) */
|
|
437
|
+
user: Jid;
|
|
438
|
+
/** Optional LID user (for LID-PN mapping) */
|
|
439
|
+
lid_user?: Jid | null;
|
|
440
|
+
/** Type of update (add/remove/update) */
|
|
441
|
+
update_type: DeviceListUpdateType;
|
|
442
|
+
/** Affected devices with detailed info */
|
|
443
|
+
devices: DeviceNotificationInfo[];
|
|
444
|
+
/** Key index info (for add/remove) */
|
|
445
|
+
key_index?: KeyIndexInfo | null;
|
|
446
|
+
/** Contact hash (for update - used for contact lookup) */
|
|
447
|
+
contact_hash?: string | null;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/** Type of device list update notification. Matches WhatsApp Web's device notification types. */
|
|
451
|
+
export type DeviceListUpdateType = "add" | "remove" | "update";
|
|
452
|
+
|
|
453
|
+
/** Parsed device notification stanza. Wire format: ```xml <notification from="185169143189667@lid" id="..." t="..." type="devices" lid="..."> <remove> <device jid="185169143189667:75@lid"/> <key-index-list ts="1769296600"/> </remove> </notification> ``` Reference: WhatsApp Web `WAWebHandleDeviceNotification` parser (5Yec01dI04o.js:23125-23183) Per WhatsApp Web: Only ONE operation per notification is processed. Priority order: remove > add > update */
|
|
454
|
+
export interface DeviceNotification {
|
|
455
|
+
/** User JID (from attribute) */
|
|
456
|
+
from: Jid;
|
|
457
|
+
/** Optional LID user (for LID-PN mapping learning) */
|
|
458
|
+
lid_user?: Jid | null;
|
|
459
|
+
/** Stanza ID (for ACK) */
|
|
460
|
+
stanza_id: string;
|
|
461
|
+
/** Timestamp */
|
|
462
|
+
timestamp: number | string;
|
|
463
|
+
/** The operation (one per notification, priority: remove > add > update) */
|
|
464
|
+
operation: DeviceOperation;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/** Device information from notification. */
|
|
468
|
+
export interface DeviceNotificationInfo {
|
|
469
|
+
/** Device ID (extracted from JID) */
|
|
470
|
+
device_id: number;
|
|
471
|
+
/** Optional key index */
|
|
472
|
+
key_index?: number | null;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
/** Device notification operation type. Wire format: Child element tag of `<notification type="devices">` - `<add>` - Device was added - `<remove>` - Device was removed - `<update>` - Device info updated (hash-based lookup) */
|
|
476
|
+
export type DeviceNotificationType = "add" | "remove" | "update";
|
|
477
|
+
|
|
478
|
+
/** Operation content (add/remove/update child element). Wire format per WhatsApp Web (5Yec01dI04o.js:23141-23180): ```xml <add> <device jid="user:75@lid" key-index="2"/> <key-index-list ts="...">SIGNED_BYTES</key-index-list> </add> <!-- OR --> <remove> <device jid="user:75@lid"/> <key-index-list ts="..."/> <!-- ts required for remove --> </remove> <!-- OR --> <update hash="CONTACT_HASH"/> ``` Note: WhatsApp Web does NOT read any attributes from add/remove nodes. The `device_hash` attribute (if present) is not used by the official client. */
|
|
479
|
+
export interface DeviceOperation {
|
|
480
|
+
/** Operation type (add/remove/update) */
|
|
481
|
+
operation_type: DeviceNotificationType;
|
|
482
|
+
/** Contact hash (for update only) - from `hash` attribute, used for contact lookup */
|
|
483
|
+
contact_hash?: string | null;
|
|
484
|
+
/** Device elements (for add/remove, single device per WhatsApp Web) */
|
|
485
|
+
devices: DeviceElement[];
|
|
486
|
+
/** Key index info (required for add/remove per WhatsApp Web) */
|
|
487
|
+
key_index?: KeyIndexInfo | null;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
export interface DeviceSentMeta {
|
|
491
|
+
destination_jid: string;
|
|
492
|
+
phash: string;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
/** A valid `<ib><dirty>` marker received from the server. The client still performs its built-in clean/resync work; this event lets consumers refresh domain-specific derived state without observing every raw stanza. */
|
|
496
|
+
export interface DirtyState {
|
|
497
|
+
dirty_type: DirtyType;
|
|
498
|
+
timestamp?: number | string | null;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
export type DirtyType = "account_sync" | "groups" | "syncd_app_state" | "newsletter_metadata" | string;
|
|
502
|
+
|
|
503
|
+
export type DisallowedListAction = "add" | "remove";
|
|
504
|
+
|
|
505
|
+
/** A contact's default disappearing messages setting changed. Sent by the server as `<notification type="disappearing_mode">`. WA Web: `WAWebHandleDisappearingModeNotification` → `WAWebUpdateDisappearingModeForContact`. */
|
|
506
|
+
export interface DisappearingModeChanged {
|
|
507
|
+
/** The contact whose setting changed. */
|
|
508
|
+
from: Jid;
|
|
509
|
+
/** New duration in seconds (0 = disabled, 86400 = 24h, etc.). */
|
|
510
|
+
duration: number;
|
|
511
|
+
/** When the setting was changed. Consumers should only apply this if it's newer than their stored value. */
|
|
512
|
+
setting_timestamp: number;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/** Why the transport connection ended. Lets a benign server-initiated stream recycle (a clean Close frame) be told apart from an abrupt EOF or a real read error when diagnosing reconnect behavior. Serialize: carried by `events::Disconnected`, whose payload consumers forward as JSON (webhooks, dashboards) — snake_case so the wire shape doesn't leak Rust variant naming. */
|
|
516
|
+
export type DisconnectReason =
|
|
517
|
+
| { "server_close": { code?: number | null; reason: string } }
|
|
518
|
+
| "stream_ended"
|
|
519
|
+
| { "read_error": string }
|
|
520
|
+
| "unknown";
|
|
521
|
+
|
|
522
|
+
export interface Disconnected {
|
|
523
|
+
/** Why the transport ended — lets consumers tell a routine server stream recycle (`reason.is_clean_shutdown()`) from a genuine transport failure without parsing logs. */
|
|
524
|
+
reason: DisconnectReason;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
export type EditAttribute = "" | "1" | "2" | "3" | "7" | "8" | string;
|
|
528
|
+
|
|
529
|
+
/** Which terminal outcome another of our devices reached for a call we were ringing for. */
|
|
530
|
+
export type ElsewhereOutcome = "accepted" | "rejected";
|
|
531
|
+
|
|
532
|
+
/** Review state for an appeal on a suspended group. */
|
|
533
|
+
export type GroupAppealStatus = "approved" | "in_review" | "none" | "rejected";
|
|
534
|
+
|
|
535
|
+
/** One device in an authoritative group-call roster. */
|
|
536
|
+
export interface GroupCallDevice {
|
|
537
|
+
jid: Jid;
|
|
538
|
+
platform?: string | null;
|
|
539
|
+
pid?: number | null;
|
|
540
|
+
capability_version?: number | null;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
/** One encrypted keygen-v2 epoch delivered to a participant device. */
|
|
544
|
+
export interface GroupCallEncRekey {
|
|
545
|
+
call_id: string;
|
|
546
|
+
call_creator: Jid;
|
|
547
|
+
transaction_id: number;
|
|
548
|
+
key_generation: number;
|
|
549
|
+
encryption_type: string;
|
|
550
|
+
encryption_version: number;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/** One user in an authoritative group-call roster. */
|
|
554
|
+
export interface GroupCallParticipant {
|
|
555
|
+
jid: Jid;
|
|
556
|
+
state?: string | null;
|
|
557
|
+
participant_type?: string | null;
|
|
558
|
+
devices: GroupCallDevice[];
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
/** Shared relay allocation embedded in a group snapshot. */
|
|
562
|
+
export interface GroupCallRelay {
|
|
563
|
+
transaction_id?: number | null;
|
|
564
|
+
self_pid?: number | null;
|
|
565
|
+
uuid: string;
|
|
566
|
+
participant_uuid: string;
|
|
567
|
+
attribute_padding: boolean;
|
|
568
|
+
warp_mi_tag_len?: number | null;
|
|
569
|
+
endpoints: GroupCallRelayEndpoint[];
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
/** One address advertised by the shared group relay. */
|
|
573
|
+
export interface GroupCallRelayEndpoint {
|
|
574
|
+
relay_id: number;
|
|
575
|
+
token_id: number;
|
|
576
|
+
auth_token_id: number;
|
|
577
|
+
relay_name: string;
|
|
578
|
+
domain_name?: string | null;
|
|
579
|
+
rtt_ms?: number | null;
|
|
580
|
+
is_fna: boolean;
|
|
581
|
+
ipv4?: string | null;
|
|
582
|
+
port?: number | null;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
/** One transaction-ordered authoritative group-call snapshot. */
|
|
586
|
+
export interface GroupCallUpdate {
|
|
587
|
+
call_id: string;
|
|
588
|
+
call_creator: Jid;
|
|
589
|
+
group_jid?: Jid | null;
|
|
590
|
+
transaction_id: number;
|
|
591
|
+
media: string;
|
|
592
|
+
connected_limit: number;
|
|
593
|
+
joinable: boolean;
|
|
594
|
+
av_upgradable: boolean;
|
|
595
|
+
rekey_requested: boolean;
|
|
596
|
+
participants: GroupCallParticipant[];
|
|
597
|
+
relay?: GroupCallRelay | null;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
/** Delivery state for history shared with a newly joined participant. */
|
|
601
|
+
export type GroupHistorySentState = "HISTORY_NOT_SENT" | "HISTORY_SENT" | "NOTICE_SENT";
|
|
602
|
+
|
|
603
|
+
export interface GroupInfo {
|
|
604
|
+
participants: Jid[];
|
|
605
|
+
addressing_mode: AddressingMode;
|
|
606
|
+
/** Whether this group is a Community Announcement Group (WA Web `isCag`, derived from `default_sub_group`). `None` means the persisted blob predates the field, so the answer is unknown and callers must re-query. */
|
|
607
|
+
is_community_announce?: boolean | null;
|
|
608
|
+
/** Maps a LID user identifier (the `user` part of the LID JID) to the corresponding phone-number JID. This is used for device queries since LID usync requests may not work reliably. */
|
|
609
|
+
lid_to_pn_map: Record<string, Jid>;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
/** All possible group notification action types. Maps 1:1 to `GROUP_NOTIFICATION_TAG` child element tags from WhatsApp Web. The `#[wire = "..."]` attribute is the SINGLE source of truth for each variant's wire tag: the JSON discriminator (via the auto-derived `Serialize`), the parser dispatch (via the auto-generated sibling `GroupNotificationActionTag` enum), and `wire_tag()` / `tag_name()` all read from the same table. */
|
|
613
|
+
export type GroupNotificationAction =
|
|
614
|
+
| { type: "add"; participants: GroupParticipantInfo[]; reason?: string | null }
|
|
615
|
+
| { type: "remove"; participants: GroupParticipantInfo[]; reason?: string | null }
|
|
616
|
+
| { type: "promote"; participants: GroupParticipantInfo[] }
|
|
617
|
+
| { type: "demote"; participants: GroupParticipantInfo[] }
|
|
618
|
+
| { type: "modify"; participants: GroupParticipantInfo[] }
|
|
619
|
+
| { type: "subject"; subject: string; subject_owner?: Jid | null; subject_time?: number | string | null }
|
|
620
|
+
| { type: "description"; id: string; description?: string | null }
|
|
621
|
+
| { type: "locked"; threshold?: string | null }
|
|
622
|
+
| { type: "unlocked" }
|
|
623
|
+
| { type: "announcement" }
|
|
624
|
+
| { type: "not_announcement" }
|
|
625
|
+
| { type: "ephemeral"; expiration: number; trigger?: number | null }
|
|
626
|
+
| { type: "membership_approval_mode"; enabled: boolean }
|
|
627
|
+
| { type: "membership_approval_request"; request_method: MembershipRequestMethod; parent_group_jid?: Jid | null }
|
|
628
|
+
| { type: "created_membership_requests"; request_method: MembershipRequestMethod; parent_group_jid?: Jid | null; requests: GroupParticipantInfo[] }
|
|
629
|
+
| { type: "revoked_membership_requests"; participants: Jid[] }
|
|
630
|
+
| { type: "member_add_mode"; mode: string }
|
|
631
|
+
| { type: "no_frequently_forwarded" }
|
|
632
|
+
| { type: "frequently_forwarded_ok" }
|
|
633
|
+
| { type: "invite"; code: string }
|
|
634
|
+
| { type: "revoke" }
|
|
635
|
+
| { type: "growth_locked"; expiration: number; lock_type: string }
|
|
636
|
+
| { type: "growth_unlocked" }
|
|
637
|
+
| { type: "create" }
|
|
638
|
+
| { type: "delete"; reason?: string | null }
|
|
639
|
+
| { type: "link"; link_type: string }
|
|
640
|
+
| { type: "unlink"; unlink_type: string; unlink_reason?: string | null }
|
|
641
|
+
| { type: "linked_group_promote"; participants: GroupParticipantInfo[] }
|
|
642
|
+
| { type: "linked_group_demote"; participants: GroupParticipantInfo[] }
|
|
643
|
+
| { type: "suspended" }
|
|
644
|
+
| { type: "unsuspended" }
|
|
645
|
+
| { type: "auto_add_disabled" }
|
|
646
|
+
| { type: "is_capi_hosted_group" }
|
|
647
|
+
| { type: "group_safety_check" }
|
|
648
|
+
| { type: "limit_sharing_enabled"; trigger?: number | null }
|
|
649
|
+
| { type: "allow_admin_reports" }
|
|
650
|
+
| { type: "not_allow_admin_reports" }
|
|
651
|
+
| { type: "reports" }
|
|
652
|
+
| { type: "allow_non_admin_sub_group_creation" }
|
|
653
|
+
| { type: "not_allow_non_admin_sub_group_creation" }
|
|
654
|
+
| { type: "created_sub_group_suggestion" }
|
|
655
|
+
| { type: "revoked_sub_group_suggestions" }
|
|
656
|
+
| { type: "change_number"; new_owner?: Jid | null; sub_group_suggestions: Jid[] }
|
|
657
|
+
| { type: string; tag: string };
|
|
658
|
+
|
|
659
|
+
/** Participant info extracted from `<participant>` child elements. Wire format: ```xml <participant jid="..." type="..." lid="..." phone_number="..." username="..." display_name="..." join_time="..."/> ``` `display_name` is the server-rendered label (e.g. `"+55∙∙∙∙∙∙∙∙∙79"` when the requester is not in the participant's contacts). `type` flags admin/superadmin tier; LID-addressed groups also carry `lid` and `username`. WA Web's `WAWebHandleGroupNotification` y() reads all of these into the participant model so the UI can render notifications and patch admin caches without resolving the contact locally. */
|
|
660
|
+
export interface GroupParticipantInfo {
|
|
661
|
+
jid: Jid;
|
|
662
|
+
phone_number?: Jid | null;
|
|
663
|
+
/** Server-provided display label for this participant. Only populated for `<participant>` children inside group notifications; `None` for `<requested_user>` (WA Web doesn't read it there either). */
|
|
664
|
+
display_name?: string | null;
|
|
665
|
+
/** Admin tier. Defaults to `Participant` when the attr is missing. */
|
|
666
|
+
type?: GroupParticipantType | null;
|
|
667
|
+
/** LID JID when this `<participant>` carries a separate `lid` attr. Distinct from `jid` which may already be a LID. */
|
|
668
|
+
lid?: Jid | null;
|
|
669
|
+
/** Username, gated by `WAWebUsernameGatingUtils`. Empty in classic PN-addressed groups. */
|
|
670
|
+
username?: string | null;
|
|
671
|
+
/** Unix seconds since the participant joined the group. Used by admin UI for tenure display. */
|
|
672
|
+
join_time?: number | string | null;
|
|
673
|
+
/** Delivery state for post-join group history. */
|
|
674
|
+
group_history_sent_state?: GroupHistorySentState | null;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
/** Admin tier from `<participant type="...">`. Mirrors `GROUP_PARTICIPANT_TYPES` in `WAWebGroupApiConst`. */
|
|
678
|
+
export type GroupParticipantType = "participant" | "admin" | "superadmin";
|
|
679
|
+
|
|
680
|
+
/** Query request type. */
|
|
681
|
+
export type GroupQueryRequestType = "interactive";
|
|
682
|
+
|
|
683
|
+
/** Group update notification. Emitted for each action in a `<notification type="w:gp2">` stanza. A single notification may produce multiple `GroupUpdate` events (one per action). */
|
|
684
|
+
export interface GroupUpdate {
|
|
685
|
+
/** The group this update applies to */
|
|
686
|
+
group_jid: Jid;
|
|
687
|
+
/** Identifier of the source notification stanza. */
|
|
688
|
+
notification_id?: string | null;
|
|
689
|
+
/** Display name supplied with the source notification. */
|
|
690
|
+
notify?: string | null;
|
|
691
|
+
/** Raw offline-delivery marker supplied with the source notification. */
|
|
692
|
+
offline?: string | null;
|
|
693
|
+
/** Zero-based emitted-action index within the source notification. */
|
|
694
|
+
action_index: number;
|
|
695
|
+
/** The admin/user who triggered the change (`participant` attribute) */
|
|
696
|
+
participant?: Jid | null;
|
|
697
|
+
/** Phone number JID of the participant (for LID-addressed groups) */
|
|
698
|
+
participant_pn?: Jid | null;
|
|
699
|
+
/** Username of the participant, when supplied by the group notification. */
|
|
700
|
+
participant_username?: string | null;
|
|
701
|
+
/** Country code supplied for the participant by the server. */
|
|
702
|
+
participant_country_code?: string | null;
|
|
703
|
+
/** When the change occurred */
|
|
704
|
+
timestamp: number;
|
|
705
|
+
/** Whether the group uses LID addressing mode */
|
|
706
|
+
is_lid_addressing_mode: boolean;
|
|
707
|
+
/** Whether participant identity information was incomplete in the source stanza. */
|
|
708
|
+
has_incomplete_participant_information: boolean;
|
|
709
|
+
/** The specific action */
|
|
710
|
+
action: GroupNotificationAction;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
export type HostType = "primary" | "fallback" | string;
|
|
714
|
+
|
|
715
|
+
/** Identity key changed for a user (e.g., user reinstalled WhatsApp). Emitted after device record cleanup so sessions and sender keys are cleared. */
|
|
716
|
+
export interface IdentityChange {
|
|
717
|
+
/** The user whose identity changed */
|
|
718
|
+
user: Jid;
|
|
719
|
+
/** Optional LID for the user */
|
|
720
|
+
lid_user?: Jid | null;
|
|
721
|
+
/** `true` when detected locally while saving a peer's new identity during decrypt (mirrors WA Web `saveIdentity` -> `handleNewIdentity`), `false` when triggered by the server's `<identity/>` notification. */
|
|
722
|
+
implicit: boolean;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
/** One decrypted inbound message. The same items (and order) back both consumer surfaces: the durability hook's batch and [`Event::Messages`]. */
|
|
726
|
+
export interface InboundMessage {
|
|
727
|
+
message: any;
|
|
728
|
+
info: MessageInfo;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
export interface IncomingCall {
|
|
732
|
+
from: Jid;
|
|
733
|
+
/** Stanza id; distinct from `CallAction::call_id`. */
|
|
734
|
+
stanza_id: string;
|
|
735
|
+
notify?: string | null;
|
|
736
|
+
platform?: string | null;
|
|
737
|
+
version?: string | null;
|
|
738
|
+
/** Companion-routing metadata copied from the outer `<call>` wrapper. */
|
|
739
|
+
participant?: Jid | null;
|
|
740
|
+
/** Companion recipient metadata copied from the outer `<call>` wrapper. */
|
|
741
|
+
recipient?: Jid | null;
|
|
742
|
+
timestamp: number;
|
|
743
|
+
offline: boolean;
|
|
744
|
+
action: CallAction;
|
|
745
|
+
/** Group snapshot embedded in an initial offer or active-call invitation. */
|
|
746
|
+
group?: GroupCallUpdate | null;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
/** IQ request type for WhatsApp protocol queries. */
|
|
750
|
+
export type InfoQueryType = "set" | "get";
|
|
751
|
+
|
|
752
|
+
/** Key index information from `<key-index-list>` element. Wire format: ```xml <!-- For add: has signed bytes content --> <key-index-list ts="1769296600">SIGNED_BYTES</key-index-list> <!-- For remove: empty, ts required --> <key-index-list ts="1769296600"/> ``` Required for add/remove operations per WhatsApp Web. */
|
|
753
|
+
export interface KeyIndexInfo {
|
|
754
|
+
/** Timestamp (required for remove per WhatsApp Web) */
|
|
755
|
+
timestamp: number | string;
|
|
756
|
+
/** Signed key index bytes (only present for add) */
|
|
757
|
+
signed_bytes?: Uint8Array | null;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
/** A label was associated with or removed from a chat on a linked device. `action.labeled == Some(true)` means the label was added to the chat. */
|
|
761
|
+
export interface LabelAssociationUpdate {
|
|
762
|
+
/** The label identifier. */
|
|
763
|
+
label_id: string;
|
|
764
|
+
/** The chat the label was associated with or removed from. */
|
|
765
|
+
chat_jid: Jid;
|
|
766
|
+
timestamp: number;
|
|
767
|
+
action: LabelAssociationAction;
|
|
768
|
+
from_full_sync: boolean;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
/** A label was created, renamed/recolored, or deleted on a linked device. `action.deleted == Some(true)` means the label was removed. */
|
|
772
|
+
export interface LabelEditUpdate {
|
|
773
|
+
/** The label identifier (the index key, not a JID). */
|
|
774
|
+
label_id: string;
|
|
775
|
+
timestamp: number;
|
|
776
|
+
action: LabelEditAction;
|
|
777
|
+
from_full_sync: boolean;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
/** The source from which a LID-PN mapping was learned. The source is load-bearing, not just provenance: it selects the write policy applied when the pair reaches the cache — see `lid_pn_write_policy` in the `whatsapp-rust` client, which mirrors WhatsApp Web's `createLidPnMappings` `switch (learningSource)`. Directed sources overwrite on any change; observational bulk sources (`Other` and friends, WA Web `"other"`) only seed new LIDs and re-resolve conflicts via a live query; known-stale sources are stamped `created_at = 0` so they never outrank a fresher mapping for the same phone (the PN→LID resolution direction; the LID→PN reverse map always takes the latest write). */
|
|
781
|
+
export type LearningSource = "usync" | "peer_pn_message" | "peer_lid_message" | "recipient_latest_lid" | "migration_sync_latest" | "migration_sync_old" | "blocklist_active" | "blocklist_inactive" | "pairing" | "device_notification" | "other";
|
|
782
|
+
|
|
783
|
+
/** An entry in the LID-PN cache containing the full mapping information. */
|
|
784
|
+
export interface LidPnEntry {
|
|
785
|
+
/** The LID user part (e.g., "100000012345678"). `Arc<str>`: the cache stores each mapping under both directions, so the identifier strings are shared between the entry and the cache keys instead of re-allocated per copy (this cache is unbounded by design). */
|
|
786
|
+
lid: string;
|
|
787
|
+
/** The phone number user part (e.g., "559980000001") */
|
|
788
|
+
phone_number: string;
|
|
789
|
+
/** Unix timestamp when the mapping was first learned */
|
|
790
|
+
created_at: number | string;
|
|
791
|
+
/** The source from which this mapping was learned */
|
|
792
|
+
learning_source: LearningSource;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
/** Entry representing a LID to Phone Number mapping. */
|
|
796
|
+
export interface LidPnMappingEntry {
|
|
797
|
+
/** The LID user part (e.g., "100000012345678") */
|
|
798
|
+
lid: string;
|
|
799
|
+
/** The phone number user part (e.g., "559980000001") */
|
|
800
|
+
phone_number: string;
|
|
801
|
+
/** Unix timestamp when the mapping was first learned */
|
|
802
|
+
created_at: number | string;
|
|
803
|
+
/** Unix timestamp when the mapping was last updated */
|
|
804
|
+
updated_at: number | string;
|
|
805
|
+
/** The source from which this mapping was learned (e.g., "usync", "peer_pn_message") */
|
|
806
|
+
learning_source: string;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
export interface LoggedOut {
|
|
810
|
+
on_connect: boolean;
|
|
811
|
+
reason: ConnectFailureReason;
|
|
812
|
+
/** Server-supplied logout copy, when it sent any. Present in practice on [`ConnectFailureReason::AccountLocked`]. */
|
|
813
|
+
logout_message?: LogoutMessage | null;
|
|
814
|
+
/** The whole stanza that caused the logout, when one did. Two shapes reach here, so dispatch on `raw.tag` rather than assuming one: `<failure>` for a server-side refusal (`on_connect` is then true), and `<stream:error>` for a `<conflict>`, a 516 device removal or a 401. `None` when nothing was received at all — a locally initiated logout has no stanza to report. A forced logout is where the server puts data it will never repeat: an account lock carries a one-time `appeal_token` plus `violation_reason` and `vt`, which WA Web ignores (its own appeal flow is native) but which an embedder cannot recover once the stanza is gone. Parsing policy stays with the consumer — `violation_reason` is not a closed set — but the bytes have to survive the dispatch. */
|
|
815
|
+
raw?: any | null;
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
/** Localized text the server wants shown when it forces a logout, from `logout_message_header` / `logout_message_subtext` on `<failure>`. `locale` is what makes the text safe to render: WA Web (`WAWebHandleFailure`) shows the header/subtext only when the locale equals the client's current one, and otherwise falls back to its own generic copy. It travels with the text so a consumer can apply the same rule. */
|
|
819
|
+
export interface LogoutMessage {
|
|
820
|
+
header?: string | null;
|
|
821
|
+
subtext?: string | null;
|
|
822
|
+
/** e.g. `"pt_BR"`. Compare against the consumer's locale before rendering. */
|
|
823
|
+
locale?: string | null;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
export interface MarkChatAsReadUpdate {
|
|
827
|
+
/** The chat being marked as read or unread. */
|
|
828
|
+
jid: Jid;
|
|
829
|
+
timestamp: number;
|
|
830
|
+
action: MarkChatAsReadAction;
|
|
831
|
+
from_full_sync: boolean;
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
/** Member link mode for group invite links. */
|
|
835
|
+
export type MemberLinkMode = "admin_link" | "all_member_link";
|
|
836
|
+
|
|
837
|
+
/** Who can share message history with new members. */
|
|
838
|
+
export type MemberShareHistoryMode = "admin_share" | "all_member_share";
|
|
839
|
+
|
|
840
|
+
/** How a membership request was initiated. Maps to `WAWebRequestMethodType` in WhatsApp Web JS. */
|
|
841
|
+
export type MembershipRequestMethod = "invite_link" | "linked_group_join" | "non_admin_add";
|
|
842
|
+
|
|
843
|
+
/** Payload of [`Event::Messages`]: the decrypted messages of one durable commit, in arrival order. Behaves as a collection of its messages — `for msg in &batch`, `batch.iter()`, `batch.len()` — with `origin` carrying the delivery shape alongside. */
|
|
844
|
+
export interface MessageBatch {
|
|
845
|
+
messages: InboundMessage[];
|
|
846
|
+
origin: BatchOrigin;
|
|
847
|
+
/** Whether an inbound durability hook already committed these messages before this event was dispatched. Orthogonal to [`origin`](Self::origin), which describes delivery shape: a hook commits live batches and drain batches alike. What this answers is whether the consumer's own durable copy already exists, so a materializer that the hook feeds can skip the batch instead of rewriting every row (and re-firing every invalidation) a second time. `false` for the producers that dispatch `Event::Messages` while deliberately bypassing the commit pipeline — newsletters and PDO-recovered messages — because for those the materialization on this event is the only one there is. */
|
|
848
|
+
hook_committed: boolean;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
export type MessageCategory = "" | "peer" | string;
|
|
852
|
+
|
|
853
|
+
export interface MessageInfo {
|
|
854
|
+
source: MessageSource;
|
|
855
|
+
id: string;
|
|
856
|
+
server_id: number;
|
|
857
|
+
type: string;
|
|
858
|
+
push_name: string;
|
|
859
|
+
timestamp: number;
|
|
860
|
+
category: MessageCategory;
|
|
861
|
+
multicast: boolean;
|
|
862
|
+
media_type: string;
|
|
863
|
+
edit: EditAttribute;
|
|
864
|
+
bot_info?: MsgBotInfo | null;
|
|
865
|
+
meta_info: MsgMetaInfo;
|
|
866
|
+
/** Decoded `<verified_name>` child cert of business senders; the display name is in `.name`. Boxed: most messages carry none. */
|
|
867
|
+
verified_name?: VerifiedName | null;
|
|
868
|
+
device_sent_meta?: DeviceSentMeta | null;
|
|
869
|
+
/** Ephemeral duration in seconds, extracted from `contextInfo.expiration`. */
|
|
870
|
+
ephemeral_expiration?: number | null;
|
|
871
|
+
/** Whether this message was delivered during offline sync. */
|
|
872
|
+
is_offline: boolean;
|
|
873
|
+
/** Set when this message was recovered via PDO rather than normal decryption. Contains the PDO request message ID. */
|
|
874
|
+
unavailable_request_id?: string | null;
|
|
875
|
+
/** Server-store timestamp in microseconds (envelope `sts` attr). Used by WA Web for read-self watermark ordering across companion devices. */
|
|
876
|
+
server_timestamp_us?: number | string | null;
|
|
877
|
+
/** Envelope `verified_level` attr (e.g. "unknown"/"low"/"high"). For business messages this is the server-asserted verification tier; for regular messages it is absent. */
|
|
878
|
+
verified_level?: string | null;
|
|
879
|
+
/** Envelope `verified_name` int attr (business name certificate serial). Separate from the `verified_name` child cert bytes already on this struct. */
|
|
880
|
+
verified_name_serial?: number | string | null;
|
|
881
|
+
/** Envelope `peer_recipient_pn` attr. Present on companion-device self-synced DM stanzas to identify the peer's PN (so the receipt goes to the right routing target). */
|
|
882
|
+
peer_recipient_pn?: Jid | null;
|
|
883
|
+
/** Parent post key when the dispatched message is a decrypted CAG channel comment (`enc_comment_message`). The inner `Message` proto has no slot for the threading link, so it surfaces here. */
|
|
884
|
+
comment_target?: MessageKey | null;
|
|
885
|
+
/** Broadcast-contact-list recipients from `<participants><to jid>` on an incoming broadcast/status stanza. Populated only for broadcasts; used to validate a `deviceSentMessage.phash` (WA Web `validateBclHash`). Empty otherwise. */
|
|
886
|
+
bcl_participants: Jid[];
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
export interface MessageSource {
|
|
890
|
+
chat: Jid;
|
|
891
|
+
sender: Jid;
|
|
892
|
+
is_from_me: boolean;
|
|
893
|
+
is_group: boolean;
|
|
894
|
+
addressing_mode?: AddressingMode | null;
|
|
895
|
+
sender_alt?: Jid | null;
|
|
896
|
+
recipient_alt?: Jid | null;
|
|
897
|
+
broadcast_list_owner?: Jid | null;
|
|
898
|
+
recipient?: Jid | null;
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
/** MEX GraphQL error extensions. */
|
|
902
|
+
export interface MexErrorExtensions {
|
|
903
|
+
error_code?: number | null;
|
|
904
|
+
is_summary?: boolean | null;
|
|
905
|
+
is_retryable?: boolean | null;
|
|
906
|
+
severity?: string | null;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
/** MEX GraphQL error. */
|
|
910
|
+
export interface MexGraphQLError {
|
|
911
|
+
message: string;
|
|
912
|
+
extensions?: MexErrorExtensions | null;
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
/** `payload` shape depends on `op_name`. `offline` mirrors the raw string the server sets when replaying backlog (often a timestamp); presence alone signals backlog vs live. */
|
|
916
|
+
export interface MexNotification {
|
|
917
|
+
op_name: string;
|
|
918
|
+
from?: Jid | null;
|
|
919
|
+
stanza_id?: string | null;
|
|
920
|
+
offline?: string | null;
|
|
921
|
+
payload: Value;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
/** MEX GraphQL response. */
|
|
925
|
+
export interface MexResponse {
|
|
926
|
+
data?: Value | null;
|
|
927
|
+
errors?: MexGraphQLError[] | null;
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
/** A call that must NOT ring: surfaced instead of [`IncomingCall`] so a consumer cannot auto-accept it. Currently this is an offer the server replayed from the offline queue on reconnect (the `<call>` carried the `offline` attribute) -- the call is long dead (no relay, not connectable). Mirrors WA Web's `cancel_call` + `missed_call` path for `offerReceivedWhileOffline`. */
|
|
931
|
+
export interface MissedCall {
|
|
932
|
+
from: Jid;
|
|
933
|
+
/** The call id (from the `<offer>` action); distinct from the `<call>` stanza id. */
|
|
934
|
+
call_id: string;
|
|
935
|
+
timestamp: number;
|
|
936
|
+
reason: MissedReason;
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
/** Why a call surfaced as missed rather than ringing. */
|
|
940
|
+
export type MissedReason = "offline" | "remote";
|
|
941
|
+
|
|
942
|
+
export interface MsgBotInfo {
|
|
943
|
+
edit_type?: BotEditType | null;
|
|
944
|
+
edit_target_id?: string | null;
|
|
945
|
+
edit_sender_timestamp_ms?: number | null;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
export interface MsgMetaInfo {
|
|
949
|
+
target_id?: string | null;
|
|
950
|
+
target_sender?: Jid | null;
|
|
951
|
+
/** `<meta target_chat_jid="…">` — present when the bot reply addresses a chat distinct from the stanza-level `from` (used for msmsg secret lookup; see WA Web `decryptMsmsgBotMessage`). */
|
|
952
|
+
target_chat?: Jid | null;
|
|
953
|
+
deprecated_lid_session?: boolean | null;
|
|
954
|
+
thread_message_id?: string | null;
|
|
955
|
+
thread_message_sender_jid?: Jid | null;
|
|
956
|
+
/** `<meta content_type=...>` attr. Server marks reactions/edits as `"add_on"`; mirrors `WAWebHandleMsgParser` b()'s metadata read. */
|
|
957
|
+
content_type?: string | null;
|
|
958
|
+
/** `<meta appdata=...>` attr. `"default"` is the only observed value. */
|
|
959
|
+
appdata?: string | null;
|
|
960
|
+
/** `<reporting><reporting_tag>` content bytes (16 or 20). Pre-requisite for the server-side report-abuse flow. */
|
|
961
|
+
reporting_tag?: Uint8Array | null;
|
|
962
|
+
/** `<reporting><reporting_token>` content bytes (16). Pre-requisite for the server-side report-abuse flow. */
|
|
963
|
+
reporting_token?: Uint8Array | null;
|
|
964
|
+
/** `v` attr on `<reporting_token>`. WA Web defaults to 1 when missing. */
|
|
965
|
+
reporting_token_version?: number | string | null;
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
/** Message-secret write entry keyed by chat, sender, and message ID. */
|
|
969
|
+
export interface MsgSecretEntry {
|
|
970
|
+
/** Canonical non-AD chat JID. Shared across entries from the same history conversation instead of allocating one identical string per message. */
|
|
971
|
+
chat: string;
|
|
972
|
+
/** Canonical non-AD sender JID. Often aliases `chat` for direct messages. */
|
|
973
|
+
sender: string;
|
|
974
|
+
/** Message identifier. `Arc<str>` keeps entry clones used by buffered persistence cheap without changing the serialized representation. */
|
|
975
|
+
msg_id: string;
|
|
976
|
+
secret: MessageSecret;
|
|
977
|
+
/** Absolute unix-seconds retention deadline. `0` means never expire. Computed by the caller from the parent message's event time plus a per-add-on-kind horizon (see `MsgSecretRetention`). The store prunes rows whose deadline has passed; it does not know the horizon itself. */
|
|
978
|
+
expires_at: number | string;
|
|
979
|
+
/** Parent message event time (unix seconds), or `0` when unknown. Kept so the receive path can enforce the edit-processing window (`editTs < message_ts + window`) the same way WhatsApp Web does. */
|
|
980
|
+
message_ts: number | string;
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
export interface MuteUpdate {
|
|
984
|
+
/** The chat being muted or unmuted. */
|
|
985
|
+
jid: Jid;
|
|
986
|
+
timestamp: number;
|
|
987
|
+
action: MuteAction;
|
|
988
|
+
from_full_sync: boolean;
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
/** Wire codes: 421=StaleGroupAddressingMode, 475=NewChatMessagesCapped, 487=ParsingError, 488=UnrecognizedStanza, 489=UnrecognizedStanzaClass, 490=UnrecognizedStanzaType, 491=InvalidProtobuf, 493=InvalidHostedCompanionStanza, 495=MissingMessageSecret, 496=SignalErrorOldCounter, 499=MessageDeletedOnPeer, 500=UnhandledError, 550=UnsupportedAdminRevoke, 551=UnsupportedLIDGroup, 552=DBOperationFailed */
|
|
992
|
+
export type NackReason = number;
|
|
993
|
+
|
|
994
|
+
/** A newsletter live update notification, typically containing updated reaction counts for one or more messages. */
|
|
995
|
+
export interface NewsletterLiveUpdate {
|
|
996
|
+
/** The newsletter channel this update belongs to. */
|
|
997
|
+
newsletter_jid: Jid;
|
|
998
|
+
messages: NewsletterLiveUpdateMessage[];
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
/** A single message entry in a newsletter live update. */
|
|
1002
|
+
export interface NewsletterLiveUpdateMessage {
|
|
1003
|
+
server_id: number | string;
|
|
1004
|
+
reactions: NewsletterLiveUpdateReaction[];
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
/** A reaction count in a newsletter live update. */
|
|
1008
|
+
export interface NewsletterLiveUpdateReaction {
|
|
1009
|
+
code: string;
|
|
1010
|
+
count: number | string;
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
export type NewsletterMessageType = "text" | "media" | "reaction" | "revoke" | "poll_creation" | "poll_vote" | "edit" | string;
|
|
1014
|
+
|
|
1015
|
+
export interface OfflineSyncCompleted {
|
|
1016
|
+
count: number;
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
/** `total` is authoritative; the per-kind counts need not sum to it. */
|
|
1020
|
+
export interface OfflineSyncPreview {
|
|
1021
|
+
total: number;
|
|
1022
|
+
app_data_changes: number;
|
|
1023
|
+
messages: number;
|
|
1024
|
+
notifications: number;
|
|
1025
|
+
receipts: number;
|
|
1026
|
+
calls: number;
|
|
1027
|
+
statuses: number;
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
/** How the server refused a pair-code request, as a matchable status. The five named variants are the complete set WA Web's own response parser accepts (`WASmaxInMdIqMixinErrors.parseIqMixinErrors`, reached from `WASmaxInMdCompanionHelloResponseError`); anything else makes its RPC throw "unknown error". They exist so a consumer can branch on the refusal instead of matching the formatted message, which is not a stable surface. Both stages report through this, though they were read off `companion_hello` and the `companion_finish` parser is narrower — `WASmaxInMdCompanionFinishErrors` admits only `bad-request` and `internal-server-error`, and WA Web shows its generic failure for anything else. A code outside that pair is still classified here rather than discarded: what a consumer does about a refusal follows from the code, which is one namespace across both requests, and answering "nothing was refused" to a refusal we can read would be worse than naming it. The numbers are the `code` attribute, and each is the enum's whole wire form — [`code()`](Self::code) is what `Serialize` emits and what `From<i32>` reads back. WA Web pairs each code with a literal `text` (`429`/`rate-overlimit`, `452`/`feature-not-available`, …) and rejects a response whose two disagree, so construct these through [`from_server`](Self::from_server) rather than from a code alone: it is the only constructor that sees both attributes, and the only one that can decline to classify. WA Web branches on exactly two of them (`DevicePhoneNumberCodeScreen`, on `CompanionHelloError.type.name`): [`RateOverlimit`](Self::RateOverlimit) becomes "too many attempts, try again later" and [`FeatureNotAvailable`](Self::FeatureNotAvailable) becomes "not available to you yet, link with QR code instead". The rest share a generic "try again or link with the QR code". In every case it resets the linking flow and waits for the person to act — it never retries on its own, and never reads the `backoff` hint, so treat that value as the server's advice rather than a schedule WA Web is known to follow. Wire codes: 400=BadRequest, 403=Forbidden, 429=RateOverlimit, 452=FeatureNotAvailable, 500=InternalServerError */
|
|
1031
|
+
export type PairCodeRejection = number;
|
|
1032
|
+
|
|
1033
|
+
export interface PairError {
|
|
1034
|
+
id: Jid;
|
|
1035
|
+
lid: Jid;
|
|
1036
|
+
business_name: string;
|
|
1037
|
+
platform: string;
|
|
1038
|
+
error: string;
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
/** Payload for [`Event::PairPasskeyConfirmation`]. */
|
|
1042
|
+
export interface PairPasskeyConfirmation {
|
|
1043
|
+
code: string;
|
|
1044
|
+
skip_handoff_ux: boolean;
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
/** Payload for [`Event::PairPasskeyError`]. */
|
|
1048
|
+
export interface PairPasskeyError {
|
|
1049
|
+
error: string;
|
|
1050
|
+
continuation: boolean;
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
/** Payload for [`Event::PairPasskeyRequest`]. */
|
|
1054
|
+
export interface PairPasskeyRequest {
|
|
1055
|
+
/** Verbatim `PublicKeyCredentialRequestOptions` JSON from the server. Pass it straight to a WebAuthn `get` (e.g. Android Credential Manager), or parse it with `whatsapp_rust::passkey::parse_request_options`. */
|
|
1056
|
+
request_options_json: string;
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
export interface PairSuccess {
|
|
1060
|
+
id: Jid;
|
|
1061
|
+
lid: Jid;
|
|
1062
|
+
business_name: string;
|
|
1063
|
+
platform: string;
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
/** Generated pair code for phone number linking. User should enter this code on their phone in WhatsApp > Linked Devices. */
|
|
1067
|
+
export interface PairingCode {
|
|
1068
|
+
/** The 8-character pairing code to display. */
|
|
1069
|
+
code: string;
|
|
1070
|
+
/** Approximate validity duration (~180 seconds). */
|
|
1071
|
+
timeout: number;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
/** A phone-number pair-code flow failed, so no linking will come of it. The counterpart to [`PairingCode`] on the failure path, and the only surface that reports it when pairing is driven by `BotBuilder::with_pair_code` — that request runs in a detached task, so nothing returns its error to the caller. `Client::pair_with_code` dispatches this in addition to returning `Err`, matching how the success path both returns the code and emits [`PairingCode`]. Both of the flow's server round trips report here, and the consumer's move is the same either way — this code is finished, request another or fall back to the QR. The later one arrives after a code was already displayed and entered: the phone answered, but the server refused the key bundle that answer produced. Silence at that stage is not this event, because nothing was refused; it surfaces as [`PairingCodeRefresh`] once the timer runs out. Fires for every failure, including local validation (a phone number that is too short never reaches the server): a consumer waiting on a code needs to learn that it is not coming, whatever the reason. [`rejection`](Self::rejection) is what distinguishes the two — `None` means the request never got an answer from the server. A claim the failed request itself took is released before this fires, so nothing is left holding the flow and `pair_with_code` can be called again. Two failures do **not** arrive here, because for them a code may still be on its way and this event would say the opposite — a consumer acting on it would tear down a code that is about to arrive: - `CodeAlreadyOutstanding` — refused precisely because an earlier code is still live, and the consumer already has it from the [`PairingCode`] that minted it. Retrying is futile until `cancel_pair_code` runs or the window closes. - `Cancelled` — the caller withdrew this request, and a replacement may already own the slot. A superseded request can return this *after* its replacement started, so the event would be uncorrelated with the flow that is actually running. Both follow from something the caller did, so neither is news, and a direct caller still gets the `Err`. Whether to retry at all is the point of the fields: back off on [`PairCodeRejection::is_throttled`](crate::pair_code::PairCodeRejection::is_throttled), stop on [`PairCodeRejection::FeatureNotAvailable`](crate::pair_code::PairCodeRejection::FeatureNotAvailable). */
|
|
1075
|
+
export interface PairingCodeError {
|
|
1076
|
+
/** The server's refusal, when it answered with one. `None` when the failure was local (validation, no connection) or the request went unanswered (timeout) — nothing was refused, so there is no status to report. */
|
|
1077
|
+
rejection?: PairCodeRejection | null;
|
|
1078
|
+
/** How long the server asked the client to wait, from the `backoff` attribute. Usually absent — WA Web does not read it on this path — but when present it is the server naming its own retry delay, which beats any interval the consumer would pick. */
|
|
1079
|
+
backoff?: number | null;
|
|
1080
|
+
/** The failure rendered for logs. Do not branch on it; use [`rejection`](Self::rejection). */
|
|
1081
|
+
error: string;
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
/** The in-progress phone-number pairing code should be replaced. Emitted for the two cases WA Web regenerates on (`Alt/DeviceLinkingApi.js` + `Link/DevicePhoneNumberCodeScreen.react.js`): the server asking for it (`refreshAltLinkingCode` / `forceManualRefresh`, ref-gated against the outstanding flow), and a `companion_finish` that went unanswered for a minute — a primary that could not open the key bundle just goes quiet, so silence is the only signal there is. The outstanding flow is cleared before this fires, so the consumer can call `pair_with_code` straight away. The previous code is no longer valid. */
|
|
1085
|
+
export interface PairingCodeRefresh {
|
|
1086
|
+
/** `true` when the server set `force_manual_refresh` — the code must be re-requested explicitly rather than auto-rotated. */
|
|
1087
|
+
force_manual: boolean;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
/** A QR code the consumer renders during multi-device pairing. */
|
|
1091
|
+
export interface PairingQrCode {
|
|
1092
|
+
/** The QR payload to render. */
|
|
1093
|
+
code: string;
|
|
1094
|
+
/** How long this code stays valid before the next one rotates in. */
|
|
1095
|
+
timeout: number;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
/** The server's `<pair-device>` refs are used up: there is no QR left to render until the connection is re-established. WA Web's rotation timer (`Handle/PairDevice.js`) reports `UNPAIRED_IDLE` here and stops — it does not close the socket, because an alt-linking (phone-number) flow may still be riding the same connection. */
|
|
1099
|
+
export interface PairingQrCodesExhausted {
|
|
1100
|
+
/** `true` when the client closed the connection itself, which it only does with no pair-code flow outstanding. `false` means the socket was left up and reconnecting is the consumer's call. */
|
|
1101
|
+
disconnected: boolean;
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
/** Participant type (admin level). */
|
|
1105
|
+
export type ParticipantType = "member" | "admin" | "superadmin";
|
|
1106
|
+
|
|
1107
|
+
export interface PictureUpdate {
|
|
1108
|
+
/** The JID whose picture changed (user or group). */
|
|
1109
|
+
jid: Jid;
|
|
1110
|
+
/** The user who made the change. Present for group picture changes (the admin who changed it). `None` for personal picture updates. */
|
|
1111
|
+
author?: Jid | null;
|
|
1112
|
+
timestamp: number;
|
|
1113
|
+
/** Whether the picture was removed (true) or set/updated (false). */
|
|
1114
|
+
removed: boolean;
|
|
1115
|
+
/** The server-assigned picture ID (from `<set id="..."/>`). `None` for deletions. */
|
|
1116
|
+
picture_id?: string | null;
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
export interface PinUpdate {
|
|
1120
|
+
/** The chat being pinned or unpinned. */
|
|
1121
|
+
jid: Jid;
|
|
1122
|
+
timestamp: number;
|
|
1123
|
+
action: PinAction;
|
|
1124
|
+
from_full_sync: boolean;
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
export type PreKeyFetchReason = "identity" | "retry" | string;
|
|
1128
|
+
|
|
1129
|
+
export type Presence = "available" | "unavailable";
|
|
1130
|
+
|
|
1131
|
+
export interface PresenceUpdate {
|
|
1132
|
+
/** The contact whose presence changed. */
|
|
1133
|
+
from: Jid;
|
|
1134
|
+
unavailable: boolean;
|
|
1135
|
+
last_seen?: number | null;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
export type PrivacyCategory = "last" | "online" | "profile" | "status" | "groupadd" | "readreceipts" | "calladd" | "messages" | "defense" | string;
|
|
1139
|
+
|
|
1140
|
+
export type PrivacySensitiveType = "1";
|
|
1141
|
+
|
|
1142
|
+
export type PrivacyValue = "all" | "contacts" | "none" | "contact_blacklist" | "match_last_seen" | "known" | "off" | "on_standard" | string;
|
|
1143
|
+
|
|
1144
|
+
/** Profile picture type (preview thumbnail or full-size). */
|
|
1145
|
+
export type ProfilePictureType = "preview" | "image";
|
|
1146
|
+
|
|
1147
|
+
export interface PushNameUpdate {
|
|
1148
|
+
/** The contact who changed their push name. */
|
|
1149
|
+
jid: Jid;
|
|
1150
|
+
message: MessageInfo;
|
|
1151
|
+
old_push_name: string;
|
|
1152
|
+
new_push_name: string;
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
export type PushPriority = "high" | "high_force";
|
|
1156
|
+
|
|
1157
|
+
export interface Receipt {
|
|
1158
|
+
source: MessageSource;
|
|
1159
|
+
message_ids: string[];
|
|
1160
|
+
timestamp: number;
|
|
1161
|
+
type: ReceiptType;
|
|
1162
|
+
/** True when the receipt carried the `offline` attribute, i.e. it was drained from the server's offline queue on reconnect rather than delivered live. Mirrors WA Web `incomingMsgReceiptParser` (`offline: maybeAttrString`). */
|
|
1163
|
+
offline: boolean;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
/** Chat state type as received from incoming stanzas. Aligned with WhatsApp Web's `WAChatState` constants: - `typing` = ACTIVE_CHAT_STATE_TYPE.TYPING - `recording_audio` = ACTIVE_CHAT_STATE_TYPE.RECORDING_AUDIO - `idle` = IDLE_CHAT_STATE_TYPE.IDLE */
|
|
1167
|
+
export type ReceivedChatState = "typing" | "recording_audio" | "idle";
|
|
1168
|
+
|
|
1169
|
+
/** Parsed screen-share state for one participant. */
|
|
1170
|
+
export interface ScreenShare {
|
|
1171
|
+
state: ScreenShareState;
|
|
1172
|
+
version: number;
|
|
1173
|
+
screen_share_id?: number | null;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
/** Wire state of a screen-share transition. Wire codes: 1=Started, 2=Stopped */
|
|
1177
|
+
export type ScreenShareState = number;
|
|
1178
|
+
|
|
1179
|
+
export interface SelfPushNameUpdated {
|
|
1180
|
+
from_server: boolean;
|
|
1181
|
+
old_name: string;
|
|
1182
|
+
new_name: string;
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
/** Payload of [`Event::ServerAck`]: the server acknowledged (or nacked) an outgoing stanza. Server acks cover every outgoing stanza class — message, receipt, notification, call — so consumers should filter on [`class`](Self::class) before correlating ids. */
|
|
1186
|
+
export interface ServerAck {
|
|
1187
|
+
/** Id of the acked stanza (for a sent message, its message id). */
|
|
1188
|
+
id: string;
|
|
1189
|
+
/** Stanza class the ack refers to (`"message"`, `"receipt"`, `"notification"`, `"call"`, …). `None` when the server omits it. */
|
|
1190
|
+
class?: string | null;
|
|
1191
|
+
/** Chat/entity the ack refers to, when present and parseable. */
|
|
1192
|
+
from?: Jid | null;
|
|
1193
|
+
/** Server timestamp from the ack's `t` attribute, when present. For a message ack this is the authoritative send timestamp (whatsmeow reads the same attribute into `SendResponse.Timestamp`). */
|
|
1194
|
+
timestamp?: number | null;
|
|
1195
|
+
/** Nack code (e.g. `"479"`) when the server rejected the stanza; `None` for a plain ack. */
|
|
1196
|
+
error?: string | null;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
/** The type of spam flow indicating the source of the report. */
|
|
1200
|
+
export type SpamFlow = "GroupSpamBannerReport" | "GroupInfoReport" | "MessageMenu" | "ContactInfo" | "StatusReport";
|
|
1201
|
+
|
|
1202
|
+
export interface StarUpdate {
|
|
1203
|
+
/** The chat containing the starred or unstarred message. */
|
|
1204
|
+
chat_jid: Jid;
|
|
1205
|
+
/** The participant who sent the message. `Some` for group messages from others, `None` for self-authored or 1-on-1 messages (wire value `"0"`). */
|
|
1206
|
+
participant_jid?: Jid | null;
|
|
1207
|
+
message_id: string;
|
|
1208
|
+
from_me: boolean;
|
|
1209
|
+
timestamp: number;
|
|
1210
|
+
action: StarAction;
|
|
1211
|
+
from_full_sync: boolean;
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
/** Privacy setting sent in the `<meta>` node of the status stanza. Matches WhatsApp Web's `status_setting` attribute. */
|
|
1215
|
+
export type StatusPrivacySetting = "contacts" | "allowlist" | "denylist";
|
|
1216
|
+
|
|
1217
|
+
export interface StreamError {
|
|
1218
|
+
code: string;
|
|
1219
|
+
raw?: any | null;
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
/** Trusted contact privacy token entry. Matches WhatsApp Web's Chat.tcToken / tcTokenTimestamp / tcTokenSenderTimestamp. */
|
|
1223
|
+
export interface TcTokenEntry {
|
|
1224
|
+
/** Raw token bytes received from the server. */
|
|
1225
|
+
token: Uint8Array;
|
|
1226
|
+
/** Unix timestamp (seconds) when the token was received. */
|
|
1227
|
+
token_timestamp: number | string;
|
|
1228
|
+
/** Unix timestamp (seconds) when we last issued our token to this contact. */
|
|
1229
|
+
sender_timestamp?: number | string | null;
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
/** Wire codes: 101=SentToTooManyPeople, 102=BlockedByUsers, 103=CreatedTooManyGroups, 104=SentTooManySameMessage, 106=BroadcastList */
|
|
1233
|
+
export type TempBanReason = number;
|
|
1234
|
+
|
|
1235
|
+
export interface TemporaryBan {
|
|
1236
|
+
code: TempBanReason;
|
|
1237
|
+
/** How long the ban lasts — the wire's `expire` is a duration in seconds, not a deadline (WA Web renders it as "You'll be able to use WhatsApp again in {duration}"). Dispatched only when the server sent an `expire` that fits a `Duration`; a ban stanza missing `code`/`expire`, or carrying one that does not, surfaces as [`Event::ConnectFailure`] instead, the way WA Web rejects it rather than inventing a zero. */
|
|
1238
|
+
expire: number;
|
|
1239
|
+
/** The server's `message` attribute, when present. */
|
|
1240
|
+
message?: string | null;
|
|
1241
|
+
/** Support/appeal link the official UI opens for the ban. */
|
|
1242
|
+
url?: string | null;
|
|
1243
|
+
/** The whole `<failure>` stanza. */
|
|
1244
|
+
raw?: any | null;
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
export type UnavailableType = "unknown" | "view_once" | "hosted" | "bot";
|
|
1248
|
+
|
|
1249
|
+
export interface UndecryptableMessage {
|
|
1250
|
+
info: MessageInfo;
|
|
1251
|
+
is_unavailable: boolean;
|
|
1252
|
+
unavailable_type: UnavailableType;
|
|
1253
|
+
decrypt_fail_mode: DecryptFailMode;
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
export interface UserAboutUpdate {
|
|
1257
|
+
/** The contact whose about text changed. */
|
|
1258
|
+
jid: Jid;
|
|
1259
|
+
status: string;
|
|
1260
|
+
timestamp: number;
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
/** A contact/group/newsletter's status updates were muted/unmuted on a linked device. */
|
|
1264
|
+
export interface UserStatusMuteUpdate {
|
|
1265
|
+
/** The entity whose status was (un)muted. */
|
|
1266
|
+
jid: Jid;
|
|
1267
|
+
/** `true` = status muted, `false` = unmuted. */
|
|
1268
|
+
muted: boolean;
|
|
1269
|
+
timestamp: number;
|
|
1270
|
+
action: UserStatusMuteAction;
|
|
1271
|
+
from_full_sync: boolean;
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
/** Addressing mode used by the contact subprotocol. */
|
|
1275
|
+
export type UsyncAddressingMode = "pn" | "lid";
|
|
1276
|
+
|
|
1277
|
+
export interface UsyncBotCommand {
|
|
1278
|
+
name: string;
|
|
1279
|
+
description: string;
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
export type UsyncBotProfessionalType = "unknown" | "yes" | "no" | string;
|
|
1283
|
+
|
|
1284
|
+
export interface UsyncBotProfileResult {
|
|
1285
|
+
name: string;
|
|
1286
|
+
attributes: string;
|
|
1287
|
+
description: string;
|
|
1288
|
+
category: string;
|
|
1289
|
+
is_default: boolean;
|
|
1290
|
+
prompts: UsyncBotPrompt[];
|
|
1291
|
+
persona_id: string;
|
|
1292
|
+
commands: UsyncBotCommand[];
|
|
1293
|
+
commands_description: string;
|
|
1294
|
+
is_meta_created?: boolean | null;
|
|
1295
|
+
creator_name?: string | null;
|
|
1296
|
+
creator_profile_url?: string | null;
|
|
1297
|
+
posing_as_professional?: UsyncBotProfessionalType | null;
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
export interface UsyncBotPrompt {
|
|
1301
|
+
emoji: string;
|
|
1302
|
+
text: string;
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
export interface UsyncBusinessResult {
|
|
1306
|
+
verified_name?: VerifiedName | null;
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
export interface UsyncContactResult {
|
|
1310
|
+
contact_type: string;
|
|
1311
|
+
username?: string | null;
|
|
1312
|
+
content?: string | null;
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1315
|
+
/** Usync context. */
|
|
1316
|
+
export type UsyncContext = "interactive" | "background" | "message" | "voip";
|
|
1317
|
+
|
|
1318
|
+
export interface UsyncDeviceListResult {
|
|
1319
|
+
hash?: string | null;
|
|
1320
|
+
devices: UsyncDeviceResult[];
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
export interface UsyncDeviceResult {
|
|
1324
|
+
id: number;
|
|
1325
|
+
key_index?: number | null;
|
|
1326
|
+
is_hosted: boolean;
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
/** Per-user cache hints carried by the devices v2 subprotocol. */
|
|
1330
|
+
export interface UsyncDeviceSyncHint {
|
|
1331
|
+
/** Cached device-list hash, if known. */
|
|
1332
|
+
device_hash?: string | null;
|
|
1333
|
+
/** Timestamp associated with the cached hash. */
|
|
1334
|
+
timestamp?: number | string | null;
|
|
1335
|
+
/** Expected timestamp used to detect stale key-index state. */
|
|
1336
|
+
expected_timestamp?: number | string | null;
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
export interface UsyncDevicesResult {
|
|
1340
|
+
device_list?: UsyncDeviceListResult | null;
|
|
1341
|
+
key_index?: UsyncKeyIndexResult | null;
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
export interface UsyncDisappearingModeResult {
|
|
1345
|
+
duration_seconds: number;
|
|
1346
|
+
setting_timestamp: number | string;
|
|
1347
|
+
ephemerality_disabled: boolean;
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
/** Feature names accepted by the USync feature protocol. */
|
|
1351
|
+
export type UsyncFeature = "document" | "encrypt" | "encrypt_blist" | "encrypt_contact" | "encrypt_group_gen2" | "encrypt_image" | "encrypt_location" | "encrypt_url" | "encrypt_v2" | "voip" | "multi_agent";
|
|
1352
|
+
|
|
1353
|
+
export interface UsyncFeatureResult {
|
|
1354
|
+
feature: UsyncFeature;
|
|
1355
|
+
value: string;
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
export interface UsyncKeyIndexResult {
|
|
1359
|
+
timestamp: number | string;
|
|
1360
|
+
signed_key_index_bytes?: Uint8Array | null;
|
|
1361
|
+
expected_timestamp?: number | string | null;
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
/** Usync mode. */
|
|
1365
|
+
export type UsyncMode = "query" | "full" | "delta";
|
|
1366
|
+
|
|
1367
|
+
/** A protocol value or its per-user error. Errors are boxed because they are rare and contain owned strings; this keeps every successful result variant from inheriting their size. */
|
|
1368
|
+
export type UsyncOutcome<T> =
|
|
1369
|
+
| { type: "value"; data: T }
|
|
1370
|
+
| { type: "error"; data: UsyncSubprotocolError };
|
|
1371
|
+
|
|
1372
|
+
/** A known, typed USync subprotocol request. */
|
|
1373
|
+
export type UsyncProtocol =
|
|
1374
|
+
| { type: "contact"; data: { addressing_mode: UsyncAddressingMode } }
|
|
1375
|
+
| { type: "devices" }
|
|
1376
|
+
| { type: "status" }
|
|
1377
|
+
| { type: "text_status" }
|
|
1378
|
+
| { type: "disappearing_mode" }
|
|
1379
|
+
| { type: "business" }
|
|
1380
|
+
| { type: "picture" }
|
|
1381
|
+
| { type: "lid" }
|
|
1382
|
+
| { type: "username" }
|
|
1383
|
+
| { type: "bot" }
|
|
1384
|
+
| { type: "feature"; data: UsyncFeature[] };
|
|
1385
|
+
|
|
1386
|
+
/** Known USync protocol tags from the captured WhatsApp Web client. */
|
|
1387
|
+
export type UsyncProtocolKind = "feature" | "devices" | "contact" | "picture" | "status" | "business" | "disappearing_mode" | "lid" | "bot" | "username" | "text_status";
|
|
1388
|
+
|
|
1389
|
+
/** Sparse per-user result. Large, uncommon payloads are boxed so their layout does not inflate every status/contact/device item in large sync responses. */
|
|
1390
|
+
export type UsyncProtocolResult =
|
|
1391
|
+
| { type: "contact"; data: UsyncOutcome<UsyncContactResult> }
|
|
1392
|
+
| { type: "devices"; data: UsyncOutcome<UsyncDevicesResult> }
|
|
1393
|
+
| { type: "status"; data: UsyncOutcome<UsyncStatusResult> }
|
|
1394
|
+
| { type: "text_status"; data: UsyncOutcome<UsyncTextStatusResult> }
|
|
1395
|
+
| { type: "disappearing_mode"; data: UsyncOutcome<UsyncDisappearingModeResult> }
|
|
1396
|
+
| { type: "business"; data: UsyncOutcome<UsyncBusinessResult> }
|
|
1397
|
+
| { type: "picture"; data: UsyncOutcome<number | string> }
|
|
1398
|
+
| { type: "lid"; data: UsyncOutcome<Jid | null> }
|
|
1399
|
+
| { type: "username"; data: UsyncOutcome<string | null> }
|
|
1400
|
+
| { type: "bot"; data: UsyncOutcome<UsyncBotProfileResult> }
|
|
1401
|
+
| { type: "feature"; data: UsyncOutcome<UsyncFeatureResult[]> };
|
|
1402
|
+
|
|
1403
|
+
/** Result-level state for a single protocol. */
|
|
1404
|
+
export interface UsyncProtocolState {
|
|
1405
|
+
protocol: UsyncProtocolKind;
|
|
1406
|
+
refresh_seconds?: number | null;
|
|
1407
|
+
error?: UsyncSubprotocolError | null;
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
/** A complete typed USync query, validated before it reaches the network. Deserialization always delegates to [`Self::new`], so a serialized input cannot bypass protocol uniqueness or per-user validation. */
|
|
1411
|
+
export interface UsyncQuery {
|
|
1412
|
+
mode: UsyncMode;
|
|
1413
|
+
context: UsyncContext;
|
|
1414
|
+
protocols: UsyncProtocol[];
|
|
1415
|
+
users: UsyncUser[];
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
/** Full neutral response from a typed USync query. Its serialization walks this model by reference; no projection tree is constructed by the core. */
|
|
1419
|
+
export interface UsyncResponse {
|
|
1420
|
+
protocol_states: UsyncProtocolState[];
|
|
1421
|
+
users: UsyncUserResult[];
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
/** About/status payload. WhatsApp Web consumes only `status`, while the optional wire timestamp is retained for callers that need a lossless projection of responses carrying `t`. */
|
|
1425
|
+
export interface UsyncStatusResult {
|
|
1426
|
+
status?: string | null;
|
|
1427
|
+
timestamp?: number | string | null;
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
export interface UsyncSubprotocolError {
|
|
1431
|
+
code?: number | null;
|
|
1432
|
+
text?: string | null;
|
|
1433
|
+
backoff?: number | null;
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1436
|
+
export interface UsyncTextStatusResult {
|
|
1437
|
+
text?: string | null;
|
|
1438
|
+
emoji?: string | null;
|
|
1439
|
+
ephemeral_duration_seconds?: number | null;
|
|
1440
|
+
last_update_time?: string | null;
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
/** A USync user input. Constructors establish an identity and protocol-specific additions use explicit builder methods. Deserialization applies the same phone and JID normalization as those constructors; all invariants are validated when the user becomes part of [`UsyncQuery::new`]. */
|
|
1444
|
+
export interface UsyncUser {
|
|
1445
|
+
id?: Jid | null;
|
|
1446
|
+
pn_jid?: Jid | null;
|
|
1447
|
+
phone?: string | null;
|
|
1448
|
+
known_lid?: Jid | null;
|
|
1449
|
+
device_sync?: UsyncDeviceSyncHint | null;
|
|
1450
|
+
persona_id?: string | null;
|
|
1451
|
+
username?: string | null;
|
|
1452
|
+
username_pin?: string | null;
|
|
1453
|
+
contact_type?: string | null;
|
|
1454
|
+
tc_token?: Uint8Array | null;
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
/** Per-user response. `id` is optional because contact-only results without a JID are accepted by WhatsApp Web. */
|
|
1458
|
+
export interface UsyncUserResult {
|
|
1459
|
+
id?: Jid | null;
|
|
1460
|
+
pn_jid?: Jid | null;
|
|
1461
|
+
protocols: UsyncProtocolResult[];
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
/** Verified name certificate information. */
|
|
1465
|
+
export interface VerifiedName {
|
|
1466
|
+
name?: string | null;
|
|
1467
|
+
serial?: string | null;
|
|
1468
|
+
issuer?: string | null;
|
|
1469
|
+
certificate?: Uint8Array | null;
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1472
|
+
/** In-call `<video state=N>` handshake states (audio→video upgrade, video→audio downgrade). Values verified against WA Web captures relayed by the mock server; unknown future states land in `Unknown` so a new server value degrades to an observable no-op instead of a parse failure. Wire codes: 0=Disabled, 1=Enabled, 2=Paused, 3=UpgradeRequest, 4=UpgradeAccept, 5=UpgradeReject, 6=Stopped, 7=UpgradeRejectByTimeout, 8=UpgradeCancel, 9=UpgradeCancelByTimeout, 10=UnknownPeer, 11=UpgradeRequestV2, 20=Error */
|
|
1473
|
+
export type VideoState = number;
|
|
1474
|
+
|
|
1475
|
+
/** Authoritative waiting-room state for a call-link call. */
|
|
1476
|
+
export interface WaitingRoom {
|
|
1477
|
+
call_id: string;
|
|
1478
|
+
call_creator: Jid;
|
|
1479
|
+
link_token: string;
|
|
1480
|
+
media: CallLinkMedia;
|
|
1481
|
+
enabled: boolean;
|
|
1482
|
+
is_admin: boolean;
|
|
1483
|
+
transaction_id?: number | null;
|
|
1484
|
+
users: WaitingRoomUser[];
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
/** One user in a waiting-room snapshot. */
|
|
1488
|
+
export interface WaitingRoomUser {
|
|
1489
|
+
jid: Jid;
|
|
1490
|
+
pn?: Jid | null;
|
|
1491
|
+
state: string;
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
|
|
1495
|
+
|
|
1496
|
+
export function getWasmAllocationSnapshot(): WasmAllocationSnapshot;
|
|
1497
|
+
|
|
1498
|
+
|
|
1499
|
+
|
|
1500
|
+
export interface ILogger {
|
|
1501
|
+
level: string;
|
|
1502
|
+
trace(obj: object, msg?: string): void;
|
|
1503
|
+
debug(obj: object, msg?: string): void;
|
|
1504
|
+
info(obj: object, msg?: string): void;
|
|
1505
|
+
warn(obj: object, msg?: string): void;
|
|
1506
|
+
error(obj: object, msg?: string): void;
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1509
|
+
|
|
1510
|
+
|
|
1511
|
+
export interface WhatsAppClientConfig {
|
|
1512
|
+
transport: JsTransportCallbacks;
|
|
1513
|
+
httpClient: JsHttpClientConfig;
|
|
1514
|
+
onEvent?: WhatsAppEventHandler;
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
/**
|
|
1518
|
+
* Typed event sink. Message and history-sync events cross the boundary as
|
|
1519
|
+
* protobuf wire bytes only: the host decodes them with its own codec, so the
|
|
1520
|
+
* bridge never materializes an intermediate reflected JS tree (and never
|
|
1521
|
+
* compiles the Rust->JS serializers for those proto graphs). A handler that
|
|
1522
|
+
* omits `onMessageBatch`/`onHistorySyncBatch` has those events dropped with an
|
|
1523
|
+
* error log; every other event kind continues through `onEvent`.
|
|
1524
|
+
*/
|
|
1525
|
+
export interface WhatsAppEventCallbacks {
|
|
1526
|
+
onEvent(event: WhatsAppEvent): void;
|
|
1527
|
+
/**
|
|
1528
|
+
* Protobuf-wire message path. The bridge packs a bounded ordered group of
|
|
1529
|
+
* messages — payloads and metadata alike — into one flat buffer. Decode it
|
|
1530
|
+
* with `decodeMessageWireBatch`.
|
|
1531
|
+
*/
|
|
1532
|
+
onMessageBatch(batch: MessageWireBatch): void;
|
|
1533
|
+
/**
|
|
1534
|
+
* Optional host-interest filter for conversation records. When present, the
|
|
1535
|
+
* bridge still walks every history payload and emits its final metadata, but
|
|
1536
|
+
* materializes conversation wire bytes only for the listed numeric sync
|
|
1537
|
+
* types. Omit it for the backward-compatible "all types" behavior.
|
|
1538
|
+
*/
|
|
1539
|
+
historySyncConversationTypes?: readonly number[];
|
|
1540
|
+
/**
|
|
1541
|
+
* Protobuf-wire history-sync path. Conversation entries cross as wire bytes
|
|
1542
|
+
* and the non-conversation remainder (pushnames, mappings, settings, ...)
|
|
1543
|
+
* crosses as one encoded `proto.HistorySync` payload in `remainderData`.
|
|
1544
|
+
* Return the number of malformed entries skipped by the host, if any.
|
|
1545
|
+
*/
|
|
1546
|
+
onHistorySyncBatch(batch: HistorySyncWireBatch): number | void;
|
|
1547
|
+
/**
|
|
1548
|
+
* Optional packed receipt path: adjacent `receipt` events coalesce into one
|
|
1549
|
+
* flat buffer (decode with `decodeReceiptWireBatch`) instead of one
|
|
1550
|
+
* reflected object per event. Without it, receipts use `onEvent`.
|
|
1551
|
+
* Decode the batch fully before calling back into the client: the reader
|
|
1552
|
+
* walks the buffer in order and shares cached JID objects across events.
|
|
1553
|
+
*/
|
|
1554
|
+
onReceiptBatch?(batch: ReceiptWireBatch): void;
|
|
1555
|
+
/**
|
|
1556
|
+
* Optional packed server-ack path, analogous to `onReceiptBatch`; decode
|
|
1557
|
+
* with `decodeServerAckWireBatch`. Without it, acks use `onEvent`.
|
|
1558
|
+
*/
|
|
1559
|
+
onServerAckBatch?(batch: ServerAckWireBatch): void;
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
/**
|
|
1563
|
+
* A packed batch is one flat buffer: header, records and string bytes. Decode it
|
|
1564
|
+
* with the matching codec (`decodeMessageWireBatch`, `decodeReceiptWireBatch`,
|
|
1565
|
+
* `decodeServerAckWireBatch`), which reads views over the buffer instead of
|
|
1566
|
+
* copying. The bare typed array crosses rather than a wrapper object: one
|
|
1567
|
+
* message produces three batches, so an object per batch is three constructions
|
|
1568
|
+
* and three property writes of pure overhead.
|
|
1569
|
+
*/
|
|
1570
|
+
export type MessageWireBatch = Uint8Array;
|
|
1571
|
+
export type ReceiptWireBatch = Uint8Array;
|
|
1572
|
+
export type ServerAckWireBatch = Uint8Array;
|
|
1573
|
+
|
|
1574
|
+
export type HistorySyncWireBatch = {
|
|
1575
|
+
/** Concatenated Conversation protobuf payloads for this bounded batch. */
|
|
1576
|
+
conversationData: Uint8Array;
|
|
1577
|
+
/** Start offsets into conversationData, followed by its final byte length. */
|
|
1578
|
+
conversationOffsets: Uint32Array;
|
|
1579
|
+
/**
|
|
1580
|
+
* Encoded `proto.HistorySync` carrying every non-conversation field. Present
|
|
1581
|
+
* only on the final batch of a chunk.
|
|
1582
|
+
*/
|
|
1583
|
+
remainderData?: Uint8Array;
|
|
1584
|
+
syncType: number;
|
|
1585
|
+
chunkOrder?: number;
|
|
1586
|
+
progress?: number;
|
|
1587
|
+
peerDataRequestSessionId?: string;
|
|
1588
|
+
batchIndex: number;
|
|
1589
|
+
isFinalBatch: boolean;
|
|
1590
|
+
};
|
|
1591
|
+
|
|
1592
|
+
/**
|
|
1593
|
+
* Plain functions remain supported for control-plane events (pairing, QR,
|
|
1594
|
+
* connection lifecycle); message and history-sync delivery requires the
|
|
1595
|
+
* callback-object form above.
|
|
1596
|
+
*/
|
|
1597
|
+
export type WhatsAppEventHandler =
|
|
1598
|
+
| ((event: WhatsAppEvent) => void)
|
|
1599
|
+
| WhatsAppEventCallbacks;
|
|
1600
|
+
|
|
1601
|
+
/**
|
|
1602
|
+
* JS storage callbacks for the persistent backend.
|
|
1603
|
+
*
|
|
1604
|
+
* The boundary is a two-level namespaced key/value store: `store` is one of the
|
|
1605
|
+
* fixed STORE_* namespaces (e.g. "session", "msg_secret", "lid_mapping") and
|
|
1606
|
+
* `key` is an opaque, namespace-scoped id; values are raw bytes.
|
|
1607
|
+
*
|
|
1608
|
+
* Only `get`/`set`/`delete` are MANDATORY — a 3-method store keeps working
|
|
1609
|
+
* exactly as before. The remaining methods are OPTIONAL performance/structural
|
|
1610
|
+
* primitives the core feature-detects (by handle presence) and uses when the
|
|
1611
|
+
* host provides them:
|
|
1612
|
+
* - `setMany`/`deleteMany` collapse N per-key FFI crossings into one (this is
|
|
1613
|
+
* what turns a ~20k-secret history-sync write from 20k awaits into a single
|
|
1614
|
+
* batched call).
|
|
1615
|
+
* - `listKeys`/`listEntries` let the core enumerate a namespace directly,
|
|
1616
|
+
* which lets it DROP its hand-maintained meta-index lists (msg_secret_keys,
|
|
1617
|
+
* tc_token_jids, …). A host that cannot enumerate a category (e.g. an
|
|
1618
|
+
* id-addressed external key store) simply omits them; the core then keeps its
|
|
1619
|
+
* self-maintained index for that backend.
|
|
1620
|
+
* - `deletePrefix` accelerates unconditional bulk clears.
|
|
1621
|
+
*
|
|
1622
|
+
* `capabilities` is read ONCE at init. Omit it (or a field) and the core treats
|
|
1623
|
+
* the corresponding primitive as absent. A capability declared `true` MUST have
|
|
1624
|
+
* its method(s) present and working.
|
|
1625
|
+
*/
|
|
1626
|
+
export interface JsStoreCallbacks {
|
|
1627
|
+
/** Read one value by (store, key). Null/undefined if absent. MANDATORY. */
|
|
1628
|
+
get(store: string, key: string): Promise<Uint8Array | null>;
|
|
1629
|
+
/** Write one value by (store, key). MANDATORY. */
|
|
1630
|
+
set(store: string, key: string, value: Uint8Array): Promise<void>;
|
|
1631
|
+
/** Delete one key. No-op if absent. MANDATORY. */
|
|
1632
|
+
delete(store: string, key: string): Promise<void>;
|
|
1633
|
+
|
|
1634
|
+
/**
|
|
1635
|
+
* Write many [key, value] pairs into ONE store in a single call. Entries are
|
|
1636
|
+
* tuples (so keys may contain any character). Best-effort: if the medium has
|
|
1637
|
+
* no cross-key atomicity (file-per-key) it MUST still apply every entry and
|
|
1638
|
+
* fail-fast on error so the core can retry (writes are idempotent by key).
|
|
1639
|
+
* Empty array is a valid no-op.
|
|
1640
|
+
*/
|
|
1641
|
+
setMany?(store: string, entries: [key: string, value: Uint8Array][]): Promise<void>;
|
|
1642
|
+
|
|
1643
|
+
/** Read many keys from ONE store; one entry per FOUND key, any order. */
|
|
1644
|
+
getMany?(store: string, keys: string[]): Promise<[key: string, value: Uint8Array][]>;
|
|
1645
|
+
|
|
1646
|
+
/** Delete many keys from ONE store in a single call. Missing keys ignored. */
|
|
1647
|
+
deleteMany?(store: string, keys: string[]): Promise<void>;
|
|
1648
|
+
|
|
1649
|
+
/** Enumerate live keys in `store` (optionally prefix-filtered). Unordered. */
|
|
1650
|
+
listKeys?(store: string, prefix?: string): Promise<string[]>;
|
|
1651
|
+
|
|
1652
|
+
/**
|
|
1653
|
+
* Like listKeys but returns [key, value] pairs, so the core can inspect the
|
|
1654
|
+
* embedded timestamp prefix for delete-expired sweeps without N follow-up
|
|
1655
|
+
* gets. If absent but listKeys exists, the core falls back to listKeys+getMany.
|
|
1656
|
+
*/
|
|
1657
|
+
listEntries?(store: string, prefix?: string): Promise<[key: string, value: Uint8Array][]>;
|
|
1658
|
+
|
|
1659
|
+
/** Delete every key in `store` starting with `prefix`. Returns count removed. */
|
|
1660
|
+
deletePrefix?(store: string, prefix: string): Promise<number>;
|
|
1661
|
+
|
|
1662
|
+
/** Static capability declaration, read once at init. Omitted => all false. */
|
|
1663
|
+
capabilities?: {
|
|
1664
|
+
/** setMany/getMany/deleteMany are implemented. */
|
|
1665
|
+
batch?: boolean;
|
|
1666
|
+
/** listKeys/listEntries reliably enumerate a namespace. */
|
|
1667
|
+
enumerate?: boolean;
|
|
1668
|
+
/** deletePrefix is implemented. */
|
|
1669
|
+
prefixDelete?: boolean;
|
|
1670
|
+
};
|
|
1671
|
+
|
|
1672
|
+
/** Optional durability barrier (flush pending writes). */
|
|
1673
|
+
flush?(): Promise<void>;
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1676
|
+
/**
|
|
1677
|
+
* Initialize the WASM engine. Call once before creating clients.
|
|
1678
|
+
* @param logger Optional pino-compatible logger.
|
|
1679
|
+
* @param crypto Optional native crypto callbacks — when provided, AES/HMAC
|
|
1680
|
+
* primitives delegate to the host (e.g. `node:crypto`). Falls
|
|
1681
|
+
* back to the Rust-soft implementation if omitted.
|
|
1682
|
+
*/
|
|
1683
|
+
export function initWasmEngine(logger?: any, crypto?: JsCryptoCallbacks): void;
|
|
1684
|
+
|
|
1685
|
+
/**
|
|
1686
|
+
* Create a full WhatsApp client running in WASM.
|
|
1687
|
+
*
|
|
1688
|
+
* @param transport_config WebSocket transport callbacks (connect/send/disconnect)
|
|
1689
|
+
* @param http_config HTTP client callbacks (execute via fetch)
|
|
1690
|
+
* @param on_event Optional typed event sink — receives WhatsApp events in order
|
|
1691
|
+
* @param store Optional JS storage callbacks — if provided, enables persistent storage
|
|
1692
|
+
* @param cache_config Optional cache TTL/capacity and custom store overrides
|
|
1693
|
+
* @param version Optional [major, minor, patch] WhatsApp Web version override
|
|
1694
|
+
* @param wanted_pre_key_count Optional pre-key upload batch size (default 812);
|
|
1695
|
+
* clamped to the protocol-safe range at upload time. Smaller batches reduce
|
|
1696
|
+
* memory pressure on embedded/WASM hosts.
|
|
1697
|
+
*/
|
|
1698
|
+
export function createWhatsAppClient(
|
|
1699
|
+
transport_config: JsTransportCallbacks,
|
|
1700
|
+
http_config: JsHttpClientConfig,
|
|
1701
|
+
on_event?: WhatsAppEventHandler | null,
|
|
1702
|
+
store?: JsStoreCallbacks | null,
|
|
1703
|
+
cache_config?: CacheConfig | null,
|
|
1704
|
+
version?: readonly [number, number, number] | null,
|
|
1705
|
+
wanted_pre_key_count?: number | null,
|
|
1706
|
+
): Promise<WasmWhatsAppClient>;
|
|
1707
|
+
|
|
1708
|
+
/** Cache entry configuration. */
|
|
1709
|
+
export interface CacheEntryConfig {
|
|
1710
|
+
ttlSecs?: number;
|
|
1711
|
+
capacity?: number;
|
|
1712
|
+
store?: JsCacheStore;
|
|
1713
|
+
}
|
|
1714
|
+
|
|
1715
|
+
/** Custom cache backend. */
|
|
1716
|
+
export interface JsCacheStore {
|
|
1717
|
+
get(namespace: string, key: string): Promise<Uint8Array | null>;
|
|
1718
|
+
set(namespace: string, key: string, value: Uint8Array, ttlSecs?: number): Promise<void>;
|
|
1719
|
+
delete(namespace: string, key: string): Promise<void>;
|
|
1720
|
+
clear(namespace: string): Promise<void>;
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
/** Cache configuration — all fields optional. */
|
|
1724
|
+
export interface CacheConfig {
|
|
1725
|
+
store?: JsCacheStore;
|
|
1726
|
+
group?: CacheEntryConfig;
|
|
1727
|
+
device?: CacheEntryConfig;
|
|
1728
|
+
deviceRegistry?: CacheEntryConfig;
|
|
1729
|
+
lidPn?: CacheEntryConfig;
|
|
1730
|
+
retriedGroupMessages?: CacheEntryConfig;
|
|
1731
|
+
recentMessages?: CacheEntryConfig;
|
|
1732
|
+
messageRetry?: CacheEntryConfig;
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
// Augment WasmWhatsAppClient with methods that need skip_typescript
|
|
1736
|
+
// (Record returns can't be expressed by wasm-bindgen)
|
|
1737
|
+
interface WasmWhatsAppClient {
|
|
1738
|
+
/** Fetch all groups the user is participating in. */
|
|
1739
|
+
groupFetchAllParticipating(): Promise<Record<string, GroupMetadataResult>>;
|
|
1740
|
+
/** Fetch all parent groups the user is participating in. */
|
|
1741
|
+
communityFetchAllParticipating(): Promise<Record<string, GroupMetadataResult>>;
|
|
1742
|
+
/** Fetch user info for one or more JIDs. */
|
|
1743
|
+
fetchUserInfo(jids: string[]): Promise<Record<string, UserInfoResult>>;
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
|
|
1747
|
+
/**
|
|
1748
|
+
* A message key for `readMessages`.
|
|
1749
|
+
*/
|
|
1750
|
+
export interface ReadMessageKey {
|
|
1751
|
+
remoteJid: string;
|
|
1752
|
+
id: string;
|
|
1753
|
+
participant?: string;
|
|
1754
|
+
}
|
|
1755
|
+
|
|
1756
|
+
/**
|
|
1757
|
+
* A participant change result from `groupParticipantsUpdate`.
|
|
1758
|
+
*/
|
|
1759
|
+
export interface ParticipantChangeResult {
|
|
1760
|
+
jid: string;
|
|
1761
|
+
status?: string;
|
|
1762
|
+
error?: string;
|
|
1763
|
+
phoneNumber?: string;
|
|
1764
|
+
username?: string;
|
|
1765
|
+
addRequest?: ParticipantAddRequestResult;
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
/**
|
|
1769
|
+
* A single entry from `fetchBlocklist`.
|
|
1770
|
+
*/
|
|
1771
|
+
export interface BlocklistEntryResult {
|
|
1772
|
+
jid: string;
|
|
1773
|
+
timestamp?: number;
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1776
|
+
/**
|
|
1777
|
+
* A single entry from `fetchUserInfo`.
|
|
1778
|
+
*/
|
|
1779
|
+
export interface UserInfoResult {
|
|
1780
|
+
jid: string;
|
|
1781
|
+
lid?: string;
|
|
1782
|
+
status?: string;
|
|
1783
|
+
pictureId?: string;
|
|
1784
|
+
isBusiness: boolean;
|
|
1785
|
+
/**
|
|
1786
|
+
* Verified business name from the usync `<business><verified_name>` cert, if any.
|
|
1787
|
+
*/
|
|
1788
|
+
verifiedName?: string;
|
|
1789
|
+
/**
|
|
1790
|
+
* Device IDs from the usync `<devices>` sublist the same query returns. Empty when
|
|
1791
|
+
* the server returned no device list.
|
|
1792
|
+
*/
|
|
1793
|
+
devices: number[];
|
|
1794
|
+
}
|
|
1795
|
+
|
|
1796
|
+
/**
|
|
1797
|
+
* A single media host from `getMediaConn`.
|
|
1798
|
+
*/
|
|
1799
|
+
export interface MediaHost {
|
|
1800
|
+
hostname: string;
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1803
|
+
/**
|
|
1804
|
+
* A subgroup returned by a parent-group metadata query.
|
|
1805
|
+
*/
|
|
1806
|
+
export interface CommunitySubgroupResult {
|
|
1807
|
+
id: string;
|
|
1808
|
+
subject: string;
|
|
1809
|
+
participantCount?: number;
|
|
1810
|
+
creation?: number;
|
|
1811
|
+
owner?: string;
|
|
1812
|
+
isDefaultSubGroup: boolean;
|
|
1813
|
+
isGeneralChat: boolean;
|
|
1814
|
+
}
|
|
1815
|
+
|
|
1816
|
+
/**
|
|
1817
|
+
* Allocation churn attributed by whatsapp-rust\'s own `AllocMeter` to tasks
|
|
1818
|
+
* spawned for this client. Available in diagnostics builds only.
|
|
1819
|
+
*/
|
|
1820
|
+
export interface CoreAllocationSnapshotResult {
|
|
1821
|
+
enabled: boolean;
|
|
1822
|
+
allocatedBytes: number;
|
|
1823
|
+
freedBytes: number;
|
|
1824
|
+
allocations: number;
|
|
1825
|
+
netBytes: number;
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
/**
|
|
1829
|
+
* Allocation scope active when an allocator call committed more WASM pages.
|
|
1830
|
+
* These are bridge boundaries, not WhatsApp protocol operation names.
|
|
1831
|
+
*/
|
|
1832
|
+
export type AllocationScope = "other" | "coreTask" | "historyDecode" | "historySerialize" | "historyEnvelope" | "historyCallback" | "diagnostics";
|
|
1833
|
+
|
|
1834
|
+
/**
|
|
1835
|
+
* Allocation totals for one tracing callsite emitted by whatsapp-rust itself.
|
|
1836
|
+
* Names and source locations come from `tracing::Metadata`; the bridge does
|
|
1837
|
+
* not maintain a parallel list of core operations.
|
|
1838
|
+
*/
|
|
1839
|
+
export interface CoreSpanAllocationSnapshot {
|
|
1840
|
+
name: string;
|
|
1841
|
+
target: string;
|
|
1842
|
+
sourceFile: string | undefined;
|
|
1843
|
+
sourceLine: number | undefined;
|
|
1844
|
+
allocatedBytes: number;
|
|
1845
|
+
allocations: number;
|
|
1846
|
+
largestAllocationBytes: number;
|
|
1847
|
+
linearGrowthBytes: number;
|
|
1848
|
+
linearGrowthEvents: number;
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
/**
|
|
1852
|
+
* Block/unblock action.
|
|
1853
|
+
*/
|
|
1854
|
+
export type BlockAction = "block" | "unblock";
|
|
1855
|
+
|
|
1856
|
+
/**
|
|
1857
|
+
* Business category info.
|
|
1858
|
+
*/
|
|
1859
|
+
export interface BusinessCategoryResult {
|
|
1860
|
+
id: string;
|
|
1861
|
+
name: string;
|
|
1862
|
+
}
|
|
1863
|
+
|
|
1864
|
+
/**
|
|
1865
|
+
* Business hours config for a day.
|
|
1866
|
+
*/
|
|
1867
|
+
export interface BusinessHoursConfigResult {
|
|
1868
|
+
dayOfWeek: string;
|
|
1869
|
+
mode: string;
|
|
1870
|
+
openTime?: number;
|
|
1871
|
+
closeTime?: number;
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1874
|
+
/**
|
|
1875
|
+
* Business hours.
|
|
1876
|
+
*/
|
|
1877
|
+
export interface BusinessHoursResult {
|
|
1878
|
+
timezone?: string;
|
|
1879
|
+
businessConfig?: BusinessHoursConfigResult[];
|
|
1880
|
+
}
|
|
1881
|
+
|
|
1882
|
+
/**
|
|
1883
|
+
* Chat state (typing indicator).
|
|
1884
|
+
*/
|
|
1885
|
+
export type ChatState = "composing" | "recording" | "paused";
|
|
1886
|
+
|
|
1887
|
+
/**
|
|
1888
|
+
* Counts produced while moving pairwise sessions between identifier namespaces.
|
|
1889
|
+
*/
|
|
1890
|
+
export interface SignalSessionMigrationResult {
|
|
1891
|
+
migrated: number;
|
|
1892
|
+
skipped: number;
|
|
1893
|
+
total: number;
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1896
|
+
/**
|
|
1897
|
+
* Disappearing-message settings returned by the group `<ephemeral>` node.
|
|
1898
|
+
*
|
|
1899
|
+
* The outer `Option` on `GroupMetadataResult::ephemeral` preserves the
|
|
1900
|
+
* distinction between an absent node and a present node whose values are
|
|
1901
|
+
* zero or omitted.
|
|
1902
|
+
*/
|
|
1903
|
+
export interface GroupEphemeralSettingsResult {
|
|
1904
|
+
expiration?: number;
|
|
1905
|
+
trigger?: number;
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1908
|
+
/**
|
|
1909
|
+
* Enabled features in this build.
|
|
1910
|
+
* Use this to check feature availability at runtime before calling feature-gated functions.
|
|
1911
|
+
*/
|
|
1912
|
+
export interface EnabledFeatures {
|
|
1913
|
+
/**
|
|
1914
|
+
* Audio processing support (waveform generation, duration detection)
|
|
1915
|
+
*/
|
|
1916
|
+
audio: boolean;
|
|
1917
|
+
/**
|
|
1918
|
+
* Image processing support (thumbnails, profile pictures, format conversion)
|
|
1919
|
+
*/
|
|
1920
|
+
image: boolean;
|
|
1921
|
+
/**
|
|
1922
|
+
* Sticker metadata support (WebP EXIF for WhatsApp stickers)
|
|
1923
|
+
*/
|
|
1924
|
+
sticker: boolean;
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1927
|
+
/**
|
|
1928
|
+
* Group join request action.
|
|
1929
|
+
*/
|
|
1930
|
+
export type GroupRequestAction = "approve" | "reject";
|
|
1931
|
+
|
|
1932
|
+
/**
|
|
1933
|
+
* Group member add mode.
|
|
1934
|
+
*/
|
|
1935
|
+
export type MemberAddMode = "admin_add" | "all_member_add";
|
|
1936
|
+
|
|
1937
|
+
/**
|
|
1938
|
+
* Group participant action.
|
|
1939
|
+
*/
|
|
1940
|
+
export type GroupParticipantAction = "add" | "remove" | "promote" | "demote" | "modify";
|
|
1941
|
+
|
|
1942
|
+
/**
|
|
1943
|
+
* Group participant info as returned from `getGroupMetadata` / cached group
|
|
1944
|
+
* state. Distinct from `wacore::stanza::groups::GroupParticipantInfo` (the
|
|
1945
|
+
* event-time variant that carries `Jid` objects on the wire); naming it
|
|
1946
|
+
* separately avoids the TypeScript collision that forced consumers to cast.
|
|
1947
|
+
*/
|
|
1948
|
+
export interface GroupMetadataParticipant {
|
|
1949
|
+
jid: string;
|
|
1950
|
+
phoneNumber?: string;
|
|
1951
|
+
/**
|
|
1952
|
+
* LID counterpart when `jid` is a phone-number JID.
|
|
1953
|
+
*/
|
|
1954
|
+
lid?: string;
|
|
1955
|
+
/**
|
|
1956
|
+
* Meta username carried by the participant node, when present.
|
|
1957
|
+
*/
|
|
1958
|
+
username?: string;
|
|
1959
|
+
/**
|
|
1960
|
+
* Protocol role (`member`, `admin`, or `superadmin`).
|
|
1961
|
+
*/
|
|
1962
|
+
participantType: string;
|
|
1963
|
+
isAdmin: boolean;
|
|
1964
|
+
isSuperAdmin: boolean;
|
|
1965
|
+
}
|
|
1966
|
+
|
|
1967
|
+
/**
|
|
1968
|
+
* Group setting type.
|
|
1969
|
+
*/
|
|
1970
|
+
export type GroupSetting = "locked" | "announce" | "membership_approval";
|
|
1971
|
+
|
|
1972
|
+
/**
|
|
1973
|
+
* Inputs required to establish one outgoing pairwise session.
|
|
1974
|
+
*/
|
|
1975
|
+
export interface SignalSessionBundleInput {
|
|
1976
|
+
registrationId: number;
|
|
1977
|
+
identityKey: Uint8Array;
|
|
1978
|
+
signedPreKey: SignalSignedPreKeyInput;
|
|
1979
|
+
preKey?: SignalPreKeyInput;
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1982
|
+
/**
|
|
1983
|
+
* Invite fallback returned for a participant that could not be added directly.
|
|
1984
|
+
*/
|
|
1985
|
+
export interface ParticipantAddRequestResult {
|
|
1986
|
+
code: string;
|
|
1987
|
+
expiration: number;
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1990
|
+
/**
|
|
1991
|
+
* Key of an existing message targeted by `sendReaction` / `sendCommentBytes`.
|
|
1992
|
+
* The chat JID comes from the method\'s `jid` argument; `participant` is the
|
|
1993
|
+
* original sender (required for group/status targets).
|
|
1994
|
+
*/
|
|
1995
|
+
export interface TargetMessageKey {
|
|
1996
|
+
id: string;
|
|
1997
|
+
fromMe?: boolean;
|
|
1998
|
+
participant?: string;
|
|
1999
|
+
}
|
|
2000
|
+
|
|
2001
|
+
/**
|
|
2002
|
+
* Media type for upload/download operations.
|
|
2003
|
+
*/
|
|
2004
|
+
export type MediaType = "image" | "video" | "audio" | "document" | "sticker" | "thumbnail-link" | "md-msg-hist" | "md-app-state" | "product-catalog-image";
|
|
2005
|
+
|
|
2006
|
+
/**
|
|
2007
|
+
* Mirrors `device_props.HistorySyncConfig`. Only fields a consumer would
|
|
2008
|
+
* realistically tune are exposed individually; partial overrides merge into
|
|
2009
|
+
* `wacore::store::default_history_sync_config()` so callers don\'t accidentally
|
|
2010
|
+
* drop the WA-Web-aligned support_* claims by setting just one field.
|
|
2011
|
+
*/
|
|
2012
|
+
export interface DeviceHistorySyncConfig {
|
|
2013
|
+
fullSyncDaysLimit?: number;
|
|
2014
|
+
fullSyncSizeMbLimit?: number;
|
|
2015
|
+
storageQuotaMb?: number;
|
|
2016
|
+
recentSyncDaysLimit?: number;
|
|
2017
|
+
supportCallLogHistory?: boolean;
|
|
2018
|
+
supportGroupHistory?: boolean;
|
|
2019
|
+
onDemandReady?: boolean;
|
|
2020
|
+
thumbnailSyncDaysLimit?: number;
|
|
2021
|
+
initialSyncMaxMessagesPerChat?: number;
|
|
2022
|
+
}
|
|
2023
|
+
|
|
2024
|
+
/**
|
|
2025
|
+
* Mirrors `device_props.PlatformType`. The display value the phone shows in
|
|
2026
|
+
* \"Linked Devices\" — and the type WhatsApp\'s server uses to decide whether
|
|
2027
|
+
* features like view-once are deliverable as payload or as `absent` stub.
|
|
2028
|
+
* Variant names render as `SCREAMING_SNAKE_CASE` in TS to match the proto
|
|
2029
|
+
* enum identifiers callers see in WhatsApp documentation / wire dumps.
|
|
2030
|
+
*/
|
|
2031
|
+
export type DevicePlatformType = "UNKNOWN" | "CHROME" | "FIREFOX" | "IE" | "OPERA" | "SAFARI" | "EDGE" | "DESKTOP" | "IPAD" | "ANDROID_TABLET" | "OHANA" | "ALOHA" | "CATALINA" | "TCL_TV" | "IOS_PHONE" | "IOS_CATALYST" | "ANDROID_PHONE" | "ANDROID_AMBIGUOUS" | "WEAR_OS" | "AR_WRIST" | "AR_DEVICE" | "UWP" | "VR" | "CLOUD_API" | "SMARTGLASSES";
|
|
2032
|
+
|
|
2033
|
+
/**
|
|
2034
|
+
* Neutral controls for retransmitting an existing message to one device.
|
|
2035
|
+
*
|
|
2036
|
+
* The encoded message remains a separate byte slice so this small control
|
|
2037
|
+
* object never base64-encodes or copies the protobuf payload.
|
|
2038
|
+
*/
|
|
2039
|
+
export interface MessageRetransmissionInput {
|
|
2040
|
+
requesterJid: string;
|
|
2041
|
+
messageId: string;
|
|
2042
|
+
retryCount: number;
|
|
2043
|
+
recipientJid?: string;
|
|
2044
|
+
refreshGroupMetadata: boolean;
|
|
2045
|
+
}
|
|
2046
|
+
|
|
2047
|
+
/**
|
|
2048
|
+
* One allocator call that exhausted the current linear-memory capacity.
|
|
2049
|
+
* History counters provide a deterministic progress marker without sampling
|
|
2050
|
+
* wall-clock time or reconstructing any core behavior in the bridge.
|
|
2051
|
+
*/
|
|
2052
|
+
export interface AllocationEventSnapshot {
|
|
2053
|
+
sequence: number;
|
|
2054
|
+
allocationIndex: number;
|
|
2055
|
+
scope: AllocationScope;
|
|
2056
|
+
coreSpan: string | undefined;
|
|
2057
|
+
allocationBytes: number;
|
|
2058
|
+
linearGrowthBytes: number;
|
|
2059
|
+
linearBytesAfter: number;
|
|
2060
|
+
heapLiveBytesAfter: number;
|
|
2061
|
+
historyEvents: number;
|
|
2062
|
+
historyConversations: number;
|
|
2063
|
+
}
|
|
2064
|
+
|
|
2065
|
+
/**
|
|
2066
|
+
* One failed parent/subgroup relationship mutation.
|
|
2067
|
+
*/
|
|
2068
|
+
export interface CommunityLinkFailureResult {
|
|
2069
|
+
jid: string;
|
|
2070
|
+
error: number;
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2073
|
+
/**
|
|
2074
|
+
* One linked-identifier to phone-number mapping supplied by the host.
|
|
2075
|
+
*/
|
|
2076
|
+
export interface LidPnMappingInput {
|
|
2077
|
+
lid: string;
|
|
2078
|
+
pn: string;
|
|
2079
|
+
}
|
|
2080
|
+
|
|
2081
|
+
/**
|
|
2082
|
+
* Optional Noise-payload overrides applied on top of every preset.
|
|
2083
|
+
* Leaving any field `None` preserves wacore\'s default, which matches
|
|
2084
|
+
* WA Web (notably `phoneId` stays unset on the wire).
|
|
2085
|
+
*/
|
|
2086
|
+
export interface ClientProfileOverrides {
|
|
2087
|
+
phoneId?: string | undefined;
|
|
2088
|
+
localeLanguage?: string | undefined;
|
|
2089
|
+
localeCountry?: string | undefined;
|
|
2090
|
+
passiveLogin?: boolean | undefined;
|
|
2091
|
+
}
|
|
2092
|
+
|
|
2093
|
+
/**
|
|
2094
|
+
* Picture type for profile picture URL.
|
|
2095
|
+
*/
|
|
2096
|
+
export type PictureType = "preview" | "image";
|
|
2097
|
+
|
|
2098
|
+
/**
|
|
2099
|
+
* Presence status.
|
|
2100
|
+
*/
|
|
2101
|
+
export type PresenceStatus = "available" | "unavailable";
|
|
2102
|
+
|
|
2103
|
+
/**
|
|
2104
|
+
* Public error shape that crosses the WASM→JS boundary.
|
|
2105
|
+
*
|
|
2106
|
+
* Variants are intentionally flat — no `#[from]` on enum variants, no
|
|
2107
|
+
* `#[serde(flatten)]`. Translation from the core\'s typed errors happens in
|
|
2108
|
+
* `From` impls below by walking the source chain. This keeps the JS object
|
|
2109
|
+
* shape predictable and the codegen / `Tsify` output simple.
|
|
2110
|
+
*/
|
|
2111
|
+
export type BridgeError = { kind: "server"; serverCode: number; serverText: string } | { kind: "timeout" } | { kind: "not-connected" } | { kind: "disconnected"; reason: string } | { kind: "invalid-argument"; field: string; reason: string } | { kind: "protocol-violation"; reason: string } | { kind: "crypto"; operation: string } | { kind: "storage"; operation: string } | { kind: "internal"; message: string };
|
|
2112
|
+
|
|
2113
|
+
/**
|
|
2114
|
+
* Public portion of one pre-key in a supplied pairwise session bundle.
|
|
2115
|
+
*/
|
|
2116
|
+
export interface SignalPreKeyInput {
|
|
2117
|
+
keyId: number;
|
|
2118
|
+
publicKey: Uint8Array;
|
|
2119
|
+
}
|
|
2120
|
+
|
|
2121
|
+
/**
|
|
2122
|
+
* Read-only information from a currently open pairwise session.
|
|
2123
|
+
*/
|
|
2124
|
+
export interface SignalSessionInfoResult {
|
|
2125
|
+
baseKey: Uint8Array;
|
|
2126
|
+
registrationId: number;
|
|
2127
|
+
}
|
|
2128
|
+
|
|
2129
|
+
/**
|
|
2130
|
+
* Result from `createPoll`.
|
|
2131
|
+
*/
|
|
2132
|
+
export interface CreatePollResult {
|
|
2133
|
+
messageId: string;
|
|
2134
|
+
messageSecret: Uint8Array;
|
|
2135
|
+
}
|
|
2136
|
+
|
|
2137
|
+
/**
|
|
2138
|
+
* Result from `encryptMediaStream`.
|
|
2139
|
+
*/
|
|
2140
|
+
export interface EncryptMediaResult {
|
|
2141
|
+
mediaKey: Uint8Array;
|
|
2142
|
+
fileSha256: Uint8Array;
|
|
2143
|
+
fileEncSha256: Uint8Array;
|
|
2144
|
+
fileLength: number;
|
|
2145
|
+
}
|
|
2146
|
+
|
|
2147
|
+
/**
|
|
2148
|
+
* Result from `fetchStatus`.
|
|
2149
|
+
*/
|
|
2150
|
+
export interface FetchStatusResult {
|
|
2151
|
+
jid: string;
|
|
2152
|
+
status?: string;
|
|
2153
|
+
}
|
|
2154
|
+
|
|
2155
|
+
/**
|
|
2156
|
+
* Result from `getBusinessProfile`.
|
|
2157
|
+
*/
|
|
2158
|
+
export interface BusinessProfileResult {
|
|
2159
|
+
wid?: string;
|
|
2160
|
+
description: string;
|
|
2161
|
+
email?: string;
|
|
2162
|
+
website: string[];
|
|
2163
|
+
categories: BusinessCategoryResult[];
|
|
2164
|
+
address?: string;
|
|
2165
|
+
businessHours: BusinessHoursResult;
|
|
2166
|
+
}
|
|
2167
|
+
|
|
2168
|
+
/**
|
|
2169
|
+
* Result from `getGroupMetadata`.
|
|
2170
|
+
*/
|
|
2171
|
+
export interface GroupMetadataResult {
|
|
2172
|
+
id: string;
|
|
2173
|
+
subject: string;
|
|
2174
|
+
notify?: string;
|
|
2175
|
+
participants: GroupMetadataParticipant[];
|
|
2176
|
+
addressingMode: string;
|
|
2177
|
+
creator?: string;
|
|
2178
|
+
creatorPn?: string;
|
|
2179
|
+
creatorUsername?: string;
|
|
2180
|
+
creatorCountryCode?: string;
|
|
2181
|
+
creationTime?: number;
|
|
2182
|
+
subjectTime?: number;
|
|
2183
|
+
subjectOwner?: string;
|
|
2184
|
+
subjectOwnerPn?: string;
|
|
2185
|
+
subjectOwnerUsername?: string;
|
|
2186
|
+
description?: string;
|
|
2187
|
+
descriptionId?: string;
|
|
2188
|
+
descriptionOwner?: string;
|
|
2189
|
+
descriptionOwnerPn?: string;
|
|
2190
|
+
descriptionOwnerUsername?: string;
|
|
2191
|
+
descriptionTime?: number;
|
|
2192
|
+
isLocked: boolean;
|
|
2193
|
+
isAnnouncement: boolean;
|
|
2194
|
+
ephemeral?: GroupEphemeralSettingsResult;
|
|
2195
|
+
membershipApproval: boolean;
|
|
2196
|
+
memberAddMode?: string;
|
|
2197
|
+
memberLinkMode?: string;
|
|
2198
|
+
size?: number;
|
|
2199
|
+
isParentGroup: boolean;
|
|
2200
|
+
parentGroupJid?: string;
|
|
2201
|
+
isDefaultSubGroup: boolean;
|
|
2202
|
+
isGeneralChat: boolean;
|
|
2203
|
+
allowNonAdminSubGroupCreation: boolean;
|
|
2204
|
+
noFrequentlyForwarded: boolean;
|
|
2205
|
+
memberShareHistoryMode?: string;
|
|
2206
|
+
growthLocked?: GroupGrowthLockInfoResult;
|
|
2207
|
+
isSuspended: boolean;
|
|
2208
|
+
allowAdminReports: boolean;
|
|
2209
|
+
isHiddenGroup: boolean;
|
|
2210
|
+
isIncognito: boolean;
|
|
2211
|
+
hasGroupHistory: boolean;
|
|
2212
|
+
isLimitSharingEnabled: boolean;
|
|
2213
|
+
}
|
|
2214
|
+
|
|
2215
|
+
/**
|
|
2216
|
+
* Result from `getMediaConn`.
|
|
2217
|
+
*/
|
|
2218
|
+
export interface MediaConnResult {
|
|
2219
|
+
auth: string;
|
|
2220
|
+
ttl: number;
|
|
2221
|
+
hosts: MediaHost[];
|
|
2222
|
+
}
|
|
2223
|
+
|
|
2224
|
+
/**
|
|
2225
|
+
* Result from `getMemoryDiagnostics`.
|
|
2226
|
+
*/
|
|
2227
|
+
export interface MemoryDiagnosticsResult {
|
|
2228
|
+
groupCache: number;
|
|
2229
|
+
groupCacheBytes: number;
|
|
2230
|
+
deviceRegistryCache: number;
|
|
2231
|
+
deviceRegistryCacheBytes: number;
|
|
2232
|
+
senderKeyDeviceCache: number;
|
|
2233
|
+
senderKeyDeviceCacheBytes: number;
|
|
2234
|
+
groupDevicesMemo: number;
|
|
2235
|
+
groupDevicesMemoBytes: number;
|
|
2236
|
+
lidPnLidEntries: number;
|
|
2237
|
+
lidPnLidBytes: number;
|
|
2238
|
+
lidPnPnEntries: number;
|
|
2239
|
+
lidPnPnBytes: number;
|
|
2240
|
+
recentMessages: number;
|
|
2241
|
+
recentMessagesBytes: number;
|
|
2242
|
+
messageRetryCounts: number;
|
|
2243
|
+
undecryptableDispatched: number;
|
|
2244
|
+
pdoPendingRequests: number;
|
|
2245
|
+
pdoRequested: number;
|
|
2246
|
+
sessionLocks: number;
|
|
2247
|
+
chatLanes: number;
|
|
2248
|
+
groupDistributionLocks: number;
|
|
2249
|
+
groupDistributionLockEvictions: number;
|
|
2250
|
+
groupDistributionLockEvictionBlocks: number;
|
|
2251
|
+
resendRateLimiterChats: number;
|
|
2252
|
+
responseWaiters: number;
|
|
2253
|
+
nodeWaiters: number;
|
|
2254
|
+
pendingRetries: number;
|
|
2255
|
+
presenceSubscriptions: number;
|
|
2256
|
+
appStateKeyRequests: number;
|
|
2257
|
+
appStateSyncing: number;
|
|
2258
|
+
signalCacheSessions: number;
|
|
2259
|
+
signalCacheSessionsBytes: number;
|
|
2260
|
+
signalCacheIdentities: number;
|
|
2261
|
+
signalCacheIdentitiesBytes: number;
|
|
2262
|
+
signalCacheSenderKeys: number;
|
|
2263
|
+
signalCacheSenderKeysBytes: number;
|
|
2264
|
+
historySyncTasks: number;
|
|
2265
|
+
historySyncPayloadBytes: number;
|
|
2266
|
+
historySyncPeakTasks: number;
|
|
2267
|
+
historySyncPeakPayloadBytes: number;
|
|
2268
|
+
chatstateHandlers: number;
|
|
2269
|
+
customEncHandlers: number;
|
|
2270
|
+
clientEstimatedBytes: number;
|
|
2271
|
+
storageMemoryBytes?: number;
|
|
2272
|
+
storagePages?: number;
|
|
2273
|
+
storageIoReadBytes?: number;
|
|
2274
|
+
storageIoWriteBytes?: number;
|
|
2275
|
+
transportReadBufferBytes?: number;
|
|
2276
|
+
transportWriteBufferBytes?: number;
|
|
2277
|
+
transportTlsStateBytes?: number;
|
|
2278
|
+
httpPoolConnections?: number;
|
|
2279
|
+
httpPoolBufferBytes?: number;
|
|
2280
|
+
httpInflightBytes?: number;
|
|
2281
|
+
resourceEstimatedBytes: number;
|
|
2282
|
+
}
|
|
2283
|
+
|
|
2284
|
+
/**
|
|
2285
|
+
* Result from `groupRequestParticipantsList`.
|
|
2286
|
+
*/
|
|
2287
|
+
export interface MembershipRequestResult {
|
|
2288
|
+
jid: string;
|
|
2289
|
+
requestTime?: number;
|
|
2290
|
+
}
|
|
2291
|
+
|
|
2292
|
+
/**
|
|
2293
|
+
* Result from `isOnWhatsApp`.
|
|
2294
|
+
*
|
|
2295
|
+
* Mirrors the core `IsOnWhatsAppResult` so callers get the LID/PN counterpart
|
|
2296
|
+
* and business flag from the same usync round trip — no follow-up
|
|
2297
|
+
* `fetchUserInfo` IQ needed for the common \"check + enrich\" flow.
|
|
2298
|
+
*/
|
|
2299
|
+
export interface IsOnWhatsAppResult {
|
|
2300
|
+
jid: string;
|
|
2301
|
+
isRegistered: boolean;
|
|
2302
|
+
/**
|
|
2303
|
+
* LID counterpart of `jid` when the input was a PN, populated from the
|
|
2304
|
+
* usync `<lid>` attribute (or the local LID/PN cache).
|
|
2305
|
+
*/
|
|
2306
|
+
lid?: string;
|
|
2307
|
+
/**
|
|
2308
|
+
* PN counterpart, set when the server responds with a LID as primary JID.
|
|
2309
|
+
*/
|
|
2310
|
+
pnJid?: string;
|
|
2311
|
+
isBusiness: boolean;
|
|
2312
|
+
/**
|
|
2313
|
+
* Verified business name from the usync `<business><verified_name>` cert, if any.
|
|
2314
|
+
*/
|
|
2315
|
+
verifiedName?: string;
|
|
2316
|
+
}
|
|
2317
|
+
|
|
2318
|
+
/**
|
|
2319
|
+
* Result from `profilePictureUrl`.
|
|
2320
|
+
*/
|
|
2321
|
+
export interface ProfilePictureInfo {
|
|
2322
|
+
id: string;
|
|
2323
|
+
url: string;
|
|
2324
|
+
directPath?: string;
|
|
2325
|
+
hash?: string;
|
|
2326
|
+
}
|
|
2327
|
+
|
|
2328
|
+
/**
|
|
2329
|
+
* Result from `updateProfilePicture` or `removeProfilePicture`.
|
|
2330
|
+
*/
|
|
2331
|
+
export interface ProfilePictureResult {
|
|
2332
|
+
id: string;
|
|
2333
|
+
}
|
|
2334
|
+
|
|
2335
|
+
/**
|
|
2336
|
+
* Result from `uploadMedia`.
|
|
2337
|
+
*/
|
|
2338
|
+
export interface UploadMediaResult {
|
|
2339
|
+
url: string;
|
|
2340
|
+
directPath: string;
|
|
2341
|
+
mediaKey: Uint8Array;
|
|
2342
|
+
fileSha256: Uint8Array;
|
|
2343
|
+
fileEncSha256: Uint8Array;
|
|
2344
|
+
fileLength: number;
|
|
2345
|
+
}
|
|
2346
|
+
|
|
2347
|
+
/**
|
|
2348
|
+
* Result from newsletter methods.
|
|
2349
|
+
*/
|
|
2350
|
+
export interface NewsletterMetadataResult {
|
|
2351
|
+
jid: string;
|
|
2352
|
+
name: string;
|
|
2353
|
+
description?: string;
|
|
2354
|
+
subscriberCount: number;
|
|
2355
|
+
verification: string;
|
|
2356
|
+
state: string;
|
|
2357
|
+
pictureUrl?: string;
|
|
2358
|
+
previewUrl?: string;
|
|
2359
|
+
inviteCode?: string;
|
|
2360
|
+
role?: string;
|
|
2361
|
+
creationTime?: number;
|
|
2362
|
+
}
|
|
2363
|
+
|
|
2364
|
+
/**
|
|
2365
|
+
* Result of linking or unlinking subgroups.
|
|
2366
|
+
*/
|
|
2367
|
+
export interface CommunityLinkResult {
|
|
2368
|
+
succeeded: string[];
|
|
2369
|
+
failed: CommunityLinkFailureResult[];
|
|
2370
|
+
}
|
|
2371
|
+
|
|
2372
|
+
/**
|
|
2373
|
+
* Selects which `ClientProfile` preset to use for the noise-handshake
|
|
2374
|
+
* `ClientPayload.UserAgent`. Independent of `DeviceProps`: `setDeviceProps`
|
|
2375
|
+
* controls the \"Linked Devices\" display on the phone, this controls what
|
|
2376
|
+
* the server sees in the noise layer.
|
|
2377
|
+
*
|
|
2378
|
+
* Use `{ preset: \'android\', osVersion: \'13\' }` to advertise
|
|
2379
|
+
* `UserAgent.platform = ANDROID` with `web_info` omitted.
|
|
2380
|
+
*
|
|
2381
|
+
* Every variant flattens the [`ClientProfileOverrides`] fields, so the
|
|
2382
|
+
* JS literal is flat (e.g. `{ preset: \'web\', phoneId: \'fixed-id\' }`).
|
|
2383
|
+
*/
|
|
2384
|
+
export type ClientProfileInput = ({ preset: "web" } & {} & ClientProfileOverrides) | ({ preset: "android" } & { osVersion: string } & ClientProfileOverrides) | ({ preset: "smbAndroid" } & { osVersion: string } & ClientProfileOverrides) | ({ preset: "ios" } & { osVersion: string } & ClientProfileOverrides) | ({ preset: "macos" } & { osVersion: string } & ClientProfileOverrides) | ({ preset: "windows" } & { osVersion: string } & ClientProfileOverrides);
|
|
2385
|
+
|
|
2386
|
+
/**
|
|
2387
|
+
* Server-managed group growth lock information.
|
|
2388
|
+
*/
|
|
2389
|
+
export interface GroupGrowthLockInfoResult {
|
|
2390
|
+
lockType: string;
|
|
2391
|
+
expiration: number;
|
|
2392
|
+
}
|
|
2393
|
+
|
|
2394
|
+
/**
|
|
2395
|
+
* Signed pre-key in a supplied pairwise session bundle.
|
|
2396
|
+
*/
|
|
2397
|
+
export interface SignalSignedPreKeyInput {
|
|
2398
|
+
keyId: number;
|
|
2399
|
+
publicKey: Uint8Array;
|
|
2400
|
+
signature: Uint8Array;
|
|
2401
|
+
}
|
|
2402
|
+
|
|
2403
|
+
export interface AllocationBucketSnapshot {
|
|
2404
|
+
allocatedBytes: number;
|
|
2405
|
+
allocations: number;
|
|
2406
|
+
largestAllocationBytes: number;
|
|
2407
|
+
/**
|
|
2408
|
+
* WASM pages committed by allocator calls executed in this scope.
|
|
2409
|
+
*/
|
|
2410
|
+
linearGrowthBytes: number;
|
|
2411
|
+
linearGrowthEvents: number;
|
|
2412
|
+
}
|
|
2413
|
+
|
|
2414
|
+
export interface DeviceAppVersion {
|
|
2415
|
+
primary?: number;
|
|
2416
|
+
secondary?: number;
|
|
2417
|
+
tertiary?: number;
|
|
2418
|
+
quaternary?: number;
|
|
2419
|
+
}
|
|
2420
|
+
|
|
2421
|
+
export interface DevicePropsInput {
|
|
2422
|
+
os?: string;
|
|
2423
|
+
platformType?: DevicePlatformType;
|
|
2424
|
+
version?: DeviceAppVersion;
|
|
2425
|
+
historySyncConfig?: DeviceHistorySyncConfig;
|
|
2426
|
+
}
|
|
2427
|
+
|
|
2428
|
+
export interface HistorySyncAllocationSnapshot {
|
|
2429
|
+
events: number;
|
|
2430
|
+
compressedBytes: number;
|
|
2431
|
+
decompressedBytes: number;
|
|
2432
|
+
conversations: number;
|
|
2433
|
+
batches: number;
|
|
2434
|
+
skippedConversations: number;
|
|
2435
|
+
largestCompressedBytes: number;
|
|
2436
|
+
largestDecompressedBytes: number;
|
|
2437
|
+
/**
|
|
2438
|
+
* Compressed history events waiting in the bridge\'s ordered event queue.
|
|
2439
|
+
*/
|
|
2440
|
+
queuedEvents: number;
|
|
2441
|
+
queuedCompressedBytes: number;
|
|
2442
|
+
peakQueuedEvents: number;
|
|
2443
|
+
peakQueuedCompressedBytes: number;
|
|
2444
|
+
/**
|
|
2445
|
+
* Dequeued history events still being decoded or synchronously delivered.
|
|
2446
|
+
*/
|
|
2447
|
+
activeEvents: number;
|
|
2448
|
+
activeCompressedBytes: number;
|
|
2449
|
+
peakActiveEvents: number;
|
|
2450
|
+
peakActiveCompressedBytes: number;
|
|
2451
|
+
/**
|
|
2452
|
+
* Queue plus active bridge ownership. This attributes retention without
|
|
2453
|
+
* guessing from allocator lifetime or duplicating core protocol logic.
|
|
2454
|
+
*/
|
|
2455
|
+
retainedEvents: number;
|
|
2456
|
+
retainedCompressedBytes: number;
|
|
2457
|
+
peakRetainedEvents: number;
|
|
2458
|
+
peakRetainedCompressedBytes: number;
|
|
2459
|
+
}
|
|
2460
|
+
|
|
2461
|
+
export interface HkdfInfo {
|
|
2462
|
+
salt?: Uint8Array | undefined;
|
|
2463
|
+
info?: string | undefined;
|
|
2464
|
+
}
|
|
2465
|
+
|
|
2466
|
+
export interface KeyPair {
|
|
2467
|
+
pubKey: Uint8Array;
|
|
2468
|
+
privKey: Uint8Array;
|
|
2469
|
+
}
|
|
2470
|
+
|
|
2471
|
+
export interface LegacyIndexedSessionV1 {
|
|
2472
|
+
indexKey: Uint8Array;
|
|
2473
|
+
session: LegacySessionV1;
|
|
2474
|
+
}
|
|
2475
|
+
|
|
2476
|
+
export interface LegacySessionChainKeyV1 {
|
|
2477
|
+
counter: number;
|
|
2478
|
+
key?: Uint8Array | undefined;
|
|
2479
|
+
}
|
|
2480
|
+
|
|
2481
|
+
export interface LegacySessionChainV1 {
|
|
2482
|
+
ratchetKey: Uint8Array;
|
|
2483
|
+
role: number;
|
|
2484
|
+
chainKey: LegacySessionChainKeyV1;
|
|
2485
|
+
messageKeys: LegacySessionMessageKeyV1[];
|
|
2486
|
+
}
|
|
2487
|
+
|
|
2488
|
+
export interface LegacySessionIndexV1 {
|
|
2489
|
+
baseKey: Uint8Array;
|
|
2490
|
+
baseKeyRole: number;
|
|
2491
|
+
closedTimestamp: number;
|
|
2492
|
+
usedAtMs: number;
|
|
2493
|
+
createdAtMs: number;
|
|
2494
|
+
remoteIdentityKey: Uint8Array;
|
|
2495
|
+
}
|
|
2496
|
+
|
|
2497
|
+
export interface LegacySessionKeyPairV1 {
|
|
2498
|
+
public: Uint8Array;
|
|
2499
|
+
private: Uint8Array;
|
|
2500
|
+
}
|
|
2501
|
+
|
|
2502
|
+
export interface LegacySessionLocalContext {
|
|
2503
|
+
identityKey: Uint8Array;
|
|
2504
|
+
registrationId: number;
|
|
2505
|
+
}
|
|
2506
|
+
|
|
2507
|
+
export interface LegacySessionMessageKeyV1 {
|
|
2508
|
+
index: number;
|
|
2509
|
+
seed: Uint8Array;
|
|
2510
|
+
}
|
|
2511
|
+
|
|
2512
|
+
export interface LegacySessionPendingPreKeyV1 {
|
|
2513
|
+
preKeyId: number | undefined;
|
|
2514
|
+
signedPreKeyId: number;
|
|
2515
|
+
baseKey: Uint8Array;
|
|
2516
|
+
}
|
|
2517
|
+
|
|
2518
|
+
export interface LegacySessionProjectionIssueV1 {
|
|
2519
|
+
session: number;
|
|
2520
|
+
chain: number | undefined;
|
|
2521
|
+
field: LegacySessionUnrepresentableFieldV1;
|
|
2522
|
+
}
|
|
2523
|
+
|
|
2524
|
+
export interface LegacySessionRatchetV1 {
|
|
2525
|
+
keyPair: LegacySessionKeyPairV1;
|
|
2526
|
+
lastRemoteEphemeralKey: Uint8Array;
|
|
2527
|
+
/**
|
|
2528
|
+
* v1 allows `-1` for a never-used sending chain; the core validates the
|
|
2529
|
+
* `-1..=u32::MAX` range and owns the floor-to-zero translation.
|
|
2530
|
+
*/
|
|
2531
|
+
previousCounter: number;
|
|
2532
|
+
rootKey: Uint8Array;
|
|
2533
|
+
}
|
|
2534
|
+
|
|
2535
|
+
export interface LegacySessionRecordV1 {
|
|
2536
|
+
sessions: LegacyIndexedSessionV1[];
|
|
2537
|
+
}
|
|
2538
|
+
|
|
2539
|
+
export interface LegacySessionV1 {
|
|
2540
|
+
registrationId: number;
|
|
2541
|
+
ratchet: LegacySessionRatchetV1;
|
|
2542
|
+
index: LegacySessionIndexV1;
|
|
2543
|
+
chains: LegacySessionChainV1[];
|
|
2544
|
+
pendingPreKey: LegacySessionPendingPreKeyV1 | undefined;
|
|
2545
|
+
}
|
|
2546
|
+
|
|
2547
|
+
export interface PendingKeyExchangeComponents {
|
|
2548
|
+
sequence: number | undefined;
|
|
2549
|
+
localBaseKey: Uint8Array | undefined;
|
|
2550
|
+
localBaseKeyPrivate: Uint8Array | undefined;
|
|
2551
|
+
localRatchetKey: Uint8Array | undefined;
|
|
2552
|
+
localRatchetKeyPrivate: Uint8Array | undefined;
|
|
2553
|
+
localIdentityKey: Uint8Array | undefined;
|
|
2554
|
+
localIdentityKeyPrivate: Uint8Array | undefined;
|
|
2555
|
+
}
|
|
2556
|
+
|
|
2557
|
+
export interface PendingPreKeyComponents {
|
|
2558
|
+
preKeyId: number | undefined;
|
|
2559
|
+
signedPreKeyId: number | undefined;
|
|
2560
|
+
baseKey: Uint8Array | undefined;
|
|
2561
|
+
kyberPreKeyId: number | undefined;
|
|
2562
|
+
kyberCiphertext: Uint8Array | undefined;
|
|
2563
|
+
}
|
|
2564
|
+
|
|
2565
|
+
export interface ReceiverSessionChainComponents {
|
|
2566
|
+
senderRatchetKey: Uint8Array | undefined;
|
|
2567
|
+
chainKey: SessionChainKeyComponents | undefined;
|
|
2568
|
+
messageKeys: SessionMessageKeyComponents[];
|
|
2569
|
+
}
|
|
2570
|
+
|
|
2571
|
+
export interface RequiredSessionChainKeyComponents {
|
|
2572
|
+
index: number;
|
|
2573
|
+
key: Uint8Array;
|
|
2574
|
+
}
|
|
2575
|
+
|
|
2576
|
+
export interface SenderChainKeyComponents {
|
|
2577
|
+
iteration: number;
|
|
2578
|
+
seed: Uint8Array;
|
|
2579
|
+
}
|
|
2580
|
+
|
|
2581
|
+
export interface SenderKeyRecordComponents {
|
|
2582
|
+
states: SenderKeyStateComponents[];
|
|
2583
|
+
}
|
|
2584
|
+
|
|
2585
|
+
export interface SenderKeyStateComponents {
|
|
2586
|
+
keyId: number;
|
|
2587
|
+
chainKey: SenderChainKeyComponents;
|
|
2588
|
+
signingKey: SenderSigningKeyComponents;
|
|
2589
|
+
messageKeys: SenderMessageKeyComponents[];
|
|
2590
|
+
}
|
|
2591
|
+
|
|
2592
|
+
export interface SenderMessageKeyComponents {
|
|
2593
|
+
iteration: number;
|
|
2594
|
+
seed: Uint8Array;
|
|
2595
|
+
}
|
|
2596
|
+
|
|
2597
|
+
export interface SenderSessionChainComponents {
|
|
2598
|
+
senderRatchetKey: Uint8Array;
|
|
2599
|
+
senderRatchetKeyPrivate: Uint8Array;
|
|
2600
|
+
chainKey: RequiredSessionChainKeyComponents;
|
|
2601
|
+
messageKeys: SessionMessageKeyComponents[];
|
|
2602
|
+
}
|
|
2603
|
+
|
|
2604
|
+
export interface SenderSigningKeyComponents {
|
|
2605
|
+
public: Uint8Array;
|
|
2606
|
+
private: Uint8Array | undefined;
|
|
2607
|
+
}
|
|
2608
|
+
|
|
2609
|
+
export interface SessionChainKeyComponents {
|
|
2610
|
+
index: number | undefined;
|
|
2611
|
+
key: Uint8Array | undefined;
|
|
2612
|
+
}
|
|
2613
|
+
|
|
2614
|
+
export interface SessionComponents {
|
|
2615
|
+
sessionVersion: number | undefined;
|
|
2616
|
+
localIdentityPublic: Uint8Array | undefined;
|
|
2617
|
+
remoteIdentityPublic: Uint8Array | undefined;
|
|
2618
|
+
rootKey: Uint8Array | undefined;
|
|
2619
|
+
previousCounter: number | undefined;
|
|
2620
|
+
senderChain: SenderSessionChainComponents | undefined;
|
|
2621
|
+
receiverChains: ReceiverSessionChainComponents[];
|
|
2622
|
+
pendingKeyExchange: PendingKeyExchangeComponents | undefined;
|
|
2623
|
+
pendingPreKey: PendingPreKeyComponents | undefined;
|
|
2624
|
+
remoteRegistrationId: number | undefined;
|
|
2625
|
+
localRegistrationId: number | undefined;
|
|
2626
|
+
needsRefresh: boolean | undefined;
|
|
2627
|
+
aliceBaseKey: Uint8Array | undefined;
|
|
2628
|
+
}
|
|
2629
|
+
|
|
2630
|
+
export interface SessionMessageKeyComponents {
|
|
2631
|
+
index: number;
|
|
2632
|
+
material: SessionMessageKeyMaterial;
|
|
2633
|
+
}
|
|
2634
|
+
|
|
2635
|
+
export interface SessionRecordComponents {
|
|
2636
|
+
currentSession: SessionComponents | undefined;
|
|
2637
|
+
previousSessions: SessionComponents[];
|
|
2638
|
+
}
|
|
2639
|
+
|
|
2640
|
+
export interface WasmAllocationSnapshot {
|
|
2641
|
+
/**
|
|
2642
|
+
* Whether allocator-level diagnostics were compiled in.
|
|
2643
|
+
*/
|
|
2644
|
+
enabled: boolean;
|
|
2645
|
+
/**
|
|
2646
|
+
* Committed WebAssembly linear memory (pages × 64 KiB).
|
|
2647
|
+
*/
|
|
2648
|
+
linearBytes: number;
|
|
2649
|
+
/**
|
|
2650
|
+
* Sum of requested sizes of allocations currently alive.
|
|
2651
|
+
*/
|
|
2652
|
+
heapLiveBytes: number;
|
|
2653
|
+
/**
|
|
2654
|
+
* Peak requested live bytes since `beginWasmAllocationProfile()`.
|
|
2655
|
+
*/
|
|
2656
|
+
heapPeakLiveBytes: number;
|
|
2657
|
+
/**
|
|
2658
|
+
* Cumulative requested allocation/deallocation churn.
|
|
2659
|
+
*/
|
|
2660
|
+
allocatedBytes: number;
|
|
2661
|
+
freedBytes: number;
|
|
2662
|
+
allocations: number;
|
|
2663
|
+
deallocations: number;
|
|
2664
|
+
reallocations: number;
|
|
2665
|
+
largestAllocationBytes: number;
|
|
2666
|
+
/**
|
|
2667
|
+
* Mutually exclusive allocation-site buckets. Core task allocation is a
|
|
2668
|
+
* second measurement through the core\'s `AllocMeter`, exposed on the
|
|
2669
|
+
* client for cross-checking this host-side scope.
|
|
2670
|
+
*/
|
|
2671
|
+
other: AllocationBucketSnapshot;
|
|
2672
|
+
coreTask: AllocationBucketSnapshot;
|
|
2673
|
+
historyDecode: AllocationBucketSnapshot;
|
|
2674
|
+
historySerialize: AllocationBucketSnapshot;
|
|
2675
|
+
historyEnvelope: AllocationBucketSnapshot;
|
|
2676
|
+
historyCallback: AllocationBucketSnapshot;
|
|
2677
|
+
/**
|
|
2678
|
+
* Allocations performed by the profiler while materializing snapshots.
|
|
2679
|
+
* Kept separate so observation overhead cannot masquerade as workload.
|
|
2680
|
+
*/
|
|
2681
|
+
diagnostics: AllocationBucketSnapshot;
|
|
2682
|
+
historySync: HistorySyncAllocationSnapshot;
|
|
2683
|
+
/**
|
|
2684
|
+
* Dynamic attribution sourced from core tracing callsites.
|
|
2685
|
+
*/
|
|
2686
|
+
coreSpans: CoreSpanAllocationSnapshot[];
|
|
2687
|
+
/**
|
|
2688
|
+
* Chronological allocator calls that triggered `memory.grow` since the
|
|
2689
|
+
* last `beginWasmAllocationProfile()`.
|
|
2690
|
+
*/
|
|
2691
|
+
memoryGrowEvents: AllocationEventSnapshot[];
|
|
2692
|
+
/**
|
|
2693
|
+
* All allocations at or above `large_allocation_threshold_bytes`, whether
|
|
2694
|
+
* they reused committed pages or triggered a grow.
|
|
2695
|
+
*/
|
|
2696
|
+
largeAllocationEvents: AllocationEventSnapshot[];
|
|
2697
|
+
largeAllocationThresholdBytes: number;
|
|
2698
|
+
droppedCoreSpanCallsites: number;
|
|
2699
|
+
droppedMemoryGrowEvents: number;
|
|
2700
|
+
droppedLargeAllocationEvents: number;
|
|
2701
|
+
}
|
|
2702
|
+
|
|
2703
|
+
export type LegacySessionProjectionV1 = { status: "projected"; record: LegacySessionRecordV1 } | { status: "unrepresentable"; issue: LegacySessionProjectionIssueV1 };
|
|
2704
|
+
|
|
2705
|
+
export type LegacySessionUnrepresentableFieldV1 = "session_version" | "sender_chain" | "pending_key_exchange" | "post_quantum_pre_key" | "refresh_state" | "derived_message_key" | "last_remote_ephemeral_key";
|
|
2706
|
+
|
|
2707
|
+
export type SessionMessageKeyMaterial = { kind: "seed"; seed: Uint8Array } | { kind: "derived"; cipherKey: Uint8Array; macKey: Uint8Array; iv: Uint8Array };
|
|
2708
|
+
|
|
2709
|
+
export type WhatsAppEvent =
|
|
2710
|
+
| { type: 'receipt'; data: Receipt }
|
|
2711
|
+
| { type: 'server_ack'; data: ServerAck }
|
|
2712
|
+
| { type: 'undecryptable_message'; data: UndecryptableMessage }
|
|
2713
|
+
| { type: 'chat_presence'; data: ChatPresenceUpdate }
|
|
2714
|
+
| { type: 'presence'; data: PresenceUpdate }
|
|
2715
|
+
| { type: 'picture_update'; data: PictureUpdate }
|
|
2716
|
+
| { type: 'user_about_update'; data: UserAboutUpdate }
|
|
2717
|
+
| { type: 'contact_updated'; data: ContactUpdated }
|
|
2718
|
+
| { type: 'contact_number_changed'; data: ContactNumberChanged }
|
|
2719
|
+
| { type: 'contact_sync_requested'; data: ContactSyncRequested }
|
|
2720
|
+
| { type: 'group_update'; data: GroupUpdate }
|
|
2721
|
+
| { type: 'contact_update'; data: ContactUpdate }
|
|
2722
|
+
| { type: 'push_name_update'; data: PushNameUpdate }
|
|
2723
|
+
| { type: 'self_push_name_updated'; data: SelfPushNameUpdated }
|
|
2724
|
+
| { type: 'pin_update'; data: PinUpdate }
|
|
2725
|
+
| { type: 'mute_update'; data: MuteUpdate }
|
|
2726
|
+
| { type: 'archive_update'; data: ArchiveUpdate }
|
|
2727
|
+
| { type: 'star_update'; data: StarUpdate }
|
|
2728
|
+
| { type: 'mark_chat_as_read_update'; data: MarkChatAsReadUpdate }
|
|
2729
|
+
| { type: 'delete_chat_update'; data: DeleteChatUpdate }
|
|
2730
|
+
| { type: 'clear_chat_update'; data: ClearChatUpdate }
|
|
2731
|
+
| { type: 'user_status_mute_update'; data: UserStatusMuteUpdate }
|
|
2732
|
+
| { type: 'delete_message_for_me_update'; data: DeleteMessageForMeUpdate }
|
|
2733
|
+
| { type: 'label_edit_update'; data: LabelEditUpdate }
|
|
2734
|
+
| { type: 'label_association_update'; data: LabelAssociationUpdate }
|
|
2735
|
+
| { type: 'offline_sync_preview'; data: OfflineSyncPreview }
|
|
2736
|
+
| { type: 'offline_sync_completed'; data: OfflineSyncCompleted }
|
|
2737
|
+
| { type: 'dirty_state'; data: { dirty_type: DirtyType; timestamp?: number | null } }
|
|
2738
|
+
| { type: 'device_list_update'; data: DeviceListUpdate }
|
|
2739
|
+
| { type: 'identity_change'; data: IdentityChange }
|
|
2740
|
+
| { type: 'business_status_update'; data: BusinessStatusUpdate }
|
|
2741
|
+
| { type: 'temporary_ban'; data: TemporaryBan }
|
|
2742
|
+
| { type: 'connect_failure'; data: ConnectFailure }
|
|
2743
|
+
| { type: 'stream_error'; data: StreamError }
|
|
2744
|
+
| { type: 'disappearing_mode_changed'; data: DisappearingModeChanged }
|
|
2745
|
+
| { type: 'newsletter_live_update'; data: NewsletterLiveUpdate }
|
|
2746
|
+
| { type: 'incoming_call'; data: IncomingCall }
|
|
2747
|
+
| { type: 'missed_call'; data: MissedCall }
|
|
2748
|
+
| { type: 'call_ended_elsewhere'; data: CallEndedElsewhere }
|
|
2749
|
+
| { type: 'mex_notification'; data: MexNotification }
|
|
2750
|
+
| { type: 'pairing_code_refresh'; data: PairingCodeRefresh }
|
|
2751
|
+
| { type: 'pair_passkey_request'; data: PairPasskeyRequest }
|
|
2752
|
+
| { type: 'pair_passkey_confirmation'; data: PairPasskeyConfirmation }
|
|
2753
|
+
| { type: 'pair_passkey_error'; data: PairPasskeyError }
|
|
2754
|
+
| { type: 'connected'; data: Record<string, never> }
|
|
2755
|
+
| { type: 'disconnected'; data: Record<string, never> }
|
|
2756
|
+
| { type: 'qr'; data: { code: string; timeout: number } }
|
|
2757
|
+
| { type: 'pairing_code'; data: { code: string; timeout: number } }
|
|
2758
|
+
| { type: 'pair_success'; data: { id: string; lid: string; business_name: string; platform: string } }
|
|
2759
|
+
| { type: 'pair_error'; data: { id: string; lid: string; business_name: string; platform: string; error: string } }
|
|
2760
|
+
| { type: 'logged_out'; data: { on_connect: boolean; reason: string } }
|
|
2761
|
+
| { type: 'message'; data: { message: Record<string, unknown>; info: MessageInfo & { is_view_once: boolean } } }
|
|
2762
|
+
| { type: 'notification'; data: { tag: string; attrs: Record<string, string>; content?: unknown } }
|
|
2763
|
+
| { type: 'stream_replaced'; data: Record<string, never> }
|
|
2764
|
+
| { type: 'qr_scanned_without_multidevice'; data: Record<string, never> }
|
|
2765
|
+
| { type: 'client_outdated'; data: Record<string, never> }
|
|
2766
|
+
| { type: 'raw_node'; data: { tag: string; attrs: Record<string, string>; content?: unknown } }
|
|
2767
|
+
| { type: 'history_sync'; data: import('./proto-types').proto.IHistorySync & { syncType: number; chunkOrder?: number; progress?: number; peerDataRequestSessionId?: string } }
|
|
2768
|
+
;
|
|
2769
|
+
|
|
2770
|
+
|
|
2771
|
+
|
|
2772
|
+
export class IntoUnderlyingByteSource {
|
|
2773
|
+
private constructor();
|
|
2774
|
+
free(): void;
|
|
2775
|
+
[Symbol.dispose](): void;
|
|
2776
|
+
cancel(): void;
|
|
2777
|
+
pull(controller: ReadableByteStreamController): Promise<any>;
|
|
2778
|
+
start(controller: ReadableByteStreamController): void;
|
|
2779
|
+
readonly autoAllocateChunkSize: number;
|
|
2780
|
+
readonly type: ReadableStreamType;
|
|
2781
|
+
}
|
|
2782
|
+
|
|
2783
|
+
export class IntoUnderlyingSink {
|
|
2784
|
+
private constructor();
|
|
2785
|
+
free(): void;
|
|
2786
|
+
[Symbol.dispose](): void;
|
|
2787
|
+
abort(reason: any): Promise<any>;
|
|
2788
|
+
close(): Promise<any>;
|
|
2789
|
+
write(chunk: any): Promise<any>;
|
|
2790
|
+
}
|
|
2791
|
+
|
|
2792
|
+
export class IntoUnderlyingSource {
|
|
2793
|
+
private constructor();
|
|
2794
|
+
free(): void;
|
|
2795
|
+
[Symbol.dispose](): void;
|
|
2796
|
+
cancel(): void;
|
|
2797
|
+
pull(controller: ReadableStreamDefaultController): Promise<any>;
|
|
2798
|
+
}
|
|
2799
|
+
|
|
2800
|
+
/**
|
|
2801
|
+
* Opaque handle to the WhatsApp client.
|
|
2802
|
+
*/
|
|
2803
|
+
export class WasmWhatsAppClient {
|
|
2804
|
+
private constructor();
|
|
2805
|
+
free(): void;
|
|
2806
|
+
[Symbol.dispose](): void;
|
|
2807
|
+
/**
|
|
2808
|
+
* Confirm an inbound stanza through the core-owned acknowledgement path.
|
|
2809
|
+
*/
|
|
2810
|
+
acknowledgeStanza(stanza_js: BinaryNode): Promise<void>;
|
|
2811
|
+
/**
|
|
2812
|
+
* Add linked-identifier mappings through one durable core batch.
|
|
2813
|
+
*/
|
|
2814
|
+
addLidPnMappings(mappings: LidPnMappingInput[]): Promise<number>;
|
|
2815
|
+
/**
|
|
2816
|
+
* Archive or unarchive a chat.
|
|
2817
|
+
*/
|
|
2818
|
+
archiveChat(jid: string, archive: boolean): Promise<void>;
|
|
2819
|
+
/**
|
|
2820
|
+
* Ensure E2E Signal sessions exist for the given JIDs.
|
|
2821
|
+
* Returns true after sessions are established.
|
|
2822
|
+
*/
|
|
2823
|
+
assertSessions(jids: string[], _force: boolean): Promise<boolean>;
|
|
2824
|
+
/**
|
|
2825
|
+
* Clear a chat's messages while keeping the chat (WA Web's clearChat), via an
|
|
2826
|
+
* app-state mutation. `delete_starred` also removes starred messages and
|
|
2827
|
+
* `delete_media` also removes downloaded media (both flags live in the mutation
|
|
2828
|
+
* index, not the proto). Mirrors `deleteChat` in passing `None` for the message
|
|
2829
|
+
* range, i.e. clears the whole chat.
|
|
2830
|
+
*/
|
|
2831
|
+
clearChat(jid: string, delete_starred: boolean, delete_media: boolean): Promise<void>;
|
|
2832
|
+
/**
|
|
2833
|
+
* Update participants of a parent group. Removing a participant also
|
|
2834
|
+
* removes them from its linked groups.
|
|
2835
|
+
*/
|
|
2836
|
+
communityParticipantsUpdate(jid: string, participants: string[], action: GroupParticipantAction): Promise<ParticipantChangeResult[]>;
|
|
2837
|
+
/**
|
|
2838
|
+
* Connect to WhatsApp servers (single connection, no auto-reconnect).
|
|
2839
|
+
*/
|
|
2840
|
+
connect(): Promise<void>;
|
|
2841
|
+
/**
|
|
2842
|
+
* Create a parent group with explicit protocol options.
|
|
2843
|
+
*/
|
|
2844
|
+
createCommunity(name: string, description: string | null | undefined, closed: boolean, allow_non_admin_sub_group_creation: boolean, create_general_chat: boolean): Promise<GroupMetadataResult>;
|
|
2845
|
+
/**
|
|
2846
|
+
* Create a subgroup already linked to a parent group.
|
|
2847
|
+
*/
|
|
2848
|
+
createCommunitySubgroup(name: string, participants: string[], parent_jid: string): Promise<GroupMetadataResult>;
|
|
2849
|
+
/**
|
|
2850
|
+
* Create a new group.
|
|
2851
|
+
*
|
|
2852
|
+
* Returns the full `GroupMetadataResult` parsed directly from the
|
|
2853
|
+
* server's create response — no follow-up `getGroupMetadata` IQ
|
|
2854
|
+
* needed. Mirrors the reference client: the create reply
|
|
2855
|
+
* already carries the complete `<group>` node (id, subject,
|
|
2856
|
+
* creation, creator, participants, …).
|
|
2857
|
+
*/
|
|
2858
|
+
createGroup(subject: string, participants: string[]): Promise<GroupMetadataResult>;
|
|
2859
|
+
/**
|
|
2860
|
+
* Create encrypted participant `<to>` nodes for recipient JIDs.
|
|
2861
|
+
* Returns `{ nodes: [...], shouldIncludeDeviceIdentity: boolean }`.
|
|
2862
|
+
* Use `encodeProto('Message', obj)` on the JS side to produce the bytes.
|
|
2863
|
+
*/
|
|
2864
|
+
createParticipantNodesBytes(jids: string[], bytes: Uint8Array, _extra_attrs: any): Promise<any>;
|
|
2865
|
+
/**
|
|
2866
|
+
* Create and send a poll. Returns `{ messageId, messageSecret }`.
|
|
2867
|
+
*
|
|
2868
|
+
* The `messageSecret` (32 bytes) is needed to decrypt votes later.
|
|
2869
|
+
*/
|
|
2870
|
+
createPoll(jid: string, name: string, options: string[], selectable_count: number): Promise<CreatePollResult>;
|
|
2871
|
+
/**
|
|
2872
|
+
* Deactivate a parent group without deleting its former subgroups.
|
|
2873
|
+
*/
|
|
2874
|
+
deactivateCommunity(jid: string): Promise<void>;
|
|
2875
|
+
/**
|
|
2876
|
+
* Delete a chat via app state mutation.
|
|
2877
|
+
*/
|
|
2878
|
+
deleteChat(jid: string): Promise<void>;
|
|
2879
|
+
/**
|
|
2880
|
+
* Delete a message for self (not for everyone).
|
|
2881
|
+
*/
|
|
2882
|
+
deleteMessageForMe(jid: string, message_id: string, from_me: boolean): Promise<void>;
|
|
2883
|
+
/**
|
|
2884
|
+
* Disconnect the client and flush pending state to storage.
|
|
2885
|
+
*/
|
|
2886
|
+
disconnect(): Promise<void>;
|
|
2887
|
+
/**
|
|
2888
|
+
* Download and decrypt media from raw parameters.
|
|
2889
|
+
*
|
|
2890
|
+
* Handles CDN failover, auth refresh, HMAC-SHA256 verification, and
|
|
2891
|
+
* AES-256-CBC decryption internally. Returns decrypted media bytes.
|
|
2892
|
+
*/
|
|
2893
|
+
downloadMedia(direct_path: string, media_key: Uint8Array, file_sha256: Uint8Array, file_enc_sha256: Uint8Array, file_length: number, media_type: MediaType): Promise<Uint8Array>;
|
|
2894
|
+
/**
|
|
2895
|
+
* Download, decrypt, and return a Web ReadableStream of decrypted chunks.
|
|
2896
|
+
*
|
|
2897
|
+
* Same as `downloadMedia` but returns a `ReadableStream` instead of buffering
|
|
2898
|
+
* the entire file. In Node.js, consume with `Readable.fromWeb(stream)`.
|
|
2899
|
+
*/
|
|
2900
|
+
downloadMediaStream(direct_path: string, media_key: Uint8Array, file_sha256: Uint8Array, file_enc_sha256: Uint8Array, file_length: number, media_type: MediaType): ReadableStream;
|
|
2901
|
+
/**
|
|
2902
|
+
* Edit a previously sent message from protobuf bytes.
|
|
2903
|
+
*/
|
|
2904
|
+
editMessageBytes(jid: string, message_id: string, bytes: Uint8Array): Promise<string>;
|
|
2905
|
+
/**
|
|
2906
|
+
* True streaming encrypt via `MediaEncryptor`: processes plaintext chunk-by-chunk
|
|
2907
|
+
* from JS ReadableStream, encrypts with AES-256-CBC, writes ciphertext to JS WritableStream.
|
|
2908
|
+
*
|
|
2909
|
+
* Peak memory: ~130KB (copy buffer + flush buffer + crypto state).
|
|
2910
|
+
*/
|
|
2911
|
+
encryptMediaStream(input: ReadableStream, output: WritableStream, media_type: MediaType): Promise<EncryptMediaResult>;
|
|
2912
|
+
/**
|
|
2913
|
+
* Replenish the server's one-time key pool only when it is low.
|
|
2914
|
+
*/
|
|
2915
|
+
ensurePreKeys(): Promise<void>;
|
|
2916
|
+
/**
|
|
2917
|
+
* Fetch the full blocklist.
|
|
2918
|
+
*/
|
|
2919
|
+
fetchBlocklist(): Promise<BlocklistEntryResult[]>;
|
|
2920
|
+
/**
|
|
2921
|
+
* Request on-demand message history from the primary phone.
|
|
2922
|
+
* Returns the message ID of the PDO request.
|
|
2923
|
+
* Results will arrive as history_sync events.
|
|
2924
|
+
*/
|
|
2925
|
+
fetchMessageHistory(count: number, chat_jid: string, oldest_msg_id: string, oldest_msg_from_me: boolean, oldest_msg_timestamp_ms: number): Promise<string>;
|
|
2926
|
+
/**
|
|
2927
|
+
* Fetch all privacy settings.
|
|
2928
|
+
*/
|
|
2929
|
+
fetchPrivacySettings(): Promise<any>;
|
|
2930
|
+
/**
|
|
2931
|
+
* Fetch the account's reachout-timelock state.
|
|
2932
|
+
*
|
|
2933
|
+
* Wraps the `WAWebMexFetchReachoutTimelockJobQuery` MEX persisted
|
|
2934
|
+
* query (id sourced from `wacore::iq::mex_operations::fetch_reachout_timelock`)
|
|
2935
|
+
* and returns the `xwa2_fetch_account_reachout_timelock` payload as a
|
|
2936
|
+
* raw JSON object — typically:
|
|
2937
|
+
*
|
|
2938
|
+
* ```json
|
|
2939
|
+
* { "is_active": true,
|
|
2940
|
+
* "time_enforcement_ends": "1734567890",
|
|
2941
|
+
* "enforcement_type": "BIZ_COMMERCE_VIOLATION_…" }
|
|
2942
|
+
* ```
|
|
2943
|
+
*
|
|
2944
|
+
* Returns `null` when the server has no timelock for this account.
|
|
2945
|
+
* Callers map snake_case → idiomatic shape themselves.
|
|
2946
|
+
*/
|
|
2947
|
+
fetchReachoutTimelock(): Promise<any>;
|
|
2948
|
+
/**
|
|
2949
|
+
* Fetch user status/about text for one or more JIDs.
|
|
2950
|
+
*/
|
|
2951
|
+
fetchStatus(jids: string[]): Promise<FetchStatusResult[]>;
|
|
2952
|
+
/**
|
|
2953
|
+
* Get the ADV signed device identity (account), if available.
|
|
2954
|
+
* Exposes the persisted account identity to credential consumers.
|
|
2955
|
+
*/
|
|
2956
|
+
getAccount(): Promise<any>;
|
|
2957
|
+
/**
|
|
2958
|
+
* Get business profile information for a JID.
|
|
2959
|
+
*/
|
|
2960
|
+
getBusinessProfile(jid: string): Promise<BusinessProfileResult | undefined>;
|
|
2961
|
+
/**
|
|
2962
|
+
* Fetch subgroups of a parent group.
|
|
2963
|
+
*/
|
|
2964
|
+
getCommunitySubgroups(parent_jid: string): Promise<CommunitySubgroupResult[]>;
|
|
2965
|
+
/**
|
|
2966
|
+
* Allocation churn for work polled by whatsapp-rust's instrumented
|
|
2967
|
+
* runtime. It overlaps the global allocator totals but uniquely separates
|
|
2968
|
+
* core task work from bridge/host-boundary work.
|
|
2969
|
+
*/
|
|
2970
|
+
getCoreAllocationSnapshot(): CoreAllocationSnapshotResult;
|
|
2971
|
+
/**
|
|
2972
|
+
* Get metadata for a group.
|
|
2973
|
+
*/
|
|
2974
|
+
getGroupMetadata(jid: string): Promise<GroupMetadataResult>;
|
|
2975
|
+
/**
|
|
2976
|
+
* Get the own JID (phone number JID) if logged in.
|
|
2977
|
+
*
|
|
2978
|
+
* Returns the non-AD JID (without device suffix), e.g. "559980000014@s.whatsapp.net".
|
|
2979
|
+
* This is the JID used for addressing in messages.
|
|
2980
|
+
*/
|
|
2981
|
+
getJid(): Promise<string | undefined>;
|
|
2982
|
+
/**
|
|
2983
|
+
* Get the own LID (linked identity) if available.
|
|
2984
|
+
*
|
|
2985
|
+
* Returns the non-AD LID (without device suffix), e.g. "100000012345678@lid".
|
|
2986
|
+
*/
|
|
2987
|
+
getLid(): Promise<string | undefined>;
|
|
2988
|
+
/**
|
|
2989
|
+
* Get media connection info (auth token + upload hosts).
|
|
2990
|
+
*
|
|
2991
|
+
* Returns `{ auth: string, ttl: number, hosts: [{hostname: string, maxContentLengthBytes: number}] }`.
|
|
2992
|
+
*/
|
|
2993
|
+
getMediaConn(force: boolean): Promise<MediaConnResult>;
|
|
2994
|
+
/**
|
|
2995
|
+
* Returns a snapshot of internal memory diagnostics (cache sizes, session counts, etc.).
|
|
2996
|
+
*/
|
|
2997
|
+
getMemoryDiagnostics(): Promise<MemoryDiagnosticsResult>;
|
|
2998
|
+
/**
|
|
2999
|
+
* Get the current push name.
|
|
3000
|
+
*/
|
|
3001
|
+
getPushName(): Promise<string>;
|
|
3002
|
+
/**
|
|
3003
|
+
* Get the list of known devices for the given user JIDs via usync query.
|
|
3004
|
+
* Returns an array of JID strings (one per device).
|
|
3005
|
+
*/
|
|
3006
|
+
getUSyncDevices(jids: string[], _use_cache: boolean, _ignore_zero_devices: boolean): Promise<any>;
|
|
3007
|
+
/**
|
|
3008
|
+
* Join a group using an invite code.
|
|
3009
|
+
*/
|
|
3010
|
+
groupAcceptInvite(code: string): Promise<string>;
|
|
3011
|
+
/**
|
|
3012
|
+
* Join a group via a GroupInviteMessage (V4 invite).
|
|
3013
|
+
*/
|
|
3014
|
+
groupAcceptInviteV4(group_jid: string, code: string, expiration: number, admin_jid: string): Promise<string>;
|
|
3015
|
+
/**
|
|
3016
|
+
* Get group info from an invite code (without joining).
|
|
3017
|
+
* Returns the same shape as groupMetadata.
|
|
3018
|
+
*/
|
|
3019
|
+
groupGetInviteInfo(code: string): Promise<GroupMetadataResult>;
|
|
3020
|
+
/**
|
|
3021
|
+
* Get the invite link for a group.
|
|
3022
|
+
*/
|
|
3023
|
+
groupInviteCode(jid: string): Promise<string>;
|
|
3024
|
+
/**
|
|
3025
|
+
* Leave a group.
|
|
3026
|
+
*/
|
|
3027
|
+
groupLeave(jid: string): Promise<void>;
|
|
3028
|
+
/**
|
|
3029
|
+
* Set who can add members to a group.
|
|
3030
|
+
*/
|
|
3031
|
+
groupMemberAddMode(jid: string, mode: MemberAddMode): Promise<void>;
|
|
3032
|
+
/**
|
|
3033
|
+
* Update group participants.
|
|
3034
|
+
*/
|
|
3035
|
+
groupParticipantsUpdate(jid: string, participants: string[], action: GroupParticipantAction): Promise<ParticipantChangeResult[]>;
|
|
3036
|
+
/**
|
|
3037
|
+
* Get list of pending join requests for a group.
|
|
3038
|
+
*/
|
|
3039
|
+
groupRequestParticipantsList(jid: string): Promise<MembershipRequestResult[]>;
|
|
3040
|
+
/**
|
|
3041
|
+
* Approve or reject pending join requests.
|
|
3042
|
+
*/
|
|
3043
|
+
groupRequestParticipantsUpdate(jid: string, participants: string[], action: GroupRequestAction): Promise<ParticipantChangeResult[]>;
|
|
3044
|
+
/**
|
|
3045
|
+
* Revoke a group's invite link (generates new one).
|
|
3046
|
+
*/
|
|
3047
|
+
groupRevokeInvite(jid: string): Promise<string>;
|
|
3048
|
+
/**
|
|
3049
|
+
* Revoke invitation codes previously issued to participants.
|
|
3050
|
+
*/
|
|
3051
|
+
groupRevokeInviteV4(group_jid: string, invited_jid: string): Promise<boolean>;
|
|
3052
|
+
/**
|
|
3053
|
+
* Update a group setting (locked, announce, membership_approval).
|
|
3054
|
+
*/
|
|
3055
|
+
groupSettingUpdate(jid: string, setting: GroupSetting, value: boolean): Promise<void>;
|
|
3056
|
+
/**
|
|
3057
|
+
* Set disappearing messages timer for a group (0 to disable).
|
|
3058
|
+
*/
|
|
3059
|
+
groupToggleEphemeral(jid: string, expiration: number): Promise<void>;
|
|
3060
|
+
/**
|
|
3061
|
+
* Update a group's description. Pass null/undefined to remove.
|
|
3062
|
+
*/
|
|
3063
|
+
groupUpdateDescription(jid: string, description?: string | null): Promise<void>;
|
|
3064
|
+
/**
|
|
3065
|
+
* Update a group's subject (name).
|
|
3066
|
+
*/
|
|
3067
|
+
groupUpdateSubject(jid: string, subject: string): Promise<void>;
|
|
3068
|
+
/**
|
|
3069
|
+
* Check if the client is connected.
|
|
3070
|
+
*/
|
|
3071
|
+
isConnected(): boolean;
|
|
3072
|
+
/**
|
|
3073
|
+
* Check if the client is logged in (paired).
|
|
3074
|
+
*/
|
|
3075
|
+
isLoggedIn(): boolean;
|
|
3076
|
+
/**
|
|
3077
|
+
* Check if one or more phone numbers / JIDs are registered on WhatsApp.
|
|
3078
|
+
*
|
|
3079
|
+
* Accepts either bare phone numbers (treated as PN JIDs) or full JIDs
|
|
3080
|
+
* (`@s.whatsapp.net` for PN, `@lid` for LID). Mixed PN/LID inputs are
|
|
3081
|
+
* transparently split into the two underlying usync queries by the core,
|
|
3082
|
+
* so a single call is at most two IQs regardless of input size.
|
|
3083
|
+
*
|
|
3084
|
+
* Returns one `IsOnWhatsAppResult` per server hit — including the LID
|
|
3085
|
+
* counterpart and business flag — eliminating the follow-up `fetchUserInfo`
|
|
3086
|
+
* round trip the previous single-phone API forced callers into.
|
|
3087
|
+
*/
|
|
3088
|
+
isOnWhatsApp(phones: string[]): Promise<IsOnWhatsAppResult[]>;
|
|
3089
|
+
/**
|
|
3090
|
+
* Convert a JID string to its Signal protocol address representation.
|
|
3091
|
+
*/
|
|
3092
|
+
jidToSignalProtocolAddress(jid: string): string;
|
|
3093
|
+
/**
|
|
3094
|
+
* Look up the LID JID corresponding to a given phone number JID.
|
|
3095
|
+
*
|
|
3096
|
+
* Accepts a bare phone number (treated as PN), a `<phone>@s.whatsapp.net`
|
|
3097
|
+
* JID, or any LID/PN JID. Returns the full LID JID string (e.g.
|
|
3098
|
+
* `100000012345678@lid`) or `null` when no mapping is known. Backed by
|
|
3099
|
+
* the core's cache-aside `get_lid_pn_entry`: hits the in-memory cache
|
|
3100
|
+
* first, then falls through to `backend.get_pn_mapping(user)` so a JS
|
|
3101
|
+
* `JsStoreCallbacks` backend without a list primitive still resolves
|
|
3102
|
+
* every persisted mapping without an extra usync round trip.
|
|
3103
|
+
*/
|
|
3104
|
+
lidForPn(jid: string): Promise<string | undefined>;
|
|
3105
|
+
/**
|
|
3106
|
+
* Link existing groups to a parent group.
|
|
3107
|
+
*/
|
|
3108
|
+
linkCommunitySubgroups(parent_jid: string, subgroup_jids: string[]): Promise<CommunityLinkResult>;
|
|
3109
|
+
/**
|
|
3110
|
+
* Logout from WhatsApp — deregisters this companion device and disconnects.
|
|
3111
|
+
*
|
|
3112
|
+
* Sends `remove-companion-device` IQ to the server (best-effort),
|
|
3113
|
+
* then disconnects. Does NOT clear stored keys — the caller should
|
|
3114
|
+
* delete the store to fully clear credentials.
|
|
3115
|
+
*/
|
|
3116
|
+
logout(): Promise<void>;
|
|
3117
|
+
/**
|
|
3118
|
+
* Mark a chat as read or unread via app state mutation.
|
|
3119
|
+
* Different from readMessages (which sends read receipts).
|
|
3120
|
+
*/
|
|
3121
|
+
markChatAsRead(jid: string, read: boolean): Promise<void>;
|
|
3122
|
+
/**
|
|
3123
|
+
* Mark voice/video notes as played by sending played receipts
|
|
3124
|
+
* (`<receipt type="played"|"played-self">`). Groups keys by chat +
|
|
3125
|
+
* participant exactly like [`Self::read_messages`]; the core picks
|
|
3126
|
+
* `played` vs `played-self` (newsletters) and sets `participant` only for
|
|
3127
|
+
* group/broadcast chats, so the JS side just hands over the message keys.
|
|
3128
|
+
*/
|
|
3129
|
+
markPlayed(keys: ReadMessageKey[]): Promise<void>;
|
|
3130
|
+
/**
|
|
3131
|
+
* Mute or unmute a chat.
|
|
3132
|
+
*
|
|
3133
|
+
* Pass a positive timestamp (ms) to mute until that time, or null/undefined to unmute.
|
|
3134
|
+
*/
|
|
3135
|
+
muteChat(jid: string, mute_until?: number | null): Promise<void>;
|
|
3136
|
+
/**
|
|
3137
|
+
* Create a new newsletter (channel).
|
|
3138
|
+
*/
|
|
3139
|
+
newsletterCreate(name: string, description?: string | null): Promise<NewsletterMetadataResult>;
|
|
3140
|
+
/**
|
|
3141
|
+
* Fetch metadata for a newsletter by JID.
|
|
3142
|
+
*/
|
|
3143
|
+
newsletterMetadata(jid: string): Promise<NewsletterMetadataResult>;
|
|
3144
|
+
/**
|
|
3145
|
+
* Mute or unmute a newsletter's follower-activity notifications — the channel
|
|
3146
|
+
* mute a subscriber toggles (WA Web `MUTE_FOLLOWER_ACTIVITY`). `muted = true`
|
|
3147
|
+
* silences them. The separate owner-only admin-activity mute is not exposed.
|
|
3148
|
+
*/
|
|
3149
|
+
newsletterMute(jid: string, muted: boolean): Promise<void>;
|
|
3150
|
+
/**
|
|
3151
|
+
* Send a reaction to a newsletter message.
|
|
3152
|
+
*
|
|
3153
|
+
* `server_id` is the server-assigned message ID (passed as string to avoid
|
|
3154
|
+
* JS number precision issues). `reaction` is the emoji code, or null/empty
|
|
3155
|
+
* to remove a reaction.
|
|
3156
|
+
*/
|
|
3157
|
+
newsletterReactMessage(jid: string, server_id: string, reaction?: string | null): Promise<void>;
|
|
3158
|
+
/**
|
|
3159
|
+
* Subscribe (join) a newsletter.
|
|
3160
|
+
*/
|
|
3161
|
+
newsletterSubscribe(jid: string): Promise<NewsletterMetadataResult>;
|
|
3162
|
+
/**
|
|
3163
|
+
* Unsubscribe (leave) a newsletter.
|
|
3164
|
+
*/
|
|
3165
|
+
newsletterUnsubscribe(jid: string): Promise<void>;
|
|
3166
|
+
/**
|
|
3167
|
+
* Pin or unpin a chat.
|
|
3168
|
+
*/
|
|
3169
|
+
pinChat(jid: string, pin: boolean): Promise<void>;
|
|
3170
|
+
/**
|
|
3171
|
+
* Look up the phone number JID corresponding to a given LID JID.
|
|
3172
|
+
*
|
|
3173
|
+
* Accepts a bare LID user-part, a `<user>@lid` JID, or any LID/PN JID.
|
|
3174
|
+
* Returns the full PN JID string (e.g. `559980000001@s.whatsapp.net`) or
|
|
3175
|
+
* `null` when no mapping is known. Same cache-aside semantics as
|
|
3176
|
+
* `lidForPn` — see that doc.
|
|
3177
|
+
*/
|
|
3178
|
+
pnForLid(jid: string): Promise<string | undefined>;
|
|
3179
|
+
/**
|
|
3180
|
+
* Subscribe to a contact's presence updates.
|
|
3181
|
+
*/
|
|
3182
|
+
presenceSubscribe(jid: string): Promise<void>;
|
|
3183
|
+
/**
|
|
3184
|
+
* Get the profile picture URL for a user or group.
|
|
3185
|
+
*
|
|
3186
|
+
* `picture_type` should be "preview" or "image".
|
|
3187
|
+
*/
|
|
3188
|
+
profilePictureUrl(jid: string, picture_type: PictureType, timeout_ms?: number | null): Promise<ProfilePictureInfo | undefined>;
|
|
3189
|
+
/**
|
|
3190
|
+
* Send an IQ node and return the matching response node.
|
|
3191
|
+
*/
|
|
3192
|
+
queryNode(node_js: BinaryNode, timeout_ms?: number | null): Promise<BinaryNode>;
|
|
3193
|
+
/**
|
|
3194
|
+
* Execute a validated typed USync query through the core-owned operation.
|
|
3195
|
+
* The bridge performs exactly one Serde decode and one Serde encode; it
|
|
3196
|
+
* neither constructs protocol nodes nor translates consumer-facing names.
|
|
3197
|
+
*/
|
|
3198
|
+
queryUsync(query: UsyncQuery): Promise<UsyncResponse>;
|
|
3199
|
+
/**
|
|
3200
|
+
* Mark messages as read by sending read receipts.
|
|
3201
|
+
*/
|
|
3202
|
+
readMessages(keys: ReadMessageKey[]): Promise<void>;
|
|
3203
|
+
/**
|
|
3204
|
+
* Drop the current connection and reconnect immediately, picking up
|
|
3205
|
+
* any profile changes (e.g. `setClientProfile`) on the new handshake.
|
|
3206
|
+
* The `run()` loop continues — only the in-flight WebSocket is reset.
|
|
3207
|
+
*/
|
|
3208
|
+
reconnect(): Promise<void>;
|
|
3209
|
+
/**
|
|
3210
|
+
* Force-refresh the server's one-time key pool.
|
|
3211
|
+
*/
|
|
3212
|
+
refreshPreKeys(count?: number | null): Promise<void>;
|
|
3213
|
+
/**
|
|
3214
|
+
* Reject an incoming call.
|
|
3215
|
+
*/
|
|
3216
|
+
rejectCall(call_id: string, peer: string, call_creator: string): Promise<void>;
|
|
3217
|
+
/**
|
|
3218
|
+
* Reject an inbound stanza through the core-owned acknowledgement path.
|
|
3219
|
+
*/
|
|
3220
|
+
rejectStanza(stanza_js: BinaryNode, error_code: number, failure_reason?: number | null): Promise<void>;
|
|
3221
|
+
/**
|
|
3222
|
+
* Low-level message relay from protobuf binary bytes.
|
|
3223
|
+
*/
|
|
3224
|
+
relayMessageBytes(jid: string, bytes: Uint8Array, message_id?: string | null): Promise<string>;
|
|
3225
|
+
/**
|
|
3226
|
+
* Send an E2E message with neutral core-owned controls.
|
|
3227
|
+
*
|
|
3228
|
+
* Child nodes are converted only at the boundary. Routing, cache policy,
|
|
3229
|
+
* encryption and reserved-node validation remain owned by the core.
|
|
3230
|
+
*/
|
|
3231
|
+
relayMessageBytesWithOptions(jid: string, bytes: Uint8Array, message_id: string | null | undefined, extra_nodes: BinaryNode[], refresh_group_metadata: boolean, refresh_devices: boolean): Promise<string>;
|
|
3232
|
+
/**
|
|
3233
|
+
* Remove a group's profile picture.
|
|
3234
|
+
*/
|
|
3235
|
+
removeGroupProfilePicture(group_jid: string): Promise<ProfilePictureResult>;
|
|
3236
|
+
/**
|
|
3237
|
+
* Remove the profile picture for the logged-in user.
|
|
3238
|
+
*/
|
|
3239
|
+
removeProfilePicture(): Promise<ProfilePictureResult>;
|
|
3240
|
+
/**
|
|
3241
|
+
* Request the server to re-upload expired media.
|
|
3242
|
+
*
|
|
3243
|
+
* Returns the new `directPath` on success.
|
|
3244
|
+
* Throws on failure (not found, decryption error, timeout, etc.).
|
|
3245
|
+
*/
|
|
3246
|
+
requestMediaReupload(msg_id: string, chat_jid: string, media_key: Uint8Array, is_from_me: boolean, participant?: string | null): Promise<string>;
|
|
3247
|
+
/**
|
|
3248
|
+
* Request retransmission without acknowledging the original stanza.
|
|
3249
|
+
*/
|
|
3250
|
+
requestMessageRetry(stanza_js: BinaryNode, force_include_keys?: boolean | null): Promise<void>;
|
|
3251
|
+
/**
|
|
3252
|
+
* Request a pairing code for phone number login (alternative to QR).
|
|
3253
|
+
*
|
|
3254
|
+
* Returns the 8-character pairing code to enter on the phone. On error,
|
|
3255
|
+
* throws a `WhatsAppError` with structured fields (`kind`, `serverCode`,
|
|
3256
|
+
* `serverText`, etc.) — see `errors::BridgeError`.
|
|
3257
|
+
*/
|
|
3258
|
+
requestPairingCode(phone_number: string, custom_code?: string | null): Promise<string>;
|
|
3259
|
+
/**
|
|
3260
|
+
* Retransmit an existing message to one requesting device.
|
|
3261
|
+
*/
|
|
3262
|
+
retransmitMessageBytes(chat_jid: string, bytes: Uint8Array, input: MessageRetransmissionInput): Promise<void>;
|
|
3263
|
+
/**
|
|
3264
|
+
* Revoke (delete) a sent message.
|
|
3265
|
+
*/
|
|
3266
|
+
revokeMessage(jid: string, message_id: string, participant?: string | null): Promise<void>;
|
|
3267
|
+
/**
|
|
3268
|
+
* Rotate the signed key advertised by the server.
|
|
3269
|
+
*/
|
|
3270
|
+
rotateSignedKey(): Promise<void>;
|
|
3271
|
+
/**
|
|
3272
|
+
* Start the main client loop in the background.
|
|
3273
|
+
*
|
|
3274
|
+
* Spawns the connection loop (connect, handshake, message loop, reconnect)
|
|
3275
|
+
* as a background task and returns immediately. The loop runs until `disconnect()`
|
|
3276
|
+
* is called.
|
|
3277
|
+
*
|
|
3278
|
+
* Not `async` to avoid holding a wasm-bindgen borrow on `self` that would
|
|
3279
|
+
* prevent calling other methods (disconnect, etc.).
|
|
3280
|
+
*/
|
|
3281
|
+
run(): void;
|
|
3282
|
+
/**
|
|
3283
|
+
* Save or rename a contact, syncing the name to the user's linked devices
|
|
3284
|
+
* (a `contact` app-state mutation). `jid` must be a bare phone-number JID
|
|
3285
|
+
* (the core rejects LID/group/device-specific JIDs).
|
|
3286
|
+
*/
|
|
3287
|
+
saveContact(jid: string, full_name: string | null | undefined, first_name: string | null | undefined, save_on_primary_addressbook: boolean): Promise<void>;
|
|
3288
|
+
/**
|
|
3289
|
+
* Send a chat state update (typing indicator).
|
|
3290
|
+
*/
|
|
3291
|
+
sendChatState(jid: string, state: ChatState): Promise<void>;
|
|
3292
|
+
/**
|
|
3293
|
+
* Comment on a channel (CAG) post. `bytes` is the encoded body `Message`
|
|
3294
|
+
* proto (encoding belongs to JS, like `sendMessageBytes`); `parent_key`
|
|
3295
|
+
* references the post: `participant` is the post author, or `fromMe: true`
|
|
3296
|
+
* for your own post (the core then resolves your LID/PN as the author).
|
|
3297
|
+
* Requires the parent's `messageSecret`, captured when the post was
|
|
3298
|
+
* received — the core derives the addon key and sends the encrypted
|
|
3299
|
+
* comment envelope. Returns the comment's message id.
|
|
3300
|
+
*/
|
|
3301
|
+
sendCommentBytes(jid: string, parent_key: TargetMessageKey, bytes: Uint8Array): Promise<string>;
|
|
3302
|
+
/**
|
|
3303
|
+
* Send an E2E encrypted message from protobuf bytes.
|
|
3304
|
+
* Use `encodeProto('Message', obj)` on the JS side to produce the bytes.
|
|
3305
|
+
*/
|
|
3306
|
+
sendMessageBytes(jid: string, bytes: Uint8Array): Promise<string>;
|
|
3307
|
+
/**
|
|
3308
|
+
* Send a raw binary node stanza to WhatsApp servers.
|
|
3309
|
+
* Accepts a JS object matching `{ tag: string, attrs: Record<string, string>, content?: ... }`.
|
|
3310
|
+
*/
|
|
3311
|
+
sendNode(node_js: BinaryNode): Promise<void>;
|
|
3312
|
+
/**
|
|
3313
|
+
* Send presence status ("available" or "unavailable").
|
|
3314
|
+
*/
|
|
3315
|
+
sendPresence(status: PresenceStatus): Promise<void>;
|
|
3316
|
+
/**
|
|
3317
|
+
* Send pre-marshaled bytes through the noise socket.
|
|
3318
|
+
*/
|
|
3319
|
+
sendRawMessage(data: Uint8Array): Promise<void>;
|
|
3320
|
+
/**
|
|
3321
|
+
* React to a DM, group, or status@broadcast message. Empty/null `emoji`
|
|
3322
|
+
* removes a previous reaction. For group/status targets `key.participant`
|
|
3323
|
+
* must carry the original sender (DMs don't need it; for your own message
|
|
3324
|
+
* `fromMe: true` suffices). For a Community Announcement Group the core
|
|
3325
|
+
* encrypts the reaction with the target's `messageSecret` and sends
|
|
3326
|
+
* `enc_reaction_message` (WA Web `WAWebReactionEncryptMsgData`) — plaintext
|
|
3327
|
+
* reactions are rejected there, so this path must be used instead of a
|
|
3328
|
+
* JS-built `reactionMessage` proto. Returns the reaction's message id.
|
|
3329
|
+
*/
|
|
3330
|
+
sendReaction(jid: string, key: TargetMessageKey, emoji?: string | null): Promise<string>;
|
|
3331
|
+
/**
|
|
3332
|
+
* Send a status/story message to specified recipients.
|
|
3333
|
+
* Use `encodeProto('Message', obj)` on the JS side to produce the bytes.
|
|
3334
|
+
*/
|
|
3335
|
+
sendStatusMessageBytes(bytes: Uint8Array, recipients: string[]): Promise<string>;
|
|
3336
|
+
/**
|
|
3337
|
+
* Send a status message with a caller-provided ID, neutral child nodes and
|
|
3338
|
+
* an explicit recipient-device freshness policy.
|
|
3339
|
+
*/
|
|
3340
|
+
sendStatusMessageBytesWithOptions(bytes: Uint8Array, recipients: string[], message_id: string | null | undefined, extra_nodes: BinaryNode[], refresh_devices: boolean): Promise<string>;
|
|
3341
|
+
/**
|
|
3342
|
+
* Enable or disable automatic reconnection on disconnect.
|
|
3343
|
+
* Enabled by default. When disabled, the client will not attempt
|
|
3344
|
+
* to reconnect after an unexpected disconnection.
|
|
3345
|
+
*/
|
|
3346
|
+
setAutoReconnect(enabled: boolean): void;
|
|
3347
|
+
/**
|
|
3348
|
+
* Override the noise-handshake `ClientPayload` profile (UserAgent
|
|
3349
|
+
* platform/device/os_version/manufacturer + `web_info` presence).
|
|
3350
|
+
*
|
|
3351
|
+
* Independent of `setDeviceProps`: that one drives the "Linked Devices"
|
|
3352
|
+
* display on the phone; this one drives what the server sees during the
|
|
3353
|
+
* noise handshake. Use `{ preset: 'android', osVersion: '13' }` to set
|
|
3354
|
+
* `UserAgent.platform = ANDROID` and omit `web_info`.
|
|
3355
|
+
*
|
|
3356
|
+
* Runtime-only — the field is `#[serde(skip)]` in the persisted Device,
|
|
3357
|
+
* so re-apply on every fresh process before `connect()`.
|
|
3358
|
+
*/
|
|
3359
|
+
setClientProfile(input: ClientProfileInput): Promise<void>;
|
|
3360
|
+
/**
|
|
3361
|
+
* Override `DeviceProps` before initial pairing. Only takes effect on
|
|
3362
|
+
* the registration node — for already paired sessions this is a no-op
|
|
3363
|
+
* on the wire and the core logs a warning.
|
|
3364
|
+
*
|
|
3365
|
+
* Setting `platformType: 'ANDROID_PHONE'` flips the phone's "Linked
|
|
3366
|
+
* Devices" display to Android and unlocks server-side feature gating
|
|
3367
|
+
* (e.g. view-once delivered as payload instead of `absent` stub) WITHOUT
|
|
3368
|
+
* switching the underlying transport — the client still speaks the web
|
|
3369
|
+
* protocol. Real Android companion mode (CRSC v2/v3, TEE attestation)
|
|
3370
|
+
* is NOT implemented; if the server starts enforcing companion-type
|
|
3371
|
+
* crypto, those connections may break.
|
|
3372
|
+
*/
|
|
3373
|
+
setDeviceProps(input: DevicePropsInput): Promise<void>;
|
|
3374
|
+
/**
|
|
3375
|
+
* Set the profile picture for a group the user administers.
|
|
3376
|
+
*
|
|
3377
|
+
* Mirrors the core `SetProfilePictureSpec::set_group` path — same IQ as
|
|
3378
|
+
* the self update, just routed at the JID level so admins can change a
|
|
3379
|
+
* group's avatar from JS without an extra capability check.
|
|
3380
|
+
*/
|
|
3381
|
+
setGroupProfilePicture(group_jid: string, img_data: Uint8Array): Promise<ProfilePictureResult>;
|
|
3382
|
+
/**
|
|
3383
|
+
* Persist a push name before the first connection handshake.
|
|
3384
|
+
*
|
|
3385
|
+
* This is the WASM equivalent of whatsapp-rust's
|
|
3386
|
+
* `BotBuilder::with_push_name`: it only forwards the value into the
|
|
3387
|
+
* core device state and adds no bridge-specific protocol behavior.
|
|
3388
|
+
*/
|
|
3389
|
+
setInitialPushName(name: string): Promise<void>;
|
|
3390
|
+
/**
|
|
3391
|
+
* Set the user's push name (display name).
|
|
3392
|
+
*/
|
|
3393
|
+
setPushName(name: string): Promise<void>;
|
|
3394
|
+
/**
|
|
3395
|
+
* Enable or disable raw node forwarding. When enabled, a `raw_node` event
|
|
3396
|
+
* is emitted for every decoded stanza before internal dispatch.
|
|
3397
|
+
*/
|
|
3398
|
+
setRawNodeForwarding(enabled: boolean): void;
|
|
3399
|
+
/**
|
|
3400
|
+
* Decrypt a group (sender-key) message.
|
|
3401
|
+
*/
|
|
3402
|
+
signalDecryptGroupMessage(group_jid: string, author_jid: string, msg: Uint8Array): Promise<Uint8Array>;
|
|
3403
|
+
/**
|
|
3404
|
+
* Decrypt a Signal protocol message. `msg_type` is "msg", "pkmsg", or "skmsg".
|
|
3405
|
+
*/
|
|
3406
|
+
signalDecryptMessage(jid: string, msg_type: string, ciphertext: Uint8Array): Promise<Uint8Array>;
|
|
3407
|
+
/**
|
|
3408
|
+
* Delete one sender-key chain from live and durable state.
|
|
3409
|
+
*/
|
|
3410
|
+
signalDeleteSenderKey(group_jid: string, sender_jid: string): Promise<void>;
|
|
3411
|
+
/**
|
|
3412
|
+
* Delete Signal sessions for the given JIDs.
|
|
3413
|
+
*/
|
|
3414
|
+
signalDeleteSessions(jids: string[]): Promise<void>;
|
|
3415
|
+
/**
|
|
3416
|
+
* Encrypt plaintext for a group (sender key).
|
|
3417
|
+
* Returns `{ senderKeyDistributionMessage: Uint8Array, ciphertext: Uint8Array }`.
|
|
3418
|
+
*/
|
|
3419
|
+
signalEncryptGroupMessage(group_jid: string, data: Uint8Array, _me_id: string): Promise<any>;
|
|
3420
|
+
/**
|
|
3421
|
+
* Encrypt plaintext for a single recipient.
|
|
3422
|
+
* Returns `{ type: "msg"|"pkmsg", ciphertext: Uint8Array }`.
|
|
3423
|
+
*/
|
|
3424
|
+
signalEncryptMessage(jid: string, data: Uint8Array): Promise<any>;
|
|
3425
|
+
/**
|
|
3426
|
+
* Create the current sender-key distribution payload for a group.
|
|
3427
|
+
*/
|
|
3428
|
+
signalGetSenderKeyDistribution(group_jid: string, sender_jid: string): Promise<Uint8Array>;
|
|
3429
|
+
/**
|
|
3430
|
+
* Inspect the currently open pairwise session for a JID.
|
|
3431
|
+
*/
|
|
3432
|
+
signalGetSessionInfo(jid: string): Promise<SignalSessionInfoResult | undefined>;
|
|
3433
|
+
/**
|
|
3434
|
+
* Check whether sender-key state exists for a group and sender.
|
|
3435
|
+
*/
|
|
3436
|
+
signalHasSenderKey(group_jid: string, sender_jid: string): Promise<boolean>;
|
|
3437
|
+
/**
|
|
3438
|
+
* Install a supplied pairwise pre-key bundle.
|
|
3439
|
+
*/
|
|
3440
|
+
signalInstallPreKeyBundle(jid: string, input: SignalSessionBundleInput): Promise<void>;
|
|
3441
|
+
/**
|
|
3442
|
+
* Move pairwise sessions between phone-number and linked-identifier namespaces.
|
|
3443
|
+
*/
|
|
3444
|
+
signalMigrateSessions(from_jid: string, to_jid: string): Promise<SignalSessionMigrationResult>;
|
|
3445
|
+
/**
|
|
3446
|
+
* Process a raw sender-key distribution payload.
|
|
3447
|
+
*/
|
|
3448
|
+
signalProcessSenderKeyDistribution(group_jid: string, sender_jid: string, distribution: Uint8Array): Promise<void>;
|
|
3449
|
+
/**
|
|
3450
|
+
* Check whether a Signal session exists for the given JID.
|
|
3451
|
+
*/
|
|
3452
|
+
signalValidateSession(jid: string): Promise<boolean>;
|
|
3453
|
+
/**
|
|
3454
|
+
* Star or unstar a message.
|
|
3455
|
+
*/
|
|
3456
|
+
starMessage(jid: string, message_id: string, star: boolean): Promise<void>;
|
|
3457
|
+
/**
|
|
3458
|
+
* Unlink groups from a parent group.
|
|
3459
|
+
*/
|
|
3460
|
+
unlinkCommunitySubgroups(parent_jid: string, subgroup_jids: string[], remove_orphan_members: boolean): Promise<CommunityLinkResult>;
|
|
3461
|
+
/**
|
|
3462
|
+
* Block or unblock a contact.
|
|
3463
|
+
*/
|
|
3464
|
+
updateBlockStatus(jid: string, action: BlockAction): Promise<void>;
|
|
3465
|
+
/**
|
|
3466
|
+
* Set default disappearing messages duration (seconds). 0 to disable.
|
|
3467
|
+
*/
|
|
3468
|
+
updateDefaultDisappearingMode(duration: number): Promise<void>;
|
|
3469
|
+
/**
|
|
3470
|
+
* Set or clear the bot's per-group "member label" — the small tag rendered
|
|
3471
|
+
* under the bot's display name inside that group's UI. Empty `label`
|
|
3472
|
+
* clears the label. The core sends this as a `ProtocolMessage` over the
|
|
3473
|
+
* normal message path (not an IQ), matching WA Web's behavior.
|
|
3474
|
+
*/
|
|
3475
|
+
updateMemberLabel(group_jid: string, label: string): Promise<string>;
|
|
3476
|
+
/**
|
|
3477
|
+
* Update a single privacy setting.
|
|
3478
|
+
*/
|
|
3479
|
+
updatePrivacySetting(category: string, value: string): Promise<void>;
|
|
3480
|
+
/**
|
|
3481
|
+
* Set the profile picture for the logged-in user.
|
|
3482
|
+
*/
|
|
3483
|
+
updateProfilePicture(img_data: Uint8Array): Promise<ProfilePictureResult>;
|
|
3484
|
+
/**
|
|
3485
|
+
* Update the user's status text (about).
|
|
3486
|
+
*/
|
|
3487
|
+
updateProfileStatus(status: string): Promise<void>;
|
|
3488
|
+
/**
|
|
3489
|
+
* Upload pre-encrypted media with streaming body.
|
|
3490
|
+
*
|
|
3491
|
+
* `get_body` is a JS function `() => ReadableStream<Uint8Array>` — called
|
|
3492
|
+
* for each upload attempt (retry creates a fresh stream).
|
|
3493
|
+
* Handles CDN failover, auth refresh, and resumable upload (>=5MB).
|
|
3494
|
+
*/
|
|
3495
|
+
uploadEncryptedMediaStream(get_body: Function, media_key: Uint8Array, file_sha256: Uint8Array, file_enc_sha256: Uint8Array, file_length: number, media_type: MediaType): Promise<UploadMediaResult>;
|
|
3496
|
+
/**
|
|
3497
|
+
* Upload media: encrypt in memory + upload with CDN failover and retry.
|
|
3498
|
+
*
|
|
3499
|
+
* Takes raw plaintext bytes. Handles AES-256-CBC encryption, HMAC-SHA256
|
|
3500
|
+
* signing, multi-host CDN upload, auth refresh, and resumable upload (>=5MB).
|
|
3501
|
+
*/
|
|
3502
|
+
uploadMedia(data: Uint8Array, media_type: MediaType): Promise<UploadMediaResult>;
|
|
3503
|
+
/**
|
|
3504
|
+
* Validate the server-side key-bundle digest against local state.
|
|
3505
|
+
*/
|
|
3506
|
+
validateKeyBundle(): Promise<void>;
|
|
3507
|
+
/**
|
|
3508
|
+
* Vote on a poll. Returns message ID.
|
|
3509
|
+
*/
|
|
3510
|
+
votePoll(chat_jid: string, poll_msg_id: string, poll_creator_jid: string, message_secret: Uint8Array, option_names: string[]): Promise<string>;
|
|
3511
|
+
}
|
|
3512
|
+
|
|
3513
|
+
/**
|
|
3514
|
+
* Start a new peak-observation window without disturbing live/cumulative
|
|
3515
|
+
* counters. The benchmark harness calls this immediately before constructing
|
|
3516
|
+
* a client, then computes churn from successive snapshots.
|
|
3517
|
+
*/
|
|
3518
|
+
export function beginWasmAllocationProfile(): void;
|
|
3519
|
+
|
|
3520
|
+
export function calculateAgreement(public_key: Uint8Array, private_key: Uint8Array): Uint8Array;
|
|
3521
|
+
|
|
3522
|
+
export function calculateSignature(private_key: Uint8Array, message: Uint8Array): Uint8Array;
|
|
3523
|
+
|
|
3524
|
+
export function decodeSenderKeyRecordComponents(bytes: Uint8Array): SenderKeyRecordComponents;
|
|
3525
|
+
|
|
3526
|
+
export function decodeSessionRecordComponents(bytes: Uint8Array): SessionRecordComponents;
|
|
3527
|
+
|
|
3528
|
+
export function decryptEventResponsePayload(enc_payload: Uint8Array, enc_iv: Uint8Array, message_secret: Uint8Array, stanza_id: string, event_creator_jid: string, responder_jid: string): Uint8Array;
|
|
3529
|
+
|
|
3530
|
+
/**
|
|
3531
|
+
* Decrypt a poll vote. Returns selected option names as a string array.
|
|
3532
|
+
*/
|
|
3533
|
+
export function decryptPollVote(enc_payload: Uint8Array, enc_iv: Uint8Array, message_secret: Uint8Array, poll_msg_id: string, poll_creator_jid: string, voter_jid: string, option_names: string[]): string[];
|
|
3534
|
+
|
|
3535
|
+
export function decryptPollVotePayload(enc_payload: Uint8Array, enc_iv: Uint8Array, message_secret: Uint8Array, stanza_id: string, poll_creator_jid: string, voter_jid: string): Uint8Array;
|
|
3536
|
+
|
|
3537
|
+
export function encodeSenderKeyRecordComponents(value: SenderKeyRecordComponents): Uint8Array;
|
|
3538
|
+
|
|
3539
|
+
export function encodeSessionRecordComponents(value: SessionRecordComponents): Uint8Array;
|
|
3540
|
+
|
|
3541
|
+
export function generateKeyPair(): KeyPair;
|
|
3542
|
+
|
|
3543
|
+
/**
|
|
3544
|
+
* Returns which optional features are enabled in this build.
|
|
3545
|
+
* Use this to conditionally call feature-gated functions.
|
|
3546
|
+
*/
|
|
3547
|
+
export function getEnabledFeatures(): EnabledFeatures;
|
|
3548
|
+
|
|
3549
|
+
export function getPublicFromPrivateKey(private_key: Uint8Array): Uint8Array;
|
|
3550
|
+
|
|
3551
|
+
/**
|
|
3552
|
+
* Returns current WASM linear memory usage in bytes.
|
|
3553
|
+
*
|
|
3554
|
+
* This is the total memory reserved by the WASM instance (pages × 64KB).
|
|
3555
|
+
* Useful for monitoring memory pressure during media operations.
|
|
3556
|
+
*
|
|
3557
|
+
* Note: this includes free space managed by the allocator — it's the
|
|
3558
|
+
* total memory footprint, not the amount currently in use.
|
|
3559
|
+
*/
|
|
3560
|
+
export function getWasmMemoryBytes(): number;
|
|
3561
|
+
|
|
3562
|
+
export function hasLogger(): boolean;
|
|
3563
|
+
|
|
3564
|
+
export function hkdf(input_key_material: Uint8Array, expanded_length: number, options: HkdfInfo): Uint8Array;
|
|
3565
|
+
|
|
3566
|
+
export function importLegacySessionRecordV1(record: LegacySessionRecordV1, context: LegacySessionLocalContext): Uint8Array;
|
|
3567
|
+
|
|
3568
|
+
/**
|
|
3569
|
+
* Inflate a zlib stream.
|
|
3570
|
+
*
|
|
3571
|
+
* The decompressor and its scratch buffer are pooled per thread, so repeated
|
|
3572
|
+
* calls do not reallocate. `maxOutputBytes` caps the decompressed size and is
|
|
3573
|
+
* rejected before the output can grow past it, which is what keeps a
|
|
3574
|
+
* compression bomb from exhausting linear memory; it defaults to 64 MiB.
|
|
3575
|
+
*/
|
|
3576
|
+
export function inflateZlib(data: Uint8Array, max_output_bytes?: number | null): Uint8Array;
|
|
3577
|
+
|
|
3578
|
+
export function logMessage(level: string, message: string): void;
|
|
3579
|
+
|
|
3580
|
+
export function md5(input: Uint8Array): Uint8Array;
|
|
3581
|
+
|
|
3582
|
+
export function projectLegacySessionRecordV1(bytes: Uint8Array): LegacySessionProjectionV1;
|
|
3583
|
+
|
|
3584
|
+
export function setLogger(logger: ILogger): void;
|
|
3585
|
+
|
|
3586
|
+
export function updateLogger(logger: ILogger): void;
|
|
3587
|
+
|
|
3588
|
+
export function verifySignature(public_key: Uint8Array, message: Uint8Array, signature: Uint8Array): boolean;
|
|
3589
|
+
|
|
3590
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
3591
|
+
|
|
3592
|
+
export interface InitOutput {
|
|
3593
|
+
readonly memory: WebAssembly.Memory;
|
|
3594
|
+
readonly __wbg_wasmwhatsappclient_free: (a: number, b: number) => void;
|
|
3595
|
+
readonly beginWasmAllocationProfile: () => void;
|
|
3596
|
+
readonly calculateAgreement: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
3597
|
+
readonly calculateSignature: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
3598
|
+
readonly createWhatsAppClient: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
|
|
3599
|
+
readonly decodeSenderKeyRecordComponents: (a: number, b: number, c: number) => void;
|
|
3600
|
+
readonly decodeSessionRecordComponents: (a: number, b: number, c: number) => void;
|
|
3601
|
+
readonly decryptEventResponsePayload: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
|
|
3602
|
+
readonly decryptPollVote: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number) => void;
|
|
3603
|
+
readonly decryptPollVotePayload: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
|
|
3604
|
+
readonly encodeSenderKeyRecordComponents: (a: number, b: number) => void;
|
|
3605
|
+
readonly encodeSessionRecordComponents: (a: number, b: number) => void;
|
|
3606
|
+
readonly generateKeyPair: () => number;
|
|
3607
|
+
readonly getEnabledFeatures: () => number;
|
|
3608
|
+
readonly getPublicFromPrivateKey: (a: number, b: number, c: number) => void;
|
|
3609
|
+
readonly getWasmAllocationSnapshot: (a: number) => void;
|
|
3610
|
+
readonly hasLogger: () => number;
|
|
3611
|
+
readonly hkdf: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
3612
|
+
readonly importLegacySessionRecordV1: (a: number, b: number, c: number) => void;
|
|
3613
|
+
readonly inflateZlib: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
3614
|
+
readonly initWasmEngine: (a: number, b: number) => void;
|
|
3615
|
+
readonly logMessage: (a: number, b: number, c: number, d: number) => void;
|
|
3616
|
+
readonly md5: (a: number, b: number) => number;
|
|
3617
|
+
readonly projectLegacySessionRecordV1: (a: number, b: number, c: number) => void;
|
|
3618
|
+
readonly setLogger: (a: number, b: number) => void;
|
|
3619
|
+
readonly updateLogger: (a: number) => void;
|
|
3620
|
+
readonly verifySignature: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
3621
|
+
readonly wasmwhatsappclient_acknowledgeStanza: (a: number, b: number) => number;
|
|
3622
|
+
readonly wasmwhatsappclient_addLidPnMappings: (a: number, b: number, c: number) => number;
|
|
3623
|
+
readonly wasmwhatsappclient_archiveChat: (a: number, b: number, c: number, d: number) => number;
|
|
3624
|
+
readonly wasmwhatsappclient_assertSessions: (a: number, b: number, c: number, d: number) => number;
|
|
3625
|
+
readonly wasmwhatsappclient_clearChat: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
3626
|
+
readonly wasmwhatsappclient_communityFetchAllParticipating: (a: number) => number;
|
|
3627
|
+
readonly wasmwhatsappclient_communityParticipantsUpdate: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
|
|
3628
|
+
readonly wasmwhatsappclient_connect: (a: number) => number;
|
|
3629
|
+
readonly wasmwhatsappclient_createCommunity: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
3630
|
+
readonly wasmwhatsappclient_createCommunitySubgroup: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
|
|
3631
|
+
readonly wasmwhatsappclient_createGroup: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
3632
|
+
readonly wasmwhatsappclient_createParticipantNodesBytes: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
|
|
3633
|
+
readonly wasmwhatsappclient_createPoll: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
3634
|
+
readonly wasmwhatsappclient_deactivateCommunity: (a: number, b: number, c: number) => number;
|
|
3635
|
+
readonly wasmwhatsappclient_deleteChat: (a: number, b: number, c: number) => number;
|
|
3636
|
+
readonly wasmwhatsappclient_deleteMessageForMe: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
|
|
3637
|
+
readonly wasmwhatsappclient_disconnect: (a: number) => number;
|
|
3638
|
+
readonly wasmwhatsappclient_downloadMedia: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => number;
|
|
3639
|
+
readonly wasmwhatsappclient_downloadMediaStream: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => void;
|
|
3640
|
+
readonly wasmwhatsappclient_editMessageBytes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
|
|
3641
|
+
readonly wasmwhatsappclient_encryptMediaStream: (a: number, b: number, c: number, d: number) => number;
|
|
3642
|
+
readonly wasmwhatsappclient_ensurePreKeys: (a: number) => number;
|
|
3643
|
+
readonly wasmwhatsappclient_fetchBlocklist: (a: number) => number;
|
|
3644
|
+
readonly wasmwhatsappclient_fetchMessageHistory: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
3645
|
+
readonly wasmwhatsappclient_fetchPrivacySettings: (a: number) => number;
|
|
3646
|
+
readonly wasmwhatsappclient_fetchReachoutTimelock: (a: number) => number;
|
|
3647
|
+
readonly wasmwhatsappclient_fetchStatus: (a: number, b: number, c: number) => number;
|
|
3648
|
+
readonly wasmwhatsappclient_fetchUserInfo: (a: number, b: number, c: number) => number;
|
|
3649
|
+
readonly wasmwhatsappclient_getAccount: (a: number) => number;
|
|
3650
|
+
readonly wasmwhatsappclient_getBusinessProfile: (a: number, b: number, c: number) => number;
|
|
3651
|
+
readonly wasmwhatsappclient_getCommunitySubgroups: (a: number, b: number, c: number) => number;
|
|
3652
|
+
readonly wasmwhatsappclient_getCoreAllocationSnapshot: (a: number) => number;
|
|
3653
|
+
readonly wasmwhatsappclient_getGroupMetadata: (a: number, b: number, c: number) => number;
|
|
3654
|
+
readonly wasmwhatsappclient_getJid: (a: number) => number;
|
|
3655
|
+
readonly wasmwhatsappclient_getLid: (a: number) => number;
|
|
3656
|
+
readonly wasmwhatsappclient_getMediaConn: (a: number, b: number) => number;
|
|
3657
|
+
readonly wasmwhatsappclient_getMemoryDiagnostics: (a: number) => number;
|
|
3658
|
+
readonly wasmwhatsappclient_getPushName: (a: number) => number;
|
|
3659
|
+
readonly wasmwhatsappclient_getUSyncDevices: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
3660
|
+
readonly wasmwhatsappclient_groupAcceptInvite: (a: number, b: number, c: number) => number;
|
|
3661
|
+
readonly wasmwhatsappclient_groupAcceptInviteV4: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
3662
|
+
readonly wasmwhatsappclient_groupFetchAllParticipating: (a: number) => number;
|
|
3663
|
+
readonly wasmwhatsappclient_groupGetInviteInfo: (a: number, b: number, c: number) => number;
|
|
3664
|
+
readonly wasmwhatsappclient_groupInviteCode: (a: number, b: number, c: number) => number;
|
|
3665
|
+
readonly wasmwhatsappclient_groupLeave: (a: number, b: number, c: number) => number;
|
|
3666
|
+
readonly wasmwhatsappclient_groupMemberAddMode: (a: number, b: number, c: number, d: number) => number;
|
|
3667
|
+
readonly wasmwhatsappclient_groupParticipantsUpdate: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
|
|
3668
|
+
readonly wasmwhatsappclient_groupRequestParticipantsList: (a: number, b: number, c: number) => number;
|
|
3669
|
+
readonly wasmwhatsappclient_groupRequestParticipantsUpdate: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
|
|
3670
|
+
readonly wasmwhatsappclient_groupRevokeInvite: (a: number, b: number, c: number) => number;
|
|
3671
|
+
readonly wasmwhatsappclient_groupRevokeInviteV4: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
3672
|
+
readonly wasmwhatsappclient_groupSettingUpdate: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
3673
|
+
readonly wasmwhatsappclient_groupToggleEphemeral: (a: number, b: number, c: number, d: number) => number;
|
|
3674
|
+
readonly wasmwhatsappclient_groupUpdateDescription: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
3675
|
+
readonly wasmwhatsappclient_groupUpdateSubject: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
3676
|
+
readonly wasmwhatsappclient_isConnected: (a: number) => number;
|
|
3677
|
+
readonly wasmwhatsappclient_isLoggedIn: (a: number) => number;
|
|
3678
|
+
readonly wasmwhatsappclient_isOnWhatsApp: (a: number, b: number, c: number) => number;
|
|
3679
|
+
readonly wasmwhatsappclient_jidToSignalProtocolAddress: (a: number, b: number, c: number, d: number) => void;
|
|
3680
|
+
readonly wasmwhatsappclient_lidForPn: (a: number, b: number, c: number) => number;
|
|
3681
|
+
readonly wasmwhatsappclient_linkCommunitySubgroups: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
3682
|
+
readonly wasmwhatsappclient_logout: (a: number) => number;
|
|
3683
|
+
readonly wasmwhatsappclient_markChatAsRead: (a: number, b: number, c: number, d: number) => number;
|
|
3684
|
+
readonly wasmwhatsappclient_markPlayed: (a: number, b: number, c: number) => number;
|
|
3685
|
+
readonly wasmwhatsappclient_muteChat: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
3686
|
+
readonly wasmwhatsappclient_newsletterCreate: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
3687
|
+
readonly wasmwhatsappclient_newsletterMetadata: (a: number, b: number, c: number) => number;
|
|
3688
|
+
readonly wasmwhatsappclient_newsletterMute: (a: number, b: number, c: number, d: number) => number;
|
|
3689
|
+
readonly wasmwhatsappclient_newsletterReactMessage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
|
|
3690
|
+
readonly wasmwhatsappclient_newsletterSubscribe: (a: number, b: number, c: number) => number;
|
|
3691
|
+
readonly wasmwhatsappclient_newsletterUnsubscribe: (a: number, b: number, c: number) => number;
|
|
3692
|
+
readonly wasmwhatsappclient_pinChat: (a: number, b: number, c: number, d: number) => number;
|
|
3693
|
+
readonly wasmwhatsappclient_pnForLid: (a: number, b: number, c: number) => number;
|
|
3694
|
+
readonly wasmwhatsappclient_presenceSubscribe: (a: number, b: number, c: number) => number;
|
|
3695
|
+
readonly wasmwhatsappclient_profilePictureUrl: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
|
|
3696
|
+
readonly wasmwhatsappclient_queryNode: (a: number, b: number, c: number, d: number) => number;
|
|
3697
|
+
readonly wasmwhatsappclient_queryUsync: (a: number, b: number) => number;
|
|
3698
|
+
readonly wasmwhatsappclient_readMessages: (a: number, b: number, c: number) => number;
|
|
3699
|
+
readonly wasmwhatsappclient_reconnect: (a: number) => number;
|
|
3700
|
+
readonly wasmwhatsappclient_refreshPreKeys: (a: number, b: number) => number;
|
|
3701
|
+
readonly wasmwhatsappclient_rejectCall: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
|
|
3702
|
+
readonly wasmwhatsappclient_rejectStanza: (a: number, b: number, c: number, d: number) => number;
|
|
3703
|
+
readonly wasmwhatsappclient_relayMessageBytes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
|
|
3704
|
+
readonly wasmwhatsappclient_relayMessageBytesWithOptions: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => number;
|
|
3705
|
+
readonly wasmwhatsappclient_removeGroupProfilePicture: (a: number, b: number, c: number) => number;
|
|
3706
|
+
readonly wasmwhatsappclient_removeProfilePicture: (a: number) => number;
|
|
3707
|
+
readonly wasmwhatsappclient_requestMediaReupload: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => number;
|
|
3708
|
+
readonly wasmwhatsappclient_requestMessageRetry: (a: number, b: number, c: number) => number;
|
|
3709
|
+
readonly wasmwhatsappclient_requestPairingCode: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
3710
|
+
readonly wasmwhatsappclient_retransmitMessageBytes: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
|
|
3711
|
+
readonly wasmwhatsappclient_revokeMessage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
|
|
3712
|
+
readonly wasmwhatsappclient_rotateSignedKey: (a: number) => number;
|
|
3713
|
+
readonly wasmwhatsappclient_run: (a: number, b: number) => void;
|
|
3714
|
+
readonly wasmwhatsappclient_saveContact: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
3715
|
+
readonly wasmwhatsappclient_sendChatState: (a: number, b: number, c: number, d: number) => number;
|
|
3716
|
+
readonly wasmwhatsappclient_sendCommentBytes: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
|
|
3717
|
+
readonly wasmwhatsappclient_sendMessageBytes: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
3718
|
+
readonly wasmwhatsappclient_sendNode: (a: number, b: number) => number;
|
|
3719
|
+
readonly wasmwhatsappclient_sendPresence: (a: number, b: number) => number;
|
|
3720
|
+
readonly wasmwhatsappclient_sendRawMessage: (a: number, b: number, c: number) => number;
|
|
3721
|
+
readonly wasmwhatsappclient_sendReaction: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
|
|
3722
|
+
readonly wasmwhatsappclient_sendStatusMessageBytes: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
3723
|
+
readonly wasmwhatsappclient_sendStatusMessageBytesWithOptions: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
|
|
3724
|
+
readonly wasmwhatsappclient_setAutoReconnect: (a: number, b: number) => void;
|
|
3725
|
+
readonly wasmwhatsappclient_setClientProfile: (a: number, b: number) => number;
|
|
3726
|
+
readonly wasmwhatsappclient_setDeviceProps: (a: number, b: number) => number;
|
|
3727
|
+
readonly wasmwhatsappclient_setGroupProfilePicture: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
3728
|
+
readonly wasmwhatsappclient_setInitialPushName: (a: number, b: number, c: number) => number;
|
|
3729
|
+
readonly wasmwhatsappclient_setPushName: (a: number, b: number, c: number) => number;
|
|
3730
|
+
readonly wasmwhatsappclient_setRawNodeForwarding: (a: number, b: number) => void;
|
|
3731
|
+
readonly wasmwhatsappclient_signalDecryptGroupMessage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
|
|
3732
|
+
readonly wasmwhatsappclient_signalDecryptMessage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
|
|
3733
|
+
readonly wasmwhatsappclient_signalDeleteSenderKey: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
3734
|
+
readonly wasmwhatsappclient_signalDeleteSessions: (a: number, b: number, c: number) => number;
|
|
3735
|
+
readonly wasmwhatsappclient_signalEncryptGroupMessage: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
|
|
3736
|
+
readonly wasmwhatsappclient_signalEncryptMessage: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
3737
|
+
readonly wasmwhatsappclient_signalGetSenderKeyDistribution: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
3738
|
+
readonly wasmwhatsappclient_signalGetSessionInfo: (a: number, b: number, c: number) => number;
|
|
3739
|
+
readonly wasmwhatsappclient_signalHasSenderKey: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
3740
|
+
readonly wasmwhatsappclient_signalInstallPreKeyBundle: (a: number, b: number, c: number, d: number) => number;
|
|
3741
|
+
readonly wasmwhatsappclient_signalMigrateSessions: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
3742
|
+
readonly wasmwhatsappclient_signalProcessSenderKeyDistribution: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
|
|
3743
|
+
readonly wasmwhatsappclient_signalValidateSession: (a: number, b: number, c: number) => number;
|
|
3744
|
+
readonly wasmwhatsappclient_starMessage: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
|
|
3745
|
+
readonly wasmwhatsappclient_unlinkCommunitySubgroups: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
|
|
3746
|
+
readonly wasmwhatsappclient_updateBlockStatus: (a: number, b: number, c: number, d: number) => number;
|
|
3747
|
+
readonly wasmwhatsappclient_updateDefaultDisappearingMode: (a: number, b: number) => number;
|
|
3748
|
+
readonly wasmwhatsappclient_updateMemberLabel: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
3749
|
+
readonly wasmwhatsappclient_updatePrivacySetting: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
3750
|
+
readonly wasmwhatsappclient_updateProfilePicture: (a: number, b: number, c: number) => number;
|
|
3751
|
+
readonly wasmwhatsappclient_updateProfileStatus: (a: number, b: number, c: number) => number;
|
|
3752
|
+
readonly wasmwhatsappclient_uploadEncryptedMediaStream: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => number;
|
|
3753
|
+
readonly wasmwhatsappclient_uploadMedia: (a: number, b: number, c: number, d: number) => number;
|
|
3754
|
+
readonly wasmwhatsappclient_validateKeyBundle: (a: number) => number;
|
|
3755
|
+
readonly wasmwhatsappclient_votePoll: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => number;
|
|
3756
|
+
readonly getWasmMemoryBytes: () => number;
|
|
3757
|
+
readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
|
|
3758
|
+
readonly __wbg_intounderlyingsink_free: (a: number, b: number) => void;
|
|
3759
|
+
readonly __wbg_intounderlyingsource_free: (a: number, b: number) => void;
|
|
3760
|
+
readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
|
|
3761
|
+
readonly intounderlyingbytesource_cancel: (a: number) => void;
|
|
3762
|
+
readonly intounderlyingbytesource_pull: (a: number, b: number) => number;
|
|
3763
|
+
readonly intounderlyingbytesource_start: (a: number, b: number) => void;
|
|
3764
|
+
readonly intounderlyingbytesource_type: (a: number) => number;
|
|
3765
|
+
readonly intounderlyingsink_abort: (a: number, b: number) => number;
|
|
3766
|
+
readonly intounderlyingsink_close: (a: number) => number;
|
|
3767
|
+
readonly intounderlyingsink_write: (a: number, b: number) => number;
|
|
3768
|
+
readonly intounderlyingsource_cancel: (a: number) => void;
|
|
3769
|
+
readonly intounderlyingsource_pull: (a: number, b: number) => number;
|
|
3770
|
+
readonly __wasm_bindgen_func_elem_3793: (a: number, b: number, c: number) => void;
|
|
3771
|
+
readonly __wasm_bindgen_func_elem_24619: (a: number, b: number, c: number, d: number) => void;
|
|
3772
|
+
readonly __wasm_bindgen_func_elem_24621: (a: number, b: number, c: number, d: number) => void;
|
|
3773
|
+
readonly __wasm_bindgen_func_elem_8208: (a: number, b: number, c: number) => void;
|
|
3774
|
+
readonly __wasm_bindgen_func_elem_3792: (a: number, b: number, c: number) => void;
|
|
3775
|
+
readonly __wasm_bindgen_func_elem_3791: (a: number, b: number) => void;
|
|
3776
|
+
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
3777
|
+
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
3778
|
+
readonly __wbindgen_export3: (a: number) => void;
|
|
3779
|
+
readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
|
|
3780
|
+
readonly __wbindgen_export5: (a: number, b: number) => void;
|
|
3781
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
3782
|
+
}
|
|
3783
|
+
|
|
3784
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
3785
|
+
|
|
3786
|
+
/**
|
|
3787
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
3788
|
+
* a precompiled `WebAssembly.Module`.
|
|
3789
|
+
*
|
|
3790
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
3791
|
+
*
|
|
3792
|
+
* @returns {InitOutput}
|
|
3793
|
+
*/
|
|
3794
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
3795
|
+
|
|
3796
|
+
/**
|
|
3797
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
3798
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
3799
|
+
*
|
|
3800
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
3801
|
+
*
|
|
3802
|
+
* @returns {Promise<InitOutput>}
|
|
3803
|
+
*/
|
|
3804
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|