@jkt48connect-corp/baileys 7.2.8 → 7.2.9

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.
Files changed (78) hide show
  1. package/lib/Socket/socket.js +1 -1
  2. package/package.json +1 -1
  3. package/WAProto/index.d.ts +0 -48955
  4. package/lib/Defaults/index.d.ts +0 -282
  5. package/lib/Signal/libsignal.d.ts +0 -3
  6. package/lib/Socket/Client/abstract-socket-client.d.ts +0 -15
  7. package/lib/Socket/Client/index.d.ts +0 -3
  8. package/lib/Socket/Client/mobile-socket-client.d.ts +0 -12
  9. package/lib/Socket/Client/web-socket-client.d.ts +0 -12
  10. package/lib/Socket/business.d.ts +0 -170
  11. package/lib/Socket/chats.d.ts +0 -79
  12. package/lib/Socket/groups.d.ts +0 -113
  13. package/lib/Socket/index.d.ts +0 -172
  14. package/lib/Socket/messages-recv.d.ts +0 -158
  15. package/lib/Socket/messages-send.d.ts +0 -149
  16. package/lib/Socket/newsletter.d.ts +0 -132
  17. package/lib/Socket/registration.d.ts +0 -264
  18. package/lib/Socket/socket.d.ts +0 -42
  19. package/lib/Store/index.d.ts +0 -3
  20. package/lib/Store/make-cache-manager-store.d.ts +0 -14
  21. package/lib/Store/make-in-memory-store.d.ts +0 -117
  22. package/lib/Store/make-ordered-dictionary.d.ts +0 -13
  23. package/lib/Store/object-repository.d.ts +0 -10
  24. package/lib/Types/Auth.d.ts +0 -109
  25. package/lib/Types/Call.d.ts +0 -13
  26. package/lib/Types/Chat.d.ts +0 -107
  27. package/lib/Types/Contact.d.ts +0 -19
  28. package/lib/Types/Events.d.ts +0 -172
  29. package/lib/Types/GroupMetadata.d.ts +0 -56
  30. package/lib/Types/Label.d.ts +0 -46
  31. package/lib/Types/LabelAssociation.d.ts +0 -29
  32. package/lib/Types/Message.d.ts +0 -424
  33. package/lib/Types/Newsletter.d.ts +0 -92
  34. package/lib/Types/Product.d.ts +0 -78
  35. package/lib/Types/Signal.d.ts +0 -57
  36. package/lib/Types/Socket.d.ts +0 -116
  37. package/lib/Types/State.d.ts +0 -27
  38. package/lib/Types/index.d.ts +0 -66
  39. package/lib/Utils/auth-utils.d.ts +0 -18
  40. package/lib/Utils/baileys-event-stream.d.ts +0 -16
  41. package/lib/Utils/business.d.ts +0 -22
  42. package/lib/Utils/chat-utils.d.ts +0 -70
  43. package/lib/Utils/crypto.d.ts +0 -40
  44. package/lib/Utils/decode-wa-message.d.ts +0 -36
  45. package/lib/Utils/event-buffer.d.ts +0 -35
  46. package/lib/Utils/generics.d.ts +0 -88
  47. package/lib/Utils/history.d.ts +0 -19
  48. package/lib/Utils/index.d.ts +0 -17
  49. package/lib/Utils/link-preview.d.ts +0 -21
  50. package/lib/Utils/logger.d.ts +0 -2
  51. package/lib/Utils/lt-hash.d.ts +0 -12
  52. package/lib/Utils/make-mutex.d.ts +0 -7
  53. package/lib/Utils/messages-media.d.ts +0 -113
  54. package/lib/Utils/messages.d.ts +0 -74
  55. package/lib/Utils/noise-handler.d.ts +0 -20
  56. package/lib/Utils/process-message.d.ts +0 -41
  57. package/lib/Utils/signal.d.ts +0 -32
  58. package/lib/Utils/use-multi-file-auth-state.d.ts +0 -12
  59. package/lib/Utils/validate-connection.d.ts +0 -11
  60. package/lib/WABinary/constants.d.ts +0 -27
  61. package/lib/WABinary/decode.d.ts +0 -6
  62. package/lib/WABinary/encode.d.ts +0 -2
  63. package/lib/WABinary/generic-utils.d.ts +0 -14
  64. package/lib/WABinary/index.d.ts +0 -5
  65. package/lib/WABinary/jid-utils.d.ts +0 -31
  66. package/lib/WABinary/types.d.ts +0 -18
  67. package/lib/WAM/BinaryInfo.d.ts +0 -8
  68. package/lib/WAM/constants.d.ts +0 -38
  69. package/lib/WAM/encode.d.ts +0 -2
  70. package/lib/WAM/index.d.ts +0 -3
  71. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -9
  72. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -22
  73. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -12
  74. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -12
  75. package/lib/WAUSync/Protocols/index.d.ts +0 -4
  76. package/lib/WAUSync/USyncQuery.d.ts +0 -26
  77. package/lib/WAUSync/USyncUser.d.ts +0 -10
  78. package/lib/WAUSync/index.d.ts +0 -3
@@ -1,113 +0,0 @@
1
- import { Boom } from '@hapi/boom';
2
- import { AxiosRequestConfig } from 'axios';
3
- import type { Logger } from 'pino';
4
- import { Readable } from 'stream';
5
- import { URL } from 'url';
6
- import { proto } from '../../WAProto';
7
- import { DownloadableMessage, MediaConnInfo, MediaDecryptionKeyInfo, MediaType, SocketConfig, WAMediaUpload, WAMediaUploadFunction, WAMessageContent } from '../Types';
8
- import { BinaryNode } from '../WABinary';
9
- export declare const hkdfInfoKey: (type: MediaType) => string;
10
- /** generates all the keys required to encrypt/decrypt & sign a media message */
11
- export declare function getMediaKeys(buffer: Uint8Array | string | null | undefined, mediaType: MediaType): MediaDecryptionKeyInfo;
12
- export declare const extractImageThumb: (bufferOrFilePath: Readable | Buffer | string, width?: number) => Promise<{
13
- buffer: any;
14
- original: {
15
- width: any;
16
- height: any;
17
- };
18
- }>;
19
- export declare const encodeBase64EncodedStringForUpload: (b64: string) => string;
20
- export declare const generateProfilePicture: (mediaUpload: WAMediaUpload) => Promise<{
21
- img: Buffer;
22
- }>;
23
- /** gets the SHA256 of the given media message */
24
- export declare const mediaMessageSHA256B64: (message: WAMessageContent) => any;
25
- export declare function getAudioDuration(buffer: Buffer | string | Readable): Promise<any>;
26
- /**
27
- referenced from and modifying https://github.com/wppconnect-team/wa-js/blob/main/src/chat/functions/prepareAudioWaveform.ts
28
- */
29
- export declare function getAudioWaveform(buffer: Buffer | string | Readable, logger?: Logger): Promise<Uint8Array<ArrayBuffer> | undefined>;
30
- export declare const toReadable: (buffer: Buffer) => any;
31
- export declare const toBuffer: (stream: Readable) => Promise<any>;
32
- export declare const getStream: (item: WAMediaUpload, opts?: AxiosRequestConfig) => Promise<{
33
- readonly stream: any;
34
- readonly type: "buffer";
35
- } | {
36
- readonly stream: any;
37
- readonly type: "readable";
38
- } | {
39
- readonly stream: Readable;
40
- readonly type: "remote";
41
- } | {
42
- readonly stream: any;
43
- readonly type: "file";
44
- }>;
45
- /** generates a thumbnail for a given media, if required */
46
- export declare function generateThumbnail(file: string, mediaType: 'video' | 'image', options: {
47
- logger?: Logger;
48
- }): Promise<{
49
- thumbnail: string | undefined;
50
- originalImageDimensions: {
51
- width: number;
52
- height: number;
53
- } | undefined;
54
- }>;
55
- export declare const getHttpStream: (url: string | URL, options?: AxiosRequestConfig & {
56
- isStream?: true;
57
- }) => Promise<Readable>;
58
- type EncryptedStreamOptions = {
59
- saveOriginalFileIfRequired?: boolean;
60
- logger?: Logger;
61
- opts?: AxiosRequestConfig;
62
- };
63
- export declare const prepareStream: (media: WAMediaUpload, mediaType: MediaType, { logger, saveOriginalFileIfRequired, opts }?: EncryptedStreamOptions) => Promise<{
64
- mediaKey: undefined;
65
- encWriteStream: any;
66
- fileLength: any;
67
- fileSha256: any;
68
- fileEncSha256: undefined;
69
- bodyPath: string | undefined;
70
- didSaveToTmpPath: boolean;
71
- }>;
72
- export declare const encryptedStream: (media: WAMediaUpload, mediaType: MediaType, { logger, saveOriginalFileIfRequired, opts }?: EncryptedStreamOptions) => Promise<{
73
- mediaKey: any;
74
- encWriteStream: any;
75
- bodyPath: string | undefined;
76
- mac: any;
77
- fileEncSha256: any;
78
- fileSha256: any;
79
- fileLength: number;
80
- didSaveToTmpPath: boolean;
81
- }>;
82
- export type MediaDownloadOptions = {
83
- startByte?: number;
84
- endByte?: number;
85
- options?: AxiosRequestConfig<any>;
86
- };
87
- export declare const getUrlFromDirectPath: (directPath: string) => string;
88
- export declare const downloadContentFromMessage: ({ mediaKey, directPath, url }: DownloadableMessage, type: MediaType, opts?: MediaDownloadOptions) => Promise<any>;
89
- /**
90
- * Decrypts and downloads an AES256-CBC encrypted file given the keys.
91
- * Assumes the SHA256 of the plaintext is appended to the end of the ciphertext
92
- * */
93
- export declare const downloadEncryptedContent: (downloadUrl: string, { cipherKey, iv }: MediaDecryptionKeyInfo, { startByte, endByte, options }?: MediaDownloadOptions) => Promise<any>;
94
- export declare function extensionForMediaMessage(message: WAMessageContent): string;
95
- export declare const getWAUploadToServer: ({ customUploadHosts, fetchAgent, logger, options }: SocketConfig, refreshMediaConn: (force: boolean) => Promise<MediaConnInfo>) => WAMediaUploadFunction;
96
- /**
97
- * Generate a binary node that will request the phone to re-upload the media & return the newly uploaded URL
98
- */
99
- export declare const encryptMediaRetryRequest: (key: proto.IMessageKey, mediaKey: Buffer | Uint8Array, meId: string) => BinaryNode;
100
- export declare const decodeMediaRetryNode: (node: BinaryNode) => {
101
- key: import("../Types").WAMessageKey;
102
- media?: {
103
- ciphertext: Uint8Array;
104
- iv: Uint8Array;
105
- };
106
- error?: Boom;
107
- };
108
- export declare const decryptMediaRetryData: ({ ciphertext, iv }: {
109
- ciphertext: Uint8Array;
110
- iv: Uint8Array;
111
- }, mediaKey: Uint8Array, msgId: string) => proto.MediaRetryNotification;
112
- export declare const getStatusCodeForMediaRetry: (code: number) => any;
113
- export {};
@@ -1,74 +0,0 @@
1
- import { Logger } from 'pino';
2
- import { proto } from '../../WAProto';
3
- import { AnyMediaMessageContent, AnyMessageContent, MediaGenerationOptions, MessageContentGenerationOptions, MessageGenerationOptions, MessageGenerationOptionsFromContent, MessageUserReceipt, WAMessage, WAMessageContent, WAProto } from '../Types';
4
- import { MediaDownloadOptions } from './messages-media';
5
- /**
6
- * Uses a regex to test whether the string contains a URL, and returns the URL if it does.
7
- * @param text eg. hello https://google.com
8
- * @returns the URL, eg. https://google.com
9
- */
10
- export declare const extractUrlFromText: (text: string) => string | undefined;
11
- export declare const generateLinkPreviewIfRequired: (text: string, getUrlInfo: MessageGenerationOptions["getUrlInfo"], logger: MessageGenerationOptions["logger"]) => Promise<import("../Types").WAUrlInfo | undefined>;
12
- export declare const prepareWAMessageMedia: (message: AnyMediaMessageContent, options: MediaGenerationOptions) => Promise<proto.Message>;
13
- export declare const prepareDisappearingMessageSettingContent: (ephemeralExpiration?: number) => proto.Message;
14
- /**
15
- * Generate forwarded message content like WA does
16
- * @param message the message to forward
17
- * @param options.forceForward will show the message as forwarded even if it is from you
18
- */
19
- export declare const generateForwardMessageContent: (message: WAMessage, forceForward?: boolean) => proto.IMessage;
20
- export declare const generateWAMessageContent: (message: AnyMessageContent, options: MessageContentGenerationOptions) => Promise<proto.Message>;
21
- export declare const generateWAMessageFromContent: (jid: string, message: WAMessageContent, options: MessageGenerationOptionsFromContent) => proto.WebMessageInfo;
22
- export declare const generateWAMessage: (jid: string, content: AnyMessageContent, options: MessageGenerationOptions) => Promise<proto.WebMessageInfo>;
23
- /** Get the key to access the true type of content */
24
- export declare const getContentType: (content: WAProto.IMessage | undefined) => keyof proto.IMessage | undefined;
25
- /**
26
- * Normalizes ephemeral, view once messages to regular message content
27
- * Eg. image messages in ephemeral messages, in view once messages etc.
28
- * @param content
29
- * @returns
30
- */
31
- export declare const normalizeMessageContent: (content: WAMessageContent | null | undefined) => WAMessageContent | undefined;
32
- /**
33
- * Extract the true message content from a message
34
- * Eg. extracts the inner message from a disappearing message/view once message
35
- */
36
- export declare const extractMessageContent: (content: WAMessageContent | undefined | null) => WAMessageContent | undefined;
37
- /**
38
- * Returns the device predicted by message ID
39
- */
40
- export declare const getDevice: (id: string) => "android" | "unknown" | "web" | "ios" | "desktop";
41
- /** Upserts a receipt in the message */
42
- export declare const updateMessageWithReceipt: (msg: Pick<WAMessage, "userReceipt">, receipt: MessageUserReceipt) => void;
43
- /** Update the message with a new reaction */
44
- export declare const updateMessageWithReaction: (msg: Pick<WAMessage, "reactions">, reaction: proto.IReaction) => void;
45
- /** Update the message with a new poll update */
46
- export declare const updateMessageWithPollUpdate: (msg: Pick<WAMessage, "pollUpdates">, update: proto.IPollUpdate) => void;
47
- type VoteAggregation = {
48
- name: string;
49
- voters: string[];
50
- };
51
- /**
52
- * Aggregates all poll updates in a poll.
53
- * @param msg the poll creation message
54
- * @param meId your jid
55
- * @returns A list of options & their voters
56
- */
57
- export declare function getAggregateVotesInPollMessage({ message, pollUpdates }: Pick<WAMessage, 'pollUpdates' | 'message'>, meId?: string): VoteAggregation[];
58
- /** Given a list of message keys, aggregates them by chat & sender. Useful for sending read receipts in bulk */
59
- export declare const aggregateMessageKeysNotFromMe: (keys: proto.IMessageKey[]) => {
60
- jid: string;
61
- participant: string | undefined;
62
- messageIds: string[];
63
- }[];
64
- type DownloadMediaMessageContext = {
65
- reuploadRequest: (msg: WAMessage) => Promise<WAMessage>;
66
- logger: Logger;
67
- };
68
- /**
69
- * Downloads the given message. Throws an error if it's not a media message
70
- */
71
- export declare const downloadMediaMessage: <Type extends "buffer" | "stream">(message: WAMessage, type: Type, options: MediaDownloadOptions, ctx?: DownloadMediaMessageContext) => Promise<Type extends "buffer" ? Buffer : Transform>;
72
- /** Checks whether the given message is a media message; if it is returns the inner content */
73
- export declare const assertMediaContent: (content: proto.IMessage | null | undefined) => proto.Message.IVideoMessage | proto.Message.IImageMessage | proto.Message.IAudioMessage | proto.Message.IDocumentMessage | proto.Message.IStickerMessage;
74
- export {};
@@ -1,20 +0,0 @@
1
- import { Logger } from 'pino';
2
- import { proto } from '../../WAProto';
3
- import { KeyPair } from '../Types';
4
- import { BinaryNode } from '../WABinary';
5
- export declare const makeNoiseHandler: ({ keyPair: { private: privateKey, public: publicKey }, NOISE_HEADER, mobile, logger, routingInfo }: {
6
- keyPair: KeyPair;
7
- NOISE_HEADER: Uint8Array;
8
- mobile: boolean;
9
- logger: Logger;
10
- routingInfo?: Buffer | undefined;
11
- }) => {
12
- encrypt: (plaintext: Uint8Array) => any;
13
- decrypt: (ciphertext: Uint8Array) => any;
14
- authenticate: (data: Uint8Array) => void;
15
- mixIntoKey: (data: Uint8Array) => void;
16
- finishInit: () => void;
17
- processHandshake: ({ serverHello }: proto.HandshakeMessage, noiseKey: KeyPair) => any;
18
- encodeFrame: (data: Buffer | Uint8Array) => any;
19
- decodeFrame: (newData: Buffer | Uint8Array, onFrame: (buff: Uint8Array | BinaryNode) => void) => void;
20
- };
@@ -1,41 +0,0 @@
1
- import { AxiosRequestConfig } from 'axios';
2
- import type { Logger } from 'pino';
3
- import { proto } from '../../WAProto';
4
- import { AuthenticationCreds, BaileysEventEmitter, SignalKeyStoreWithTransaction, SocketConfig } from '../Types';
5
- type ProcessMessageContext = {
6
- shouldProcessHistoryMsg: boolean;
7
- creds: AuthenticationCreds;
8
- keyStore: SignalKeyStoreWithTransaction;
9
- ev: BaileysEventEmitter;
10
- getMessage: SocketConfig['getMessage'];
11
- logger?: Logger;
12
- options: AxiosRequestConfig<{}>;
13
- };
14
- /** Cleans a received message to further processing */
15
- export declare const cleanMessage: (message: proto.IWebMessageInfo, meId: string) => void;
16
- export declare const isRealMessage: (message: proto.IWebMessageInfo, meId: string) => boolean | undefined;
17
- export declare const shouldIncrementChatUnread: (message: proto.IWebMessageInfo) => boolean;
18
- /**
19
- * Get the ID of the chat from the given key.
20
- * Typically -- that'll be the remoteJid, but for broadcasts, it'll be the participant
21
- */
22
- export declare const getChatId: ({ remoteJid, participant, fromMe }: proto.IMessageKey) => string;
23
- type PollContext = {
24
- /** normalised jid of the person that created the poll */
25
- pollCreatorJid: string;
26
- /** ID of the poll creation message */
27
- pollMsgId: string;
28
- /** poll creation message enc key */
29
- pollEncKey: Uint8Array;
30
- /** jid of the person that voted */
31
- voterJid: string;
32
- };
33
- /**
34
- * Decrypt a poll vote
35
- * @param vote encrypted vote
36
- * @param ctx additional info about the poll required for decryption
37
- * @returns list of SHA256 options
38
- */
39
- export declare function decryptPollVote({ encPayload, encIv }: proto.Message.IPollEncValue, { pollCreatorJid, pollMsgId, pollEncKey, voterJid, }: PollContext): proto.Message.PollVoteMessage;
40
- declare const processMessage: (message: proto.IWebMessageInfo, { shouldProcessHistoryMsg, ev, creds, keyStore, logger, options, getMessage }: ProcessMessageContext) => Promise<void>;
41
- export default processMessage;
@@ -1,32 +0,0 @@
1
- import { SignalRepository } from '../Types';
2
- import { AuthenticationCreds, AuthenticationState, KeyPair, SignalIdentity, SignalKeyStore, SignedKeyPair } from '../Types/Auth';
3
- import { BinaryNode, JidWithDevice } from '../WABinary';
4
- export declare const createSignalIdentity: (wid: string, accountSignatureKey: Uint8Array) => SignalIdentity;
5
- export declare const getPreKeys: ({ get }: SignalKeyStore, min: number, limit: number) => Promise<{
6
- [id: string]: KeyPair;
7
- }>;
8
- export declare const generateOrGetPreKeys: (creds: AuthenticationCreds, range: number) => {
9
- newPreKeys: {
10
- [id: number]: KeyPair;
11
- };
12
- lastPreKeyId: number;
13
- preKeysRange: readonly [number, number];
14
- };
15
- export declare const xmppSignedPreKey: (key: SignedKeyPair) => BinaryNode;
16
- export declare const xmppPreKey: (pair: KeyPair, id: number) => BinaryNode;
17
- export declare const parseAndInjectE2ESessions: (node: BinaryNode, repository: SignalRepository) => Promise<void>;
18
- export declare const extractDeviceJids: (result: BinaryNode, myJid: string, excludeZeroDevices: boolean) => JidWithDevice[];
19
- /**
20
- * get the next N keys for upload or processing
21
- * @param count number of pre-keys to get or generate
22
- */
23
- export declare const getNextPreKeys: ({ creds, keys }: AuthenticationState, count: number) => Promise<{
24
- update: Partial<AuthenticationCreds>;
25
- preKeys: {
26
- [id: string]: KeyPair;
27
- };
28
- }>;
29
- export declare const getNextPreKeysNode: (state: AuthenticationState, count: number) => Promise<{
30
- update: Partial<AuthenticationCreds>;
31
- node: BinaryNode;
32
- }>;
@@ -1,12 +0,0 @@
1
- import { AuthenticationState } from '../Types';
2
- /**
3
- * stores the full authentication state in a single folder.
4
- * Far more efficient than singlefileauthstate
5
- *
6
- * Again, I wouldn't endorse this for any production level use other than perhaps a bot.
7
- * Would recommend writing an auth state for use with a proper SQL or No-SQL DB
8
- * */
9
- export declare const useMultiFileAuthState: (folder: string) => Promise<{
10
- state: AuthenticationState;
11
- saveCreds: () => Promise<void>;
12
- }>;
@@ -1,11 +0,0 @@
1
- import { proto } from '../../WAProto';
2
- import type { AuthenticationCreds, SignalCreds, SocketConfig } from '../Types';
3
- import { BinaryNode } from '../WABinary';
4
- export declare const generateMobileNode: (config: SocketConfig) => proto.IClientPayload;
5
- export declare const generateLoginNode: (userJid: string, config: SocketConfig) => proto.IClientPayload;
6
- export declare const generateRegistrationNode: ({ registrationId, signedPreKey, signedIdentityKey }: SignalCreds, config: SocketConfig) => proto.ClientPayload;
7
- export declare const configureSuccessfulPairing: (stanza: BinaryNode, { advSecretKey, signedIdentityKey, signalIdentities }: Pick<AuthenticationCreds, "advSecretKey" | "signedIdentityKey" | "signalIdentities">) => {
8
- creds: Partial<AuthenticationCreds>;
9
- reply: BinaryNode;
10
- };
11
- export declare const encodeSignedDeviceIdentity: (account: proto.IADVSignedDeviceIdentity, includeSignatureKey: boolean) => any;
@@ -1,27 +0,0 @@
1
- export declare const TAGS: {
2
- LIST_EMPTY: number;
3
- DICTIONARY_0: number;
4
- DICTIONARY_1: number;
5
- DICTIONARY_2: number;
6
- DICTIONARY_3: number;
7
- AD_JID: number;
8
- LIST_8: number;
9
- LIST_16: number;
10
- JID_PAIR: number;
11
- HEX_8: number;
12
- BINARY_8: number;
13
- BINARY_20: number;
14
- BINARY_32: number;
15
- NIBBLE_8: number;
16
- PACKED_MAX: number;
17
- SINGLE_BYTE_MAX: number;
18
- STREAM_END: number;
19
- };
20
- export declare const DOUBLE_BYTE_TOKENS: string[][];
21
- export declare const SINGLE_BYTE_TOKENS: (string | null)[];
22
- export declare const TOKEN_MAP: {
23
- [token: string]: {
24
- dict?: number;
25
- index: number;
26
- };
27
- };
@@ -1,6 +0,0 @@
1
- import type { BinaryNode, BinaryNodeCodingOptions } from './types';
2
- export declare const decompressingIfRequired: (buffer: Buffer) => Buffer;
3
- export declare const decodeDecompressedBinaryNode: (buffer: Buffer, opts: Pick<BinaryNodeCodingOptions, "DOUBLE_BYTE_TOKENS" | "SINGLE_BYTE_TOKENS" | "TAGS">, indexRef?: {
4
- index: number;
5
- }) => BinaryNode;
6
- export declare const decodeBinaryNode: (buff: Buffer) => BinaryNode;
@@ -1,2 +0,0 @@
1
- import type { BinaryNode, BinaryNodeCodingOptions } from './types';
2
- export declare const encodeBinaryNode: (node: BinaryNode, opts?: Pick<BinaryNodeCodingOptions, "TAGS" | "TOKEN_MAP">, buffer?: number[]) => Buffer;
@@ -1,14 +0,0 @@
1
- import { proto } from '../../WAProto';
2
- import { BinaryNode } from './types';
3
- export declare const getBinaryNodeChildren: (node: BinaryNode | undefined, childTag: string) => BinaryNode[];
4
- export declare const getAllBinaryNodeChildren: ({ content }: BinaryNode) => BinaryNode[];
5
- export declare const getBinaryNodeChild: (node: BinaryNode | undefined, childTag: string) => BinaryNode | undefined;
6
- export declare const getBinaryNodeChildBuffer: (node: BinaryNode | undefined, childTag: string) => string | Uint8Array<ArrayBufferLike> | BinaryNode[] | undefined;
7
- export declare const getBinaryNodeChildString: (node: BinaryNode | undefined, childTag: string) => any;
8
- export declare const getBinaryNodeChildUInt: (node: BinaryNode, childTag: string, length: number) => number | undefined;
9
- export declare const assertNodeErrorFree: (node: BinaryNode) => void;
10
- export declare const reduceBinaryNodeToDictionary: (node: BinaryNode, tag: string) => {
11
- [_: string]: string;
12
- };
13
- export declare const getBinaryNodeMessages: ({ content }: BinaryNode) => proto.WebMessageInfo[];
14
- export declare function binaryNodeToString(node: BinaryNode | BinaryNode['content'], i?: number): any;
@@ -1,5 +0,0 @@
1
- export * from './encode';
2
- export * from './decode';
3
- export * from './generic-utils';
4
- export * from './jid-utils';
5
- export * from './types';
@@ -1,31 +0,0 @@
1
- export declare const S_WHATSAPP_NET = "@s.whatsapp.net";
2
- export declare const OFFICIAL_BIZ_JID = "16505361212@c.us";
3
- export declare const SERVER_JID = "server@c.us";
4
- export declare const PSA_WID = "0@c.us";
5
- export declare const STORIES_JID = "status@broadcast";
6
- export type JidServer = 'c.us' | 'g.us' | 'broadcast' | 's.whatsapp.net' | 'call' | 'lid' | 'newsletter';
7
- export type JidWithDevice = {
8
- user: string;
9
- device?: number;
10
- };
11
- export type FullJid = JidWithDevice & {
12
- server: JidServer | string;
13
- domainType?: number;
14
- };
15
- export declare const jidEncode: (user: string | number | null, server: JidServer, device?: number, agent?: number) => string;
16
- export declare const jidDecode: (jid: string | undefined) => FullJid | undefined;
17
- /** is the jid a user */
18
- export declare const areJidsSameUser: (jid1: string | undefined, jid2: string | undefined) => boolean;
19
- /** is the jid a user */
20
- export declare const isJidUser: (jid: string | undefined) => boolean | undefined;
21
- /** is the jid a group */
22
- export declare const isLidUser: (jid: string | undefined) => boolean | undefined;
23
- /** is the jid a broadcast */
24
- export declare const isJidBroadcast: (jid: string | undefined) => boolean | undefined;
25
- /** is the jid a group */
26
- export declare const isJidGroup: (jid: string | undefined) => boolean | undefined;
27
- /** is the jid the status broadcast */
28
- export declare const isJidStatusBroadcast: (jid: string) => jid is "status@broadcast";
29
- /** is the jid the newsletter */
30
- export declare const isJidNewsLetter: (jid: string | undefined) => boolean | undefined;
31
- export declare const jidNormalizedUser: (jid: string | undefined) => string;
@@ -1,18 +0,0 @@
1
- import * as constants from './constants';
2
- /**
3
- * the binary node WA uses internally for communication
4
- *
5
- * this is manipulated soley as an object and it does not have any functions.
6
- * This is done for easy serialization, to prevent running into issues with prototypes &
7
- * to maintain functional code structure
8
- * */
9
- export type BinaryNode = {
10
- tag: string;
11
- attrs: {
12
- [key: string]: string;
13
- };
14
- content?: BinaryNode[] | string | Uint8Array;
15
- };
16
- export type BinaryNodeAttributes = BinaryNode['attrs'];
17
- export type BinaryNodeData = BinaryNode['content'];
18
- export type BinaryNodeCodingOptions = typeof constants;
@@ -1,8 +0,0 @@
1
- import { EventInputType } from './constants';
2
- export declare class BinaryInfo {
3
- protocolVersion: number;
4
- sequence: number;
5
- events: EventInputType[];
6
- buffer: Buffer[];
7
- constructor(options?: Partial<BinaryInfo>);
8
- }
@@ -1,38 +0,0 @@
1
- export declare const WEB_EVENTS: Event[];
2
- export declare const WEB_GLOBALS: Global[];
3
- export declare const FLAG_BYTE = 8, FLAG_GLOBAL = 0, FLAG_EVENT = 1, FLAG_FIELD = 2, FLAG_EXTENDED = 4;
4
- export type Event = {
5
- name: string;
6
- id: number;
7
- props: {
8
- [key: string]: [number, string | {
9
- [key: string]: number;
10
- }];
11
- };
12
- weight: number;
13
- wamChannel: string;
14
- privateStatsIdInt: number;
15
- };
16
- export type Global = {
17
- name: string;
18
- id: number;
19
- type: string | {
20
- [key: string]: number;
21
- };
22
- validator?: string;
23
- channels: string[];
24
- };
25
- type EventByName<T extends Event['name']> = Extract<Event, {
26
- name: T;
27
- }>;
28
- export type EventInputType = {
29
- [key in Event['name']]: {
30
- props: {
31
- [k in keyof EventByName<key>['props']]: any;
32
- };
33
- globals: {
34
- [x: string]: any;
35
- };
36
- };
37
- } & {};
38
- export {};
@@ -1,2 +0,0 @@
1
- import { BinaryInfo } from './BinaryInfo';
2
- export declare const encodeWAM: (binaryInfo: BinaryInfo) => any;
@@ -1,3 +0,0 @@
1
- export * from './constants';
2
- export * from './encode';
3
- export * from './BinaryInfo';
@@ -1,9 +0,0 @@
1
- import { USyncQueryProtocol } from '../../Types/USync';
2
- import { BinaryNode } from '../../WABinary';
3
- import { USyncUser } from '../USyncUser';
4
- export declare class USyncContactProtocol implements USyncQueryProtocol {
5
- name: string;
6
- getQueryElement(): BinaryNode;
7
- getUserElement(user: USyncUser): BinaryNode;
8
- parser(node: BinaryNode): boolean;
9
- }
@@ -1,22 +0,0 @@
1
- import { USyncQueryProtocol } from '../../Types/USync';
2
- import { BinaryNode } from '../../WABinary';
3
- export type KeyIndexData = {
4
- timestamp: number;
5
- signedKeyIndex?: Uint8Array;
6
- expectedTimestamp?: number;
7
- };
8
- export type DeviceListData = {
9
- id: number;
10
- keyIndex?: number;
11
- isHosted?: boolean;
12
- };
13
- export type ParsedDeviceInfo = {
14
- deviceList?: DeviceListData[];
15
- keyIndex?: KeyIndexData;
16
- };
17
- export declare class USyncDeviceProtocol implements USyncQueryProtocol {
18
- name: string;
19
- getQueryElement(): BinaryNode;
20
- getUserElement(): BinaryNode | null;
21
- parser(node: BinaryNode): ParsedDeviceInfo;
22
- }
@@ -1,12 +0,0 @@
1
- import { USyncQueryProtocol } from '../../Types/USync';
2
- import { BinaryNode } from '../../WABinary';
3
- export type DisappearingModeData = {
4
- duration: number;
5
- setAt?: Date;
6
- };
7
- export declare class USyncDisappearingModeProtocol implements USyncQueryProtocol {
8
- name: string;
9
- getQueryElement(): BinaryNode;
10
- getUserElement(): null;
11
- parser(node: BinaryNode): DisappearingModeData | undefined;
12
- }
@@ -1,12 +0,0 @@
1
- import { USyncQueryProtocol } from '../../Types/USync';
2
- import { BinaryNode } from '../../WABinary';
3
- export type StatusData = {
4
- status?: string | null;
5
- setAt?: Date;
6
- };
7
- export declare class USyncStatusProtocol implements USyncQueryProtocol {
8
- name: string;
9
- getQueryElement(): BinaryNode;
10
- getUserElement(): null;
11
- parser(node: BinaryNode): StatusData | undefined;
12
- }
@@ -1,4 +0,0 @@
1
- export * from './USyncDeviceProtocol';
2
- export * from './USyncContactProtocol';
3
- export * from './USyncStatusProtocol';
4
- export * from './USyncDisappearingModeProtocol';
@@ -1,26 +0,0 @@
1
- import { USyncQueryProtocol } from '../Types/USync';
2
- import { BinaryNode } from '../WABinary';
3
- import { USyncUser } from './USyncUser';
4
- export type USyncQueryResultList = {
5
- [protocol: string]: unknown;
6
- id: string;
7
- };
8
- export type USyncQueryResult = {
9
- list: USyncQueryResultList[];
10
- sideList: USyncQueryResultList[];
11
- };
12
- export declare class USyncQuery {
13
- protocols: USyncQueryProtocol[];
14
- users: USyncUser[];
15
- context: string;
16
- mode: string;
17
- constructor();
18
- withMode(mode: string): this;
19
- withContext(context: string): this;
20
- withUser(user: USyncUser): this;
21
- parseUSyncQueryResult(result: BinaryNode): USyncQueryResult | undefined;
22
- withDeviceProtocol(): this;
23
- withContactProtocol(): this;
24
- withStatusProtocol(): this;
25
- withDisappearingModeProtocol(): this;
26
- }
@@ -1,10 +0,0 @@
1
- export declare class USyncUser {
2
- id: string;
3
- lid: string;
4
- phone: string;
5
- type: string;
6
- withId(id: string): this;
7
- withLid(lid: string): this;
8
- withPhone(phone: string): this;
9
- withType(type: string): this;
10
- }
@@ -1,3 +0,0 @@
1
- export * from './Protocols';
2
- export * from './USyncQuery';
3
- export * from './USyncUser';