import { Buffer } from 'node:buffer'; import { EventEmitter } from 'node:events'; import { type MediaType, type UploadMediaResult, type WasmWhatsAppClient } from 'whatsapp-rust-bridge'; import type { proto } from 'whatsapp-rust-bridge/proto-types'; import type { BinaryNode, ConnectionState, Contact, LIDMapping, ReachoutTimelockState, UserFacingSocketConfig, WAMessage } from '../Types/index.js'; import type { ILogger } from '../Utils/logger.js'; import type { MediaDownloadOptions } from '../Utils/messages-media.js'; declare const makeWASocket: (config: UserFacingSocketConfig) => { downloadMedia: (message: WAMessage, type: T, options?: MediaDownloadOptions) => Promise : import("stream").Readable>; newsletterCreate: (name: string, description?: string) => Promise; newsletterMetadata: (jid: string) => Promise; newsletterSubscribe: (jid: string) => Promise; newsletterUnsubscribe: (jid: string) => Promise; newsletterReactMessage: (jid: string, serverId: string, reaction?: string) => Promise; newsletterMute: (jid: string, mute: boolean) => Promise; updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise; fetchBlocklist: () => Promise; sendPresence: (status: "available" | "unavailable") => Promise; presenceSubscribe: (jid: string) => Promise; sendChatState: (jid: string, state: "composing" | "recording" | "paused") => Promise; pinChat: (jid: string, pin: boolean) => Promise; muteChat: (jid: string, muteUntil?: number | null) => Promise; archiveChat: (jid: string, archive: boolean) => Promise; starMessage: (jid: string, messageId: string, star: boolean) => Promise; chatModify: (mod: import("../index.js").ChatModification, jid: string) => Promise; resyncAppState: (_collections?: readonly import("../index.js").WAPatchName[], _isInitialSync?: boolean) => Promise; fetchDisappearingDuration: (..._jids: string[]) => Promise; requestPairingCode: (phoneNumber: string, customPairingCode?: string) => Promise; setPushName: (name: string) => Promise; updateProfileName: (name: string) => Promise; getPushName: () => Promise; getJid: () => Promise; getLid: () => Promise; updateProfilePicture: (jid: string, imgData: Uint8Array) => Promise; removeProfilePicture: (jid?: string) => Promise; updateProfileStatus: (status: string) => Promise; onWhatsApp: (...jids: string[]) => Promise; profilePictureUrl: (jid: string, type?: "preview" | "image") => Promise; fetchUserInfo: (...jids: string[]) => Promise>; groupMetadata: (jid: string) => Promise; groupCreate: (subject: string, participants: string[]) => Promise; groupLeave: (jid: string) => Promise; groupUpdateSubject: (jid: string, subject: string) => Promise; groupUpdateDescription: (jid: string, description?: string) => Promise; groupParticipantsUpdate: (jid: string, participants: string[], action: "add" | "remove" | "promote" | "demote") => Promise; groupFetchAllParticipating: () => Promise>; groupInviteCode: (jid: string) => Promise; groupRevokeInvite: (jid: string) => Promise; groupSettingUpdate: (jid: string, setting: "locked" | "announce" | "unlocked" | "announcement" | "not_announcement" | "membership_approval", value?: boolean) => Promise; groupToggleEphemeral: (jid: string, expiration: number) => Promise; groupAcceptInvite: (code: string) => Promise; groupAcceptInviteV4: (key: { remoteJid?: string | null; }, msg: { inviteCode?: string | null; inviteExpiration?: number | null; groupJid?: string | null; }) => Promise; groupGetInviteInfo: (code: string) => Promise; groupRequestParticipantsList: (jid: string) => Promise; groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "approve" | "reject") => Promise; updateMemberLabel: (jid: string, label: string) => Promise; sendMessage: (jid: string, content: import("../index.js").AnyMessageContent, options?: Omit) => Promise; updateMediaMessage: (message: WAMessage) => Promise; relayMessage: (jid: string, message: proto.IMessage, { messageId, statusJidList }?: import("../index.js").MessageRelayOptions) => Promise; readMessages: (keys: { remoteJid: string; id: string; participant?: string; }[]) => Promise; sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../index.js").MessageReceiptType) => Promise; sendReceipts: (keys: import("../index.js").WAMessageKey[], type: import("../index.js").MessageReceiptType) => Promise; requestPlaceholderResend: (messageKey: import("../index.js").WAMessageKey, _msgData?: Partial) => Promise; ev: import("../index.js").BaileysEventEmitter; logger: ILogger; ws: EventEmitter<[never]>; type: "md"; user: Contact | undefined; waClient: WasmWhatsAppClient | undefined; isConnected: boolean; isLoggedIn: boolean; authState: { creds: { me: Contact | undefined; account: proto.IADVSignedDeviceIdentity | undefined; platform: string | undefined; registered?: boolean | undefined; noiseKey?: import("../index.js").KeyPair; pairingEphemeralKeyPair?: import("../index.js").KeyPair; signedIdentityKey?: import("../index.js").KeyPair; signedPreKey?: import("../index.js").SignedKeyPair; registrationId?: number; advSecretKey?: string; signalIdentities?: import("../index.js").SignalIdentity[]; myAppStateKeyId?: string; firstUnuploadedPreKeyId?: number; nextPreKeyId?: number; lastAccountSyncTimestamp?: number; processedHistoryMessages?: Array<{ key: { remoteJid?: string; id?: string; }; messageTimestamp?: number; }>; accountSyncCounter?: number; accountSettings?: import("../index.js").AccountSettings; pairingCode?: string; lastPropHash?: string; routingInfo?: Buffer; additionalData?: Record; }; keys: import("../index.js").SignalKeyStore | { get: () => Promise<{}>; set: (data: Record | undefined>) => Promise; clear: () => Promise; }; }; generateMessageTag: () => string; sendNode: (frame: BinaryNode) => Promise; assertSessions: (jids: string[], force?: boolean) => Promise; getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise; waitForMessage: (msgId: string, timeoutMs?: number) => Promise; query: (node: BinaryNode, timeoutMs?: number) => Promise; sendRawMessage: (data: Uint8Array | Buffer) => Promise; createParticipantNodes: (jids: string[], message: proto.IMessage, extraAttrs?: BinaryNode["attrs"]) => Promise<{ nodes: BinaryNode[]; shouldIncludeDeviceIdentity: boolean; }>; signalRepository: { decryptMessage: (opts: { jid: string; type: "pkmsg" | "msg"; ciphertext: Uint8Array; }) => Promise>; encryptMessage: (opts: { jid: string; data: Uint8Array; }) => Promise<{ type: "pkmsg" | "msg"; ciphertext: Uint8Array; }>; decryptGroupMessage: (opts: { group: string; authorJid: string; msg: Uint8Array; }) => Promise>; encryptGroupMessage: (opts: { group: string; data: Uint8Array; meId: string; }) => Promise<{ senderKeyDistributionMessage: Uint8Array; ciphertext: Uint8Array; }>; processSenderKeyDistributionMessage: () => Promise; injectE2ESession: () => Promise; validateSession: (jid: string) => Promise<{ exists: boolean; reason?: string; }>; jidToSignalProtocolAddress: (jid: string) => string; migrateSession: () => Promise<{ migrated: number; skipped: number; total: number; }>; deleteSession: (jids: string[]) => Promise; /** * Bidirectional LID ↔ PN lookup. Mirrors the upstream Baileys * `signalRepository.lidMapping` API. * * Pure passthrough to the bridge — `client.lidForPn` / `client.pnForLid` * delegate to the core's `get_lid_pn_entry`, which is cache-aside as * of whatsapp-rust PR #565: hits the in-memory `lid_pn_cache` first * and falls through to `backend.get_pn_mapping` / `get_lid_mapping` * (so JsStoreCallbacks-backed sessions resolve every persisted * mapping without warm-up needing a list primitive). */ lidMapping: { getLIDForPN: (pn: string) => Promise; getPNForLID: (lid: string) => Promise; /** * Batch variant of `getLIDForPN`. Upstream Baileys' equivalent * coalesces in-flight requests and de-duplicates inputs; we run * the lookups in parallel and return the same `LIDMapping[]` * shape so callers (e.g. `process-message.ts`) keep working. * * Uses `Promise.allSettled` so one bridge-side failure (e.g. * malformed JID, transient cache miss) doesn't reject the * whole batch and lose every successful lookup. Failures are * logged at debug and skipped. * * Returns `null` (not `[]`) when the input list is empty, to * mirror upstream's "absent" sentinel. */ getLIDsForPNs: (pns: string[]) => Promise; getPNsForLIDs: (lids: string[]) => Promise; /** * No-op shim. The Rust bridge auto-learns LID↔PN mappings inside * `decode_message` / `usync` and persists them through * `JsStoreCallbacks` — upstream Baileys callers (notably * `process-message.ts` re-feeding mappings from `historySync`) * keep type-checking, but we don't need to write back. * * Logs at debug so unexpected paths stay traceable. */ storeLIDPNMappings: (pairs: LIDMapping[]) => Promise; }; }; /** @deprecated Pre-key management is handled by the Rust bridge. */ uploadPreKeys: () => Promise; /** @deprecated Pre-key management is handled by the Rust bridge. */ uploadPreKeysToServerIfRequired: () => Promise; end: () => Promise; logout: (msg?: string) => Promise; waitForConnectionUpdate: (check: (update: Partial) => boolean, timeoutMs?: number) => Promise; setAutoReconnect: (enabled: boolean) => void; /** * Update presence either globally (`available`/`unavailable`) or per-chat * (`composing`/`recording`/`paused`), matching upstream Baileys' overload. * Chat-state updates require `toJid`; omitting it raises `Boom(400)` so the * caller hears about the protocol mistake instead of the bridge silently * sending nothing. */ sendPresenceUpdate: (presence: "available" | "unavailable" | "composing" | "recording" | "paused", toJid?: string) => Promise; /** * Plaintext media upload helper, source-compatible with the upstream * Baileys `sock.waUploadToServer(buf, { mediaType })` shape so existing * callers (or `prepareWAMessageMedia(msg, { upload: sock.waUploadToServer })`) * keep working. Delegates to the bridge's encrypt + CDN-failover upload. */ waUploadToServer: (data: Uint8Array | Buffer, opts: { mediaType: MediaType; }) => Promise; fetchPrivacySettings: () => Promise; updatePrivacySetting: (category: string, value: string) => Promise; updateLastSeenPrivacy: (value: string) => Promise; updateOnlinePrivacy: (value: string) => Promise; updateProfilePicturePrivacy: (value: string) => Promise; updateStatusPrivacy: (value: string) => Promise; updateReadReceiptsPrivacy: (value: string) => Promise; updateGroupsAddPrivacy: (value: string) => Promise; updateDefaultDisappearingMode: (duration: number) => Promise; rejectCall: (callId: string, callFrom: string) => Promise; fetchStatus: (...jids: string[]) => Promise<{ jid: string; status?: string; }[]>; /** * Fetch the account's current reachout-timelock state from the server. * * The same state is also pushed proactively via the * `NotificationUserReachoutTimelockUpdate` MEX notification, which is * surfaced on `connection.update.reachoutTimeLock` automatically. Use * this method to query on demand (e.g. on app start, or after a 463 * nack hints that the timelock just kicked in). * * Emits the result on `connection.update.reachoutTimeLock` as a side * effect for parity with the push path. Returns the same state for * callers that prefer awaiting. */ fetchReachoutTimelock: () => Promise; getBusinessProfile: (jid: string) => Promise; fetchMessageHistory: (count: number, oldestMsgKey: { remoteJid?: string | null; id?: string | null; fromMe?: boolean | null; }, oldestMsgTimestamp: number) => Promise; groupMemberAddMode: (jid: string, mode: "admin_add" | "all_member_add") => Promise; sendStatusMessage: (message: Record, recipients: string[]) => Promise; }; export default makeWASocket; //# sourceMappingURL=index.d.ts.map