@denzy-official/baileys 1.0.8 → 1.1.1

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