@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,116 +0,0 @@
1
- import { AxiosRequestConfig } from 'axios';
2
- import type { Agent } from 'https';
3
- import type { Logger } from 'pino';
4
- import type { URL } from 'url';
5
- import { proto } from '../../WAProto';
6
- import { AuthenticationState, SignalAuthState, TransactionCapabilityOptions } from './Auth';
7
- import { GroupMetadata } from './GroupMetadata';
8
- import { MediaConnInfo } from './Message';
9
- import { SignalRepository } from './Signal';
10
- export type WAVersion = [number, number, number];
11
- export type WABrowserDescription = [string, string, string];
12
- export type CacheStore = {
13
- /** get a cached key and change the stats */
14
- get<T>(key: string): T | undefined;
15
- /** set a key in the cache */
16
- set<T>(key: string, value: T): void;
17
- /** delete a key from the cache */
18
- del(key: string): void;
19
- /** flush all data */
20
- flushAll(): void;
21
- };
22
- export type SocketConfig = {
23
- /** the WS url to connect to WA */
24
- waWebSocketUrl: string | URL;
25
- /** Fails the connection if the socket times out in this interval */
26
- connectTimeoutMs: number;
27
- /** Default timeout for queries, undefined for no timeout */
28
- defaultQueryTimeoutMs: number | undefined;
29
- /** ping-pong interval for WS connection */
30
- keepAliveIntervalMs: number;
31
- /** should baileys use the mobile api instead of the multi device api */
32
- mobile?: boolean;
33
- /** proxy agent */
34
- agent?: Agent;
35
- /** pino logger */
36
- logger: Logger;
37
- /** version to connect with */
38
- version: WAVersion;
39
- /** override browser config */
40
- browser: WABrowserDescription;
41
- /** agent used for fetch requests -- uploading/downloading media */
42
- fetchAgent?: Agent;
43
- /** should the QR be printed in the terminal */
44
- printQRInTerminal: boolean;
45
- /** should events be emitted for actions done by this socket connection */
46
- emitOwnEvents: boolean;
47
- /** custom upload hosts to upload media to */
48
- customUploadHosts: MediaConnInfo['hosts'];
49
- /** time to wait between sending new retry requests */
50
- retryRequestDelayMs: number;
51
- /** max retry count */
52
- maxMsgRetryCount: number;
53
- /** time to wait for the generation of the next QR in ms */
54
- qrTimeout?: number;
55
- /** provide an auth state object to maintain the auth state */
56
- auth: AuthenticationState;
57
- /** manage history processing with this control; by default will sync up everything */
58
- shouldSyncHistoryMessage: (msg: proto.Message.IHistorySyncNotification) => boolean;
59
- /** transaction capability options for SignalKeyStore */
60
- transactionOpts: TransactionCapabilityOptions;
61
- /** marks the client as online whenever the socket successfully connects */
62
- markOnlineOnConnect: boolean;
63
- /** alphanumeric country code (USA -> US) for the number used */
64
- countryCode: string;
65
- /** provide a cache to store media, so does not have to be re-uploaded */
66
- mediaCache?: CacheStore;
67
- /**
68
- * map to store the retry counts for failed messages;
69
- * used to determine whether to retry a message or not */
70
- msgRetryCounterCache?: CacheStore;
71
- /** provide a cache to store a user's device list */
72
- userDevicesCache?: CacheStore;
73
- /** cache to store call offers */
74
- callOfferCache?: CacheStore;
75
- /** cache to track placeholder resends */
76
- placeholderResendCache?: CacheStore;
77
- /** width for link preview images */
78
- linkPreviewImageThumbnailWidth: number;
79
- /** Should Baileys ask the phone for full history, will be received async */
80
- syncFullHistory: boolean;
81
- /** Should baileys fire init queries automatically, default true */
82
- fireInitQueries: boolean;
83
- /**
84
- * generate a high quality link preview,
85
- * entails uploading the jpegThumbnail to WA
86
- * */
87
- generateHighQualityLinkPreview: boolean;
88
- /**
89
- * Returns if a jid should be ignored,
90
- * no event for that jid will be triggered.
91
- * Messages from that jid will also not be decrypted
92
- * */
93
- shouldIgnoreJid: (jid: string) => boolean | undefined;
94
- /**
95
- * Optionally patch the message before sending out
96
- * */
97
- patchMessageBeforeSending: (msg: proto.IMessage, recipientJids: string[]) => Promise<proto.IMessage> | proto.IMessage;
98
- /** verify app state MACs */
99
- appStateMacVerification: {
100
- patch: boolean;
101
- snapshot: boolean;
102
- };
103
- /** options for axios */
104
- options: AxiosRequestConfig<{}>;
105
- /**
106
- * fetch a message from your store
107
- * implement this so that messages failed to send
108
- * (solves the "this message can take a while" issue) can be retried
109
- * */
110
- getMessage: (key: proto.IMessageKey) => Promise<proto.IMessage | undefined>;
111
- /** cached group metadata, use to prevent redundant requests to WA & speed up msg sending */
112
- cachedGroupMetadata: (jid: string) => Promise<GroupMetadata | undefined>;
113
- makeSignalRepository: (auth: SignalAuthState) => SignalRepository;
114
- /** Socket passthrough */
115
- socket?: any;
116
- };
@@ -1,27 +0,0 @@
1
- import { Contact } from './Contact';
2
- export type WAConnectionState = 'open' | 'connecting' | 'close';
3
- export type ConnectionState = {
4
- /** connection is now open, connecting or closed */
5
- connection: WAConnectionState;
6
- /** the error that caused the connection to close */
7
- lastDisconnect?: {
8
- error: Error | undefined;
9
- date: Date;
10
- };
11
- /** is this a new login */
12
- isNewLogin?: boolean;
13
- /** the current QR code */
14
- qr?: string;
15
- /** has the device received all pending notifications while it was offline */
16
- receivedPendingNotifications?: boolean;
17
- /** legacy connection options */
18
- legacy?: {
19
- phoneConnected: boolean;
20
- user?: Contact;
21
- };
22
- /**
23
- * if the client is shown as an active, online client.
24
- * If this is false, the primary phone and other devices will receive notifs
25
- * */
26
- isOnline?: boolean;
27
- };
@@ -1,66 +0,0 @@
1
- export * from './Auth';
2
- export * from './GroupMetadata';
3
- export * from './Chat';
4
- export * from './Contact';
5
- export * from './State';
6
- export * from './Message';
7
- export * from './Newsletter';
8
- export * from './Socket';
9
- export * from './Events';
10
- export * from './Product';
11
- export * from './Call';
12
- export * from './Signal';
13
- import { AuthenticationState } from './Auth';
14
- import { SocketConfig } from './Socket';
15
- export type UserFacingSocketConfig = Partial<SocketConfig> & {
16
- auth: AuthenticationState;
17
- };
18
- export type BrowsersMap = {
19
- ubuntu(browser: string): [string, string, string];
20
- macOS(browser: string): [string, string, string];
21
- baileys(browser: string): [string, string, string];
22
- windows(browser: string): [string, string, string];
23
- iOS(browser: string): [string, string, string];
24
- linux(browser: string): [string, string, string];
25
- appropriate(browser: string): [string, string, string];
26
- };
27
- export declare enum DisconnectReason {
28
- connectionClosed = 428,
29
- connectionLost = 408,
30
- connectionReplaced = 440,
31
- timedOut = 408,
32
- loggedOut = 401,
33
- badSession = 500,
34
- restartRequired = 515,
35
- multideviceMismatch = 411,
36
- forbidden = 403,
37
- unavailableService = 503
38
- }
39
- export type WAInitResponse = {
40
- ref: string;
41
- ttl: number;
42
- status: 200;
43
- };
44
- export type WABusinessHoursConfig = {
45
- day_of_week: string;
46
- mode: string;
47
- open_time?: number;
48
- close_time?: number;
49
- };
50
- export type WABusinessProfile = {
51
- description: string;
52
- email: string | undefined;
53
- business_hours: {
54
- timezone?: string;
55
- config?: WABusinessHoursConfig[];
56
- business_config?: WABusinessHoursConfig[];
57
- };
58
- website: string[];
59
- category?: string;
60
- wid?: string;
61
- address?: string;
62
- };
63
- export type CurveKeyPair = {
64
- private: Uint8Array;
65
- public: Uint8Array;
66
- };
@@ -1,18 +0,0 @@
1
- import type { Logger } from 'pino';
2
- import type { AuthenticationCreds, CacheStore, SignalKeyStore, SignalKeyStoreWithTransaction, TransactionCapabilityOptions } from '../Types';
3
- /**
4
- * Adds caching capability to a SignalKeyStore
5
- * @param store the store to add caching to
6
- * @param logger to log trace events
7
- * @param _cache cache store to use
8
- */
9
- export declare function makeCacheableSignalKeyStore(store: SignalKeyStore, logger: Logger, _cache?: CacheStore): SignalKeyStore;
10
- /**
11
- * Adds DB like transaction capability (https://en.wikipedia.org/wiki/Database_transaction) to the SignalKeyStore,
12
- * this allows batch read & write operations & improves the performance of the lib
13
- * @param state the key store to apply this capability to
14
- * @param logger logger to log events
15
- * @returns SignalKeyStore with transaction capability
16
- */
17
- export declare const addTransactionCapability: (state: SignalKeyStore, logger: Logger, { maxCommitRetries, delayBetweenTriesMs }: TransactionCapabilityOptions) => SignalKeyStoreWithTransaction;
18
- export declare const initAuthCreds: () => AuthenticationCreds;
@@ -1,16 +0,0 @@
1
- import type { BaileysEventEmitter } from '../Types';
2
- /**
3
- * Captures events from a baileys event emitter & stores them in a file
4
- * @param ev The event emitter to read events from
5
- * @param filename File to save to
6
- */
7
- export declare const captureEventStream: (ev: BaileysEventEmitter, filename: string) => void;
8
- /**
9
- * Read event file and emit events from there
10
- * @param filename filename containing event data
11
- * @param delayIntervalMs delay between each event emit
12
- */
13
- export declare const readAndEmitEventStream: (filename: string, delayIntervalMs?: number) => {
14
- ev: BaileysEventEmitter;
15
- task: Promise<void>;
16
- };
@@ -1,22 +0,0 @@
1
- import { CatalogCollection, OrderDetails, Product, ProductCreate, ProductUpdate, WAMediaUpload, WAMediaUploadFunction } from '../Types';
2
- import { BinaryNode } from '../WABinary';
3
- export declare const parseCatalogNode: (node: BinaryNode) => {
4
- products: Product[];
5
- nextPageCursor: any;
6
- };
7
- export declare const parseCollectionsNode: (node: BinaryNode) => {
8
- collections: CatalogCollection[];
9
- };
10
- export declare const parseOrderDetailsNode: (node: BinaryNode) => OrderDetails;
11
- export declare const toProductNode: (productId: string | undefined, product: ProductCreate | ProductUpdate) => BinaryNode;
12
- export declare const parseProductNode: (productNode: BinaryNode) => Product;
13
- /**
14
- * Uploads images not already uploaded to WA's servers
15
- */
16
- export declare function uploadingNecessaryImagesOfProduct<T extends ProductUpdate | ProductCreate>(product: T, waUploadToServer: WAMediaUploadFunction, timeoutMs?: number): Promise<T>;
17
- /**
18
- * Uploads images not already uploaded to WA's servers
19
- */
20
- export declare const uploadingNecessaryImages: (images: WAMediaUpload[], waUploadToServer: WAMediaUploadFunction, timeoutMs?: number) => Promise<{
21
- url: string;
22
- }[]>;
@@ -1,70 +0,0 @@
1
- import { AxiosRequestConfig } from 'axios';
2
- import type { Logger } from 'pino';
3
- import { proto } from '../../WAProto';
4
- import { BaileysEventEmitter, ChatModification, ChatMutation, Contact, InitialAppStateSyncOptions, LTHashState, WAPatchCreate, WAPatchName } from '../Types';
5
- import { BinaryNode } from '../WABinary';
6
- type FetchAppStateSyncKey = (keyId: string) => Promise<proto.Message.IAppStateSyncKeyData | null | undefined>;
7
- export type ChatMutationMap = {
8
- [index: string]: ChatMutation;
9
- };
10
- export declare const newLTHashState: () => LTHashState;
11
- export declare const encodeSyncdPatch: ({ type, index, syncAction, apiVersion, operation }: WAPatchCreate, myAppStateKeyId: string, state: LTHashState, getAppStateSyncKey: FetchAppStateSyncKey) => Promise<{
12
- patch: proto.ISyncdPatch;
13
- state: LTHashState;
14
- }>;
15
- export declare const decodeSyncdMutations: (msgMutations: (proto.ISyncdMutation | proto.ISyncdRecord)[], initialState: LTHashState, getAppStateSyncKey: FetchAppStateSyncKey, onMutation: (mutation: ChatMutation) => void, validateMacs: boolean) => Promise<{
16
- hash: any;
17
- indexValueMap: {
18
- [indexMacBase64: string]: {
19
- valueMac: Uint8Array | Buffer;
20
- };
21
- };
22
- }>;
23
- export declare const decodeSyncdPatch: (msg: proto.ISyncdPatch, name: WAPatchName, initialState: LTHashState, getAppStateSyncKey: FetchAppStateSyncKey, onMutation: (mutation: ChatMutation) => void, validateMacs: boolean) => Promise<{
24
- hash: any;
25
- indexValueMap: {
26
- [indexMacBase64: string]: {
27
- valueMac: Uint8Array | Buffer;
28
- };
29
- };
30
- }>;
31
- export declare const extractSyncdPatches: (result: BinaryNode, options: AxiosRequestConfig<{}>) => Promise<{
32
- critical_block: {
33
- patches: proto.ISyncdPatch[];
34
- hasMorePatches: boolean;
35
- snapshot?: proto.ISyncdSnapshot;
36
- };
37
- critical_unblock_low: {
38
- patches: proto.ISyncdPatch[];
39
- hasMorePatches: boolean;
40
- snapshot?: proto.ISyncdSnapshot;
41
- };
42
- regular_high: {
43
- patches: proto.ISyncdPatch[];
44
- hasMorePatches: boolean;
45
- snapshot?: proto.ISyncdSnapshot;
46
- };
47
- regular_low: {
48
- patches: proto.ISyncdPatch[];
49
- hasMorePatches: boolean;
50
- snapshot?: proto.ISyncdSnapshot;
51
- };
52
- regular: {
53
- patches: proto.ISyncdPatch[];
54
- hasMorePatches: boolean;
55
- snapshot?: proto.ISyncdSnapshot;
56
- };
57
- }>;
58
- export declare const downloadExternalBlob: (blob: proto.IExternalBlobReference, options: AxiosRequestConfig<{}>) => Promise<any>;
59
- export declare const downloadExternalPatch: (blob: proto.IExternalBlobReference, options: AxiosRequestConfig<{}>) => Promise<proto.SyncdMutations>;
60
- export declare const decodeSyncdSnapshot: (name: WAPatchName, snapshot: proto.ISyncdSnapshot, getAppStateSyncKey: FetchAppStateSyncKey, minimumVersionNumber: number | undefined, validateMacs?: boolean) => Promise<{
61
- state: LTHashState;
62
- mutationMap: ChatMutationMap;
63
- }>;
64
- export declare const decodePatches: (name: WAPatchName, syncds: proto.ISyncdPatch[], initial: LTHashState, getAppStateSyncKey: FetchAppStateSyncKey, options: AxiosRequestConfig<{}>, minimumVersionNumber?: number, logger?: Logger, validateMacs?: boolean) => Promise<{
65
- state: LTHashState;
66
- mutationMap: ChatMutationMap;
67
- }>;
68
- export declare const chatModificationToAppPatch: (mod: ChatModification, jid: string) => WAPatchCreate;
69
- export declare const processSyncAction: (syncAction: ChatMutation, ev: BaileysEventEmitter, me: Contact, initialSyncOpts?: InitialAppStateSyncOptions, logger?: Logger) => void;
70
- export {};
@@ -1,40 +0,0 @@
1
- import { KeyPair } from '../Types';
2
- /** prefix version byte to the pub keys, required for some curve crypto functions */
3
- export declare const generateSignalPubKey: (pubKey: Uint8Array | Buffer) => any;
4
- export declare const Curve: {
5
- generateKeyPair: () => KeyPair;
6
- sharedKey: (privateKey: Uint8Array, publicKey: Uint8Array) => any;
7
- sign: (privateKey: Uint8Array, buf: Uint8Array) => any;
8
- verify: (pubKey: Uint8Array, message: Uint8Array, signature: Uint8Array) => boolean;
9
- };
10
- export declare const signedKeyPair: (identityKeyPair: KeyPair, keyId: number) => {
11
- keyPair: KeyPair;
12
- signature: any;
13
- keyId: number;
14
- };
15
- /**
16
- * encrypt AES 256 GCM;
17
- * where the tag tag is suffixed to the ciphertext
18
- * */
19
- export declare function aesEncryptGCM(plaintext: Uint8Array, key: Uint8Array, iv: Uint8Array, additionalData: Uint8Array): any;
20
- /**
21
- * decrypt AES 256 GCM;
22
- * where the auth tag is suffixed to the ciphertext
23
- * */
24
- export declare function aesDecryptGCM(ciphertext: Uint8Array, key: Uint8Array, iv: Uint8Array, additionalData: Uint8Array): any;
25
- export declare function aesEncryptCTR(plaintext: Uint8Array, key: Uint8Array, iv: Uint8Array): any;
26
- export declare function aesDecryptCTR(ciphertext: Uint8Array, key: Uint8Array, iv: Uint8Array): any;
27
- /** decrypt AES 256 CBC; where the IV is prefixed to the buffer */
28
- export declare function aesDecrypt(buffer: Buffer, key: Buffer): any;
29
- /** decrypt AES 256 CBC */
30
- export declare function aesDecryptWithIV(buffer: Buffer, key: Buffer, IV: Buffer): any;
31
- export declare function aesEncrypt(buffer: Buffer | Uint8Array, key: Buffer): any;
32
- export declare function aesEncrypWithIV(buffer: Buffer, key: Buffer, IV: Buffer): any;
33
- export declare function hmacSign(buffer: Buffer | Uint8Array, key: Buffer | Uint8Array, variant?: 'sha256' | 'sha512'): any;
34
- export declare function sha256(buffer: Buffer): any;
35
- export declare function md5(buffer: Buffer): any;
36
- export declare function hkdf(buffer: Uint8Array | Buffer, expandedLength: number, info: {
37
- salt?: Buffer;
38
- info?: string;
39
- }): any;
40
- export declare function derivePairingCodeKey(pairingCode: string, salt: Buffer): Promise<any>;
@@ -1,36 +0,0 @@
1
- import { Logger } from 'pino';
2
- import { proto } from '../../WAProto';
3
- import { SignalRepository } from '../Types';
4
- import { BinaryNode } from '../WABinary';
5
- export declare const NO_MESSAGE_FOUND_ERROR_TEXT = "Message absent from node";
6
- export declare const MISSING_KEYS_ERROR_TEXT = "Key used already or never filled";
7
- export declare const NACK_REASONS: {
8
- ParsingError: number;
9
- UnrecognizedStanza: number;
10
- UnrecognizedStanzaClass: number;
11
- UnrecognizedStanzaType: number;
12
- InvalidProtobuf: number;
13
- InvalidHostedCompanionStanza: number;
14
- MissingMessageSecret: number;
15
- SignalErrorOldCounter: number;
16
- MessageDeletedOnPeer: number;
17
- UnhandledError: number;
18
- UnsupportedAdminRevoke: number;
19
- UnsupportedLIDGroup: number;
20
- DBOperationFailed: number;
21
- };
22
- /**
23
- * Decode the received node as a message.
24
- * @note this will only parse the message, not decrypt it
25
- */
26
- export declare function decodeMessageNode(stanza: BinaryNode, meId: string, meLid: string): {
27
- fullMessage: proto.IWebMessageInfo;
28
- author: string;
29
- sender: string;
30
- };
31
- export declare const decryptMessageNode: (stanza: BinaryNode, meId: string, meLid: string, repository: SignalRepository, logger: Logger) => {
32
- fullMessage: proto.IWebMessageInfo;
33
- category: string;
34
- author: string;
35
- decrypt(): Promise<void>;
36
- };
@@ -1,35 +0,0 @@
1
- import { Logger } from 'pino';
2
- import { BaileysEventEmitter, BaileysEventMap } from '../Types';
3
- /**
4
- * A map that contains a list of all events that have been triggered
5
- *
6
- * Note, this can contain different type of events
7
- * this can make processing events extremely efficient -- since everything
8
- * can be done in a single transaction
9
- */
10
- type BaileysEventData = Partial<BaileysEventMap>;
11
- type BaileysBufferableEventEmitter = BaileysEventEmitter & {
12
- /** Use to process events in a batch */
13
- process(handler: (events: BaileysEventData) => void | Promise<void>): (() => void);
14
- /**
15
- * starts buffering events, call flush() to release them
16
- * */
17
- buffer(): void;
18
- /** buffers all events till the promise completes */
19
- createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
20
- /**
21
- * flushes all buffered events
22
- * @param force if true, will flush all data regardless of any pending buffers
23
- * @returns returns true if the flush actually happened, otherwise false
24
- */
25
- flush(force?: boolean): boolean;
26
- /** is there an ongoing buffer */
27
- isBuffering(): boolean;
28
- };
29
- /**
30
- * The event buffer logically consolidates different events into a single event
31
- * making the data processing more efficient.
32
- * @param ev the baileys event emitter
33
- */
34
- export declare const makeEventBuffer: (logger: Logger) => BaileysBufferableEventEmitter;
35
- export {};
@@ -1,88 +0,0 @@
1
- import { AxiosRequestConfig } from 'axios';
2
- import { Logger } from 'pino';
3
- import { proto } from '../../WAProto';
4
- import { BaileysEventEmitter, BaileysEventMap, BrowsersMap, ConnectionState, WACallUpdateType, WAVersion } from '../Types';
5
- import { BinaryNode } from '../WABinary';
6
- export declare const Browsers: BrowsersMap;
7
- export declare const getPlatformId: (browser: string) => any;
8
- export declare const BufferJSON: {
9
- replacer: (k: any, value: any) => any;
10
- reviver: (_: any, value: any) => any;
11
- };
12
- export declare const getKeyAuthor: (key: proto.IMessageKey | undefined | null, meId?: string) => string;
13
- export declare const writeRandomPadMax16: (msg: Uint8Array) => any;
14
- export declare const unpadRandomMax16: (e: Uint8Array | Buffer) => Uint8Array<any>;
15
- export declare const encodeWAMessage: (message: proto.IMessage) => any;
16
- export declare const generateRegistrationId: () => number;
17
- export declare const encodeBigEndian: (e: number, t?: number) => Uint8Array<ArrayBuffer>;
18
- export declare const toNumber: (t: Long | number | null | undefined) => number;
19
- /** unix timestamp of a date in seconds */
20
- export declare const unixTimestampSeconds: (date?: Date) => number;
21
- export type DebouncedTimeout = ReturnType<typeof debouncedTimeout>;
22
- export declare const debouncedTimeout: (intervalMs?: number, task?: () => void) => {
23
- start: (newIntervalMs?: number, newTask?: () => void) => void;
24
- cancel: () => void;
25
- setTask: (newTask: () => void) => () => void;
26
- setInterval: (newInterval: number) => number;
27
- };
28
- export declare const delay: (ms: number) => Promise<void>;
29
- export declare const delayCancellable: (ms: number) => {
30
- delay: Promise<void>;
31
- cancel: () => void;
32
- };
33
- export declare function promiseTimeout<T>(ms: number | undefined, promise: (resolve: (v: T) => void, reject: (error: any) => void) => void): Promise<T>;
34
- export declare const generateMessageIDV2: (userId?: string) => string;
35
- export declare const generateMessageID: () => string;
36
- export declare function bindWaitForEvent<T extends keyof BaileysEventMap>(ev: BaileysEventEmitter, event: T): (check: (u: BaileysEventMap[T]) => boolean | undefined, timeoutMs?: number) => Promise<void>;
37
- export declare const bindWaitForConnectionUpdate: (ev: BaileysEventEmitter) => (check: (u: Partial<ConnectionState>) => boolean | undefined, timeoutMs?: number) => Promise<void>;
38
- export declare const printQRIfNecessaryListener: (ev: BaileysEventEmitter, logger: Logger) => void;
39
- /**
40
- * utility that fetches latest baileys version from the master branch.
41
- * Use to ensure your WA connection is always on the latest version
42
- */
43
- export declare const fetchLatestBaileysVersion: (options?: AxiosRequestConfig<any>) => Promise<{
44
- version: any;
45
- isLatest: boolean;
46
- error?: undefined;
47
- } | {
48
- version: WAVersion;
49
- isLatest: boolean;
50
- error: any;
51
- }>;
52
- /**
53
- * A utility that fetches the latest web version of whatsapp.
54
- * Use to ensure your WA connection is always on the latest version
55
- */
56
- export declare const fetchLatestWaWebVersion: (options: AxiosRequestConfig<any>) => Promise<{
57
- version: WAVersion;
58
- isLatest: boolean;
59
- error?: undefined;
60
- } | {
61
- version: WAVersion;
62
- isLatest: boolean;
63
- error: any;
64
- }>;
65
- /** unique message tag prefix for MD clients */
66
- export declare const generateMdTagPrefix: () => string;
67
- /**
68
- * Given a type of receipt, returns what the new status of the message should be
69
- * @param type type from receipt
70
- */
71
- export declare const getStatusFromReceiptType: (type: string | undefined) => proto.WebMessageInfo.Status;
72
- /**
73
- * Stream errors generally provide a reason, map that to a baileys DisconnectReason
74
- * @param reason the string reason given, eg. "conflict"
75
- */
76
- export declare const getErrorCodeFromStreamError: (node: BinaryNode) => {
77
- reason: string;
78
- statusCode: number;
79
- };
80
- export declare const getCallStatusFromNode: ({ tag, attrs }: BinaryNode) => WACallUpdateType;
81
- export declare const getCodeFromWSError: (error: Error) => number;
82
- /**
83
- * Is the given platform WA business
84
- * @param platform AuthenticationCreds.platform
85
- */
86
- export declare const isWABusinessPlatform: (platform: string) => platform is "smbi" | "smba";
87
- export declare function trimUndefined(obj: any): any;
88
- export declare function bytesToCrockford(buffer: Buffer): string;
@@ -1,19 +0,0 @@
1
- import { AxiosRequestConfig } from 'axios';
2
- import { proto } from '../../WAProto';
3
- import { Chat, Contact } from '../Types';
4
- export declare const downloadHistory: (msg: proto.Message.IHistorySyncNotification, options: AxiosRequestConfig<{}>) => Promise<proto.HistorySync>;
5
- export declare const processHistoryMessage: (item: proto.IHistorySync) => {
6
- chats: Chat[];
7
- contacts: Contact[];
8
- messages: proto.IWebMessageInfo[];
9
- syncType: proto.HistorySync.HistorySyncType;
10
- progress: number | null | undefined;
11
- };
12
- export declare const downloadAndProcessHistorySyncNotification: (msg: proto.Message.IHistorySyncNotification, options: AxiosRequestConfig<{}>) => Promise<{
13
- chats: Chat[];
14
- contacts: Contact[];
15
- messages: proto.IWebMessageInfo[];
16
- syncType: proto.HistorySync.HistorySyncType;
17
- progress: number | null | undefined;
18
- }>;
19
- export declare const getHistoryMsg: (message: proto.IMessage) => proto.Message.IHistorySyncNotification | null | undefined;
@@ -1,17 +0,0 @@
1
- export * from './generics';
2
- export * from './decode-wa-message';
3
- export * from './messages';
4
- export * from './messages-media';
5
- export * from './validate-connection';
6
- export * from './crypto';
7
- export * from './signal';
8
- export * from './noise-handler';
9
- export * from './history';
10
- export * from './chat-utils';
11
- export * from './lt-hash';
12
- export * from './auth-utils';
13
- export * from './baileys-event-stream';
14
- export * from './use-multi-file-auth-state';
15
- export * from './link-preview';
16
- export * from './event-buffer';
17
- export * from './process-message';
@@ -1,21 +0,0 @@
1
- import { AxiosRequestConfig } from 'axios';
2
- import { Logger } from 'pino';
3
- import { WAMediaUploadFunction, WAUrlInfo } from '../Types';
4
- export type URLGenerationOptions = {
5
- thumbnailWidth: number;
6
- fetchOpts: {
7
- /** Timeout in ms */
8
- timeout: number;
9
- proxyUrl?: string;
10
- headers?: AxiosRequestConfig<{}>['headers'];
11
- };
12
- uploadImage?: WAMediaUploadFunction;
13
- logger?: Logger;
14
- };
15
- /**
16
- * Given a piece of text, checks for any URL present, generates link preview for the same and returns it
17
- * Return undefined if the fetch failed or no URL was found
18
- * @param text first matched URL in text
19
- * @returns the URL info required to generate link preview
20
- */
21
- export declare const getUrlInfo: (text: string, opts?: URLGenerationOptions) => Promise<WAUrlInfo | undefined>;
@@ -1,2 +0,0 @@
1
- declare const _default: any;
2
- export default _default;
@@ -1,12 +0,0 @@
1
- declare class d {
2
- salt: string;
3
- constructor(e: string);
4
- add(e: any, t: any): any;
5
- subtract(e: any, t: any): any;
6
- subtractThenAdd(e: any, t: any, r: any): any;
7
- _addSingle(e: any, t: any): ArrayBuffer;
8
- _subtractSingle(e: any, t: any): ArrayBuffer;
9
- performPointwiseWithOverflow(e: any, t: any, r: any): ArrayBuffer;
10
- }
11
- export declare const LT_HASH_ANTI_TAMPERING: d;
12
- export {};
@@ -1,7 +0,0 @@
1
- export declare const makeMutex: () => {
2
- mutex<T>(code: () => Promise<T> | T): Promise<T>;
3
- };
4
- export type Mutex = ReturnType<typeof makeMutex>;
5
- export declare const makeKeyedMutex: () => {
6
- mutex<T>(key: string, task: () => Promise<T> | T): Promise<T>;
7
- };