gifted-baileys 1.5.0 → 1.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +1429 -684
- package/package.json +11 -26
- package/src/Defaults/baileys-version.json +3 -0
- package/{lib → src}/Defaults/index.js +16 -8
- package/src/Defaults/index.ts +131 -0
- package/src/Defaults/phonenumber-mcc.json +223 -0
- package/src/Signal/libsignal.js +180 -0
- package/src/Signal/libsignal.ts +141 -0
- package/src/Socket/Client/abstract-socket-client.ts +19 -0
- package/src/Socket/Client/index.ts +3 -0
- package/src/Socket/Client/mobile-socket-client.js +78 -0
- package/src/Socket/Client/mobile-socket-client.ts +66 -0
- package/src/Socket/Client/web-socket-client.js +75 -0
- package/src/Socket/Client/web-socket-client.ts +57 -0
- package/{lib → src}/Socket/business.js +33 -27
- package/src/Socket/business.ts +281 -0
- package/{lib → src}/Socket/chats.js +197 -178
- package/src/Socket/chats.ts +1030 -0
- package/{lib → src}/Socket/groups.js +69 -79
- package/src/Socket/groups.ts +356 -0
- package/{lib → src}/Socket/index.js +1 -4
- package/src/Socket/index.ts +13 -0
- package/{lib → src}/Socket/messages-recv.js +160 -108
- package/src/Socket/messages-recv.ts +985 -0
- package/{lib → src}/Socket/messages-send.js +183 -100
- package/src/Socket/messages-send.ts +871 -0
- package/src/Socket/newsletter.js +227 -0
- package/src/Socket/newsletter.ts +282 -0
- package/{lib → src}/Socket/registration.js +55 -63
- package/src/Socket/registration.ts +250 -0
- package/{lib → src}/Socket/socket.js +107 -66
- package/src/Socket/socket.ts +777 -0
- package/src/Store/index.ts +3 -0
- package/{lib → src}/Store/make-cache-manager-store.js +34 -25
- package/src/Store/make-cache-manager-store.ts +100 -0
- package/{lib → src}/Store/make-in-memory-store.js +51 -61
- package/src/Store/make-in-memory-store.ts +475 -0
- package/src/Store/make-ordered-dictionary.ts +86 -0
- package/{lib → src}/Store/object-repository.js +1 -1
- package/src/Store/object-repository.ts +32 -0
- package/src/Tests/test.app-state-sync.js +204 -0
- package/src/Tests/test.app-state-sync.ts +207 -0
- package/src/Tests/test.event-buffer.js +270 -0
- package/src/Tests/test.event-buffer.ts +319 -0
- package/src/Tests/test.key-store.js +76 -0
- package/src/Tests/test.key-store.ts +92 -0
- package/src/Tests/test.libsignal.js +141 -0
- package/src/Tests/test.libsignal.ts +186 -0
- package/src/Tests/test.media-download.js +93 -0
- package/src/Tests/test.media-download.ts +76 -0
- package/src/Tests/test.messages.js +33 -0
- package/src/Tests/test.messages.ts +37 -0
- package/src/Tests/utils.js +34 -0
- package/src/Tests/utils.ts +36 -0
- package/src/Types/Auth.ts +113 -0
- package/src/Types/Call.ts +15 -0
- package/src/Types/Chat.ts +106 -0
- package/{lib/Types/Contact.d.ts → src/Types/Contact.ts} +9 -8
- package/src/Types/Events.ts +93 -0
- package/src/Types/GroupMetadata.ts +53 -0
- package/{lib → src}/Types/Label.js +1 -1
- package/src/Types/Label.ts +36 -0
- package/{lib → src}/Types/LabelAssociation.js +1 -1
- package/{lib/Types/LabelAssociation.d.ts → src/Types/LabelAssociation.ts} +22 -16
- package/src/Types/Message.ts +288 -0
- package/src/Types/Newsletter.js +32 -0
- package/src/Types/Newsletter.ts +98 -0
- package/src/Types/Product.ts +85 -0
- package/src/Types/Signal.ts +68 -0
- package/{lib/Types/Socket.d.ts → src/Types/Socket.ts} +68 -56
- package/src/Types/State.ts +29 -0
- package/{lib → src}/Types/index.js +2 -1
- package/src/Types/index.ts +59 -0
- package/{lib → src}/Utils/auth-utils.js +95 -76
- package/src/Utils/auth-utils.ts +222 -0
- package/src/Utils/baileys-event-stream.js +92 -0
- package/src/Utils/baileys-event-stream.ts +66 -0
- package/{lib → src}/Utils/business.js +45 -17
- package/src/Utils/business.ts +275 -0
- package/{lib → src}/Utils/chat-utils.js +74 -46
- package/src/Utils/chat-utils.ts +860 -0
- package/{lib → src}/Utils/crypto.js +31 -21
- package/src/Utils/crypto.ts +131 -0
- package/src/Utils/decode-wa-message.js +211 -0
- package/src/Utils/decode-wa-message.ts +228 -0
- package/{lib → src}/Utils/event-buffer.js +13 -4
- package/src/Utils/event-buffer.ts +613 -0
- package/{lib → src}/Utils/generics.js +98 -45
- package/src/Utils/generics.ts +434 -0
- package/{lib → src}/Utils/history.js +39 -10
- package/src/Utils/history.ts +112 -0
- package/src/Utils/index.ts +17 -0
- package/{lib → src}/Utils/link-preview.js +54 -17
- package/src/Utils/link-preview.ts +122 -0
- package/src/Utils/logger.ts +3 -0
- package/src/Utils/lt-hash.ts +61 -0
- package/{lib → src}/Utils/make-mutex.js +13 -4
- package/src/Utils/make-mutex.ts +44 -0
- package/{lib → src}/Utils/messages-media.js +296 -192
- package/src/Utils/messages-media.ts +847 -0
- package/{lib → src}/Utils/messages.js +124 -113
- package/src/Utils/messages.ts +956 -0
- package/{lib → src}/Utils/noise-handler.js +16 -3
- package/src/Utils/noise-handler.ts +197 -0
- package/{lib → src}/Utils/process-message.js +33 -29
- package/src/Utils/process-message.ts +414 -0
- package/{lib → src}/Utils/signal.js +23 -14
- package/src/Utils/signal.ts +177 -0
- package/{lib → src}/Utils/use-multi-file-auth-state.js +28 -19
- package/src/Utils/use-multi-file-auth-state.ts +90 -0
- package/{lib → src}/Utils/validate-connection.js +25 -42
- package/src/Utils/validate-connection.ts +238 -0
- package/src/WABinary/constants.ts +42 -0
- package/{lib → src}/WABinary/decode.js +17 -7
- package/src/WABinary/decode.ts +265 -0
- package/{lib → src}/WABinary/encode.js +17 -7
- package/src/WABinary/encode.ts +236 -0
- package/{lib → src}/WABinary/generic-utils.js +2 -2
- package/src/WABinary/generic-utils.ts +121 -0
- package/src/WABinary/index.ts +5 -0
- package/{lib → src}/WABinary/jid-utils.js +4 -1
- package/src/WABinary/jid-utils.ts +68 -0
- package/src/WABinary/types.ts +17 -0
- package/src/WAM/BinaryInfo.js +13 -0
- package/src/WAM/BinaryInfo.ts +12 -0
- package/src/WAM/constants.js +15350 -0
- package/src/WAM/constants.ts +15382 -0
- package/src/WAM/encode.js +155 -0
- package/src/WAM/encode.ts +174 -0
- package/src/WAM/index.js +19 -0
- package/src/WAM/index.ts +3 -0
- package/src/gifted +1 -0
- package/{lib → src}/index.js +1 -0
- package/src/index.ts +13 -0
- package/lib/Defaults/baileys-version.json +0 -3
- package/lib/Defaults/index.d.ts +0 -284
- package/lib/Defaults/phonenumber-mcc.json +0 -223
- package/lib/Signal/libsignal.d.ts +0 -3
- package/lib/Signal/libsignal.js +0 -152
- package/lib/Socket/Client/abstract-socket-client.d.ts +0 -17
- package/lib/Socket/Client/index.d.ts +0 -3
- package/lib/Socket/Client/mobile-socket-client.d.ts +0 -13
- package/lib/Socket/Client/mobile-socket-client.js +0 -65
- package/lib/Socket/Client/web-socket-client.d.ts +0 -12
- package/lib/Socket/Client/web-socket-client.js +0 -62
- package/lib/Socket/business.d.ts +0 -135
- package/lib/Socket/chats.d.ts +0 -79
- package/lib/Socket/groups.d.ts +0 -113
- package/lib/Socket/index.d.ts +0 -137
- package/lib/Socket/messages-recv.d.ts +0 -124
- package/lib/Socket/messages-send.d.ts +0 -119
- package/lib/Socket/registration.d.ts +0 -232
- package/lib/Socket/socket.d.ts +0 -42
- package/lib/Store/index.d.ts +0 -3
- package/lib/Store/make-cache-manager-store.d.ts +0 -13
- package/lib/Store/make-in-memory-store.d.ts +0 -117
- package/lib/Store/make-ordered-dictionary.d.ts +0 -13
- package/lib/Store/object-repository.d.ts +0 -10
- package/lib/Types/Auth.d.ts +0 -108
- package/lib/Types/Call.d.ts +0 -13
- package/lib/Types/Chat.d.ts +0 -102
- package/lib/Types/Events.d.ts +0 -157
- package/lib/Types/GroupMetadata.d.ts +0 -52
- package/lib/Types/Label.d.ts +0 -35
- package/lib/Types/Message.d.ts +0 -261
- package/lib/Types/Product.d.ts +0 -78
- package/lib/Types/Signal.d.ts +0 -57
- package/lib/Types/State.d.ts +0 -27
- package/lib/Types/index.d.ts +0 -56
- package/lib/Utils/auth-utils.d.ts +0 -18
- package/lib/Utils/baileys-event-stream.d.ts +0 -16
- package/lib/Utils/baileys-event-stream.js +0 -63
- package/lib/Utils/business.d.ts +0 -22
- package/lib/Utils/chat-utils.d.ts +0 -71
- package/lib/Utils/crypto.d.ts +0 -41
- package/lib/Utils/decode-wa-message.d.ts +0 -19
- package/lib/Utils/decode-wa-message.js +0 -174
- package/lib/Utils/event-buffer.d.ts +0 -35
- package/lib/Utils/generics.d.ts +0 -94
- package/lib/Utils/history.d.ts +0 -15
- package/lib/Utils/index.d.ts +0 -17
- package/lib/Utils/link-preview.d.ts +0 -21
- package/lib/Utils/logger.d.ts +0 -4
- package/lib/Utils/lt-hash.d.ts +0 -12
- package/lib/Utils/make-mutex.d.ts +0 -7
- package/lib/Utils/messages-media.d.ts +0 -107
- package/lib/Utils/messages.d.ts +0 -76
- package/lib/Utils/noise-handler.d.ts +0 -20
- package/lib/Utils/process-message.d.ts +0 -41
- package/lib/Utils/signal.d.ts +0 -32
- package/lib/Utils/use-multi-file-auth-state.d.ts +0 -12
- package/lib/Utils/validate-connection.d.ts +0 -11
- package/lib/WABinary/constants.d.ts +0 -27
- package/lib/WABinary/decode.d.ts +0 -7
- package/lib/WABinary/encode.d.ts +0 -3
- package/lib/WABinary/generic-utils.d.ts +0 -15
- package/lib/WABinary/index.d.ts +0 -5
- package/lib/WABinary/jid-utils.d.ts +0 -29
- package/lib/WABinary/types.d.ts +0 -18
- package/lib/index.d.ts +0 -10
- /package/{lib → src}/Socket/Client/abstract-socket-client.js +0 -0
- /package/{lib → src}/Socket/Client/index.js +0 -0
- /package/{lib → src}/Store/index.js +0 -0
- /package/{lib → src}/Store/make-ordered-dictionary.js +0 -0
- /package/{lib → src}/Types/Auth.js +0 -0
- /package/{lib → src}/Types/Call.js +0 -0
- /package/{lib → src}/Types/Chat.js +0 -0
- /package/{lib → src}/Types/Contact.js +0 -0
- /package/{lib → src}/Types/Events.js +0 -0
- /package/{lib → src}/Types/GroupMetadata.js +0 -0
- /package/{lib → src}/Types/Message.js +0 -0
- /package/{lib → src}/Types/Product.js +0 -0
- /package/{lib → src}/Types/Signal.js +0 -0
- /package/{lib → src}/Types/Socket.js +0 -0
- /package/{lib → src}/Types/State.js +0 -0
- /package/{lib → src}/Utils/index.js +0 -0
- /package/{lib → src}/Utils/logger.js +0 -0
- /package/{lib → src}/Utils/lt-hash.js +0 -0
- /package/{lib → src}/WABinary/constants.js +0 -0
- /package/{lib → src}/WABinary/index.js +0 -0
- /package/{lib → src}/WABinary/types.js +0 -0
package/lib/Types/Signal.d.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { proto } from '../../WAProto';
|
|
2
|
-
type DecryptGroupSignalOpts = {
|
|
3
|
-
group: string;
|
|
4
|
-
authorJid: string;
|
|
5
|
-
msg: Uint8Array;
|
|
6
|
-
};
|
|
7
|
-
type ProcessSenderKeyDistributionMessageOpts = {
|
|
8
|
-
item: proto.Message.ISenderKeyDistributionMessage;
|
|
9
|
-
authorJid: string;
|
|
10
|
-
};
|
|
11
|
-
type DecryptSignalProtoOpts = {
|
|
12
|
-
jid: string;
|
|
13
|
-
type: 'pkmsg' | 'msg';
|
|
14
|
-
ciphertext: Uint8Array;
|
|
15
|
-
};
|
|
16
|
-
type EncryptMessageOpts = {
|
|
17
|
-
jid: string;
|
|
18
|
-
data: Uint8Array;
|
|
19
|
-
};
|
|
20
|
-
type EncryptGroupMessageOpts = {
|
|
21
|
-
group: string;
|
|
22
|
-
data: Uint8Array;
|
|
23
|
-
meId: string;
|
|
24
|
-
};
|
|
25
|
-
type PreKey = {
|
|
26
|
-
keyId: number;
|
|
27
|
-
publicKey: Uint8Array;
|
|
28
|
-
};
|
|
29
|
-
type SignedPreKey = PreKey & {
|
|
30
|
-
signature: Uint8Array;
|
|
31
|
-
};
|
|
32
|
-
type E2ESession = {
|
|
33
|
-
registrationId: number;
|
|
34
|
-
identityKey: Uint8Array;
|
|
35
|
-
signedPreKey: SignedPreKey;
|
|
36
|
-
preKey: PreKey;
|
|
37
|
-
};
|
|
38
|
-
type E2ESessionOpts = {
|
|
39
|
-
jid: string;
|
|
40
|
-
session: E2ESession;
|
|
41
|
-
};
|
|
42
|
-
export type SignalRepository = {
|
|
43
|
-
decryptGroupMessage(opts: DecryptGroupSignalOpts): Promise<Uint8Array>;
|
|
44
|
-
processSenderKeyDistributionMessage(opts: ProcessSenderKeyDistributionMessageOpts): Promise<void>;
|
|
45
|
-
decryptMessage(opts: DecryptSignalProtoOpts): Promise<Uint8Array>;
|
|
46
|
-
encryptMessage(opts: EncryptMessageOpts): Promise<{
|
|
47
|
-
type: 'pkmsg' | 'msg';
|
|
48
|
-
ciphertext: Uint8Array;
|
|
49
|
-
}>;
|
|
50
|
-
encryptGroupMessage(opts: EncryptGroupMessageOpts): Promise<{
|
|
51
|
-
senderKeyDistributionMessage: Uint8Array;
|
|
52
|
-
ciphertext: Uint8Array;
|
|
53
|
-
}>;
|
|
54
|
-
injectE2ESession(opts: E2ESessionOpts): Promise<void>;
|
|
55
|
-
jidToSignalProtocolAddress(jid: string): string;
|
|
56
|
-
};
|
|
57
|
-
export {};
|
package/lib/Types/State.d.ts
DELETED
|
@@ -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
|
-
};
|
package/lib/Types/index.d.ts
DELETED
|
@@ -1,56 +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 './Socket';
|
|
8
|
-
export * from './Events';
|
|
9
|
-
export * from './Product';
|
|
10
|
-
export * from './Call';
|
|
11
|
-
export * from './Signal';
|
|
12
|
-
import { AuthenticationState } from './Auth';
|
|
13
|
-
import { SocketConfig } from './Socket';
|
|
14
|
-
export type UserFacingSocketConfig = Partial<SocketConfig> & {
|
|
15
|
-
auth: AuthenticationState;
|
|
16
|
-
};
|
|
17
|
-
export declare enum DisconnectReason {
|
|
18
|
-
connectionClosed = 428,
|
|
19
|
-
connectionLost = 408,
|
|
20
|
-
connectionReplaced = 440,
|
|
21
|
-
timedOut = 408,
|
|
22
|
-
loggedOut = 401,
|
|
23
|
-
badSession = 500,
|
|
24
|
-
restartRequired = 515,
|
|
25
|
-
multideviceMismatch = 411,
|
|
26
|
-
forbidden = 403,
|
|
27
|
-
unavailableService = 503
|
|
28
|
-
}
|
|
29
|
-
export type WAInitResponse = {
|
|
30
|
-
ref: string;
|
|
31
|
-
ttl: number;
|
|
32
|
-
status: 200;
|
|
33
|
-
};
|
|
34
|
-
export type WABusinessHoursConfig = {
|
|
35
|
-
day_of_week: string;
|
|
36
|
-
mode: string;
|
|
37
|
-
open_time?: number;
|
|
38
|
-
close_time?: number;
|
|
39
|
-
};
|
|
40
|
-
export type WABusinessProfile = {
|
|
41
|
-
description: string;
|
|
42
|
-
email: string | undefined;
|
|
43
|
-
business_hours: {
|
|
44
|
-
timezone?: string;
|
|
45
|
-
config?: WABusinessHoursConfig[];
|
|
46
|
-
business_config?: WABusinessHoursConfig[];
|
|
47
|
-
};
|
|
48
|
-
website: string[];
|
|
49
|
-
category?: string;
|
|
50
|
-
wid?: string;
|
|
51
|
-
address?: string;
|
|
52
|
-
};
|
|
53
|
-
export type CurveKeyPair = {
|
|
54
|
-
private: Uint8Array;
|
|
55
|
-
public: Uint8Array;
|
|
56
|
-
};
|
|
@@ -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,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.readAndEmitEventStream = exports.captureEventStream = void 0;
|
|
7
|
-
const events_1 = __importDefault(require("events"));
|
|
8
|
-
const fs_1 = require("fs");
|
|
9
|
-
const promises_1 = require("fs/promises");
|
|
10
|
-
const readline_1 = require("readline");
|
|
11
|
-
const generics_1 = require("./generics");
|
|
12
|
-
const make_mutex_1 = require("./make-mutex");
|
|
13
|
-
/**
|
|
14
|
-
* Captures events from a baileys event emitter & stores them in a file
|
|
15
|
-
* @param ev The event emitter to read events from
|
|
16
|
-
* @param filename File to save to
|
|
17
|
-
*/
|
|
18
|
-
const captureEventStream = (ev, filename) => {
|
|
19
|
-
const oldEmit = ev.emit;
|
|
20
|
-
// write mutex so data is appended in order
|
|
21
|
-
const writeMutex = (0, make_mutex_1.makeMutex)();
|
|
22
|
-
// monkey patch eventemitter to capture all events
|
|
23
|
-
ev.emit = function (...args) {
|
|
24
|
-
const content = JSON.stringify({ timestamp: Date.now(), event: args[0], data: args[1] }) + '\n';
|
|
25
|
-
const result = oldEmit.apply(ev, args);
|
|
26
|
-
writeMutex.mutex(async () => {
|
|
27
|
-
await (0, promises_1.writeFile)(filename, content, { flag: 'a' });
|
|
28
|
-
});
|
|
29
|
-
return result;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
exports.captureEventStream = captureEventStream;
|
|
33
|
-
/**
|
|
34
|
-
* Read event file and emit events from there
|
|
35
|
-
* @param filename filename containing event data
|
|
36
|
-
* @param delayIntervalMs delay between each event emit
|
|
37
|
-
*/
|
|
38
|
-
const readAndEmitEventStream = (filename, delayIntervalMs = 0) => {
|
|
39
|
-
const ev = new events_1.default();
|
|
40
|
-
const fireEvents = async () => {
|
|
41
|
-
// from: https://stackoverflow.com/questions/6156501/read-a-file-one-line-at-a-time-in-node-js
|
|
42
|
-
const fileStream = (0, fs_1.createReadStream)(filename);
|
|
43
|
-
const rl = (0, readline_1.createInterface)({
|
|
44
|
-
input: fileStream,
|
|
45
|
-
crlfDelay: Infinity
|
|
46
|
-
});
|
|
47
|
-
// Note: we use the crlfDelay option to recognize all instances of CR LF
|
|
48
|
-
// ('\r\n') in input.txt as a single line break.
|
|
49
|
-
for await (const line of rl) {
|
|
50
|
-
if (line) {
|
|
51
|
-
const { event, data } = JSON.parse(line);
|
|
52
|
-
ev.emit(event, data);
|
|
53
|
-
delayIntervalMs && await (0, generics_1.delay)(delayIntervalMs);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
fileStream.close();
|
|
57
|
-
};
|
|
58
|
-
return {
|
|
59
|
-
ev,
|
|
60
|
-
task: fireEvents()
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
exports.readAndEmitEventStream = readAndEmitEventStream;
|
package/lib/Utils/business.d.ts
DELETED
|
@@ -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: string | undefined;
|
|
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,71 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { AxiosRequestConfig } from 'axios';
|
|
3
|
-
import type { Logger } from 'pino';
|
|
4
|
-
import { proto } from '../../WAProto';
|
|
5
|
-
import { BaileysEventEmitter, ChatModification, ChatMutation, Contact, InitialAppStateSyncOptions, LTHashState, WAPatchCreate, WAPatchName } from '../Types';
|
|
6
|
-
import { BinaryNode } from '../WABinary';
|
|
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;
|
|
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;
|
|
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_block: {
|
|
34
|
-
patches: proto.ISyncdPatch[];
|
|
35
|
-
hasMorePatches: boolean;
|
|
36
|
-
snapshot?: proto.ISyncdSnapshot | undefined;
|
|
37
|
-
};
|
|
38
|
-
critical_unblock_low: {
|
|
39
|
-
patches: proto.ISyncdPatch[];
|
|
40
|
-
hasMorePatches: boolean;
|
|
41
|
-
snapshot?: proto.ISyncdSnapshot | undefined;
|
|
42
|
-
};
|
|
43
|
-
regular_high: {
|
|
44
|
-
patches: proto.ISyncdPatch[];
|
|
45
|
-
hasMorePatches: boolean;
|
|
46
|
-
snapshot?: proto.ISyncdSnapshot | undefined;
|
|
47
|
-
};
|
|
48
|
-
regular_low: {
|
|
49
|
-
patches: proto.ISyncdPatch[];
|
|
50
|
-
hasMorePatches: boolean;
|
|
51
|
-
snapshot?: proto.ISyncdSnapshot | undefined;
|
|
52
|
-
};
|
|
53
|
-
regular: {
|
|
54
|
-
patches: proto.ISyncdPatch[];
|
|
55
|
-
hasMorePatches: boolean;
|
|
56
|
-
snapshot?: proto.ISyncdSnapshot | undefined;
|
|
57
|
-
};
|
|
58
|
-
}>;
|
|
59
|
-
export declare const downloadExternalBlob: (blob: proto.IExternalBlobReference, options: AxiosRequestConfig<any>) => Promise<Buffer>;
|
|
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?: Logger, 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?: Logger) => void;
|
|
71
|
-
export {};
|
package/lib/Utils/crypto.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
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 | Buffer;
|
|
5
|
-
export declare const Curve: {
|
|
6
|
-
generateKeyPair: () => KeyPair;
|
|
7
|
-
sharedKey: (privateKey: Uint8Array, publicKey: Uint8Array) => Buffer;
|
|
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;
|
|
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;
|
|
26
|
-
export declare function aesEncryptCTR(plaintext: Uint8Array, key: Uint8Array, iv: Uint8Array): Buffer;
|
|
27
|
-
export declare function aesDecryptCTR(ciphertext: Uint8Array, key: Uint8Array, iv: Uint8Array): Buffer;
|
|
28
|
-
/** decrypt AES 256 CBC; where the IV is prefixed to the buffer */
|
|
29
|
-
export declare function aesDecrypt(buffer: Buffer, key: Buffer): Buffer;
|
|
30
|
-
/** decrypt AES 256 CBC */
|
|
31
|
-
export declare function aesDecryptWithIV(buffer: Buffer, key: Buffer, IV: Buffer): Buffer;
|
|
32
|
-
export declare function aesEncrypt(buffer: Buffer | Uint8Array, key: Buffer): Buffer;
|
|
33
|
-
export declare function aesEncrypWithIV(buffer: Buffer, key: Buffer, IV: Buffer): Buffer;
|
|
34
|
-
export declare function hmacSign(buffer: Buffer | Uint8Array, key: Buffer | Uint8Array, variant?: 'sha256' | 'sha512'): Buffer;
|
|
35
|
-
export declare function sha256(buffer: Buffer): Buffer;
|
|
36
|
-
export declare function md5(buffer: Buffer): Buffer;
|
|
37
|
-
export declare function hkdf(buffer: Uint8Array | Buffer, expandedLength: number, info: {
|
|
38
|
-
salt?: Buffer;
|
|
39
|
-
info?: string;
|
|
40
|
-
}): Buffer;
|
|
41
|
-
export declare function derivePairingCodeKey(pairingCode: string, salt: Buffer): Buffer;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Logger } from 'pino';
|
|
2
|
-
import { proto } from '../../WAProto';
|
|
3
|
-
import { SignalRepository } from '../Types';
|
|
4
|
-
import { BinaryNode } from '../WABinary';
|
|
5
|
-
/**
|
|
6
|
-
* Decode the received node as a message.
|
|
7
|
-
* @note this will only parse the message, not decrypt it
|
|
8
|
-
*/
|
|
9
|
-
export declare function decodeMessageNode(stanza: BinaryNode, meId: string, meLid: string): {
|
|
10
|
-
fullMessage: proto.IWebMessageInfo;
|
|
11
|
-
author: string;
|
|
12
|
-
sender: string;
|
|
13
|
-
};
|
|
14
|
-
export declare const decryptMessageNode: (stanza: BinaryNode, meId: string, meLid: string, repository: SignalRepository, logger: Logger) => {
|
|
15
|
-
fullMessage: proto.IWebMessageInfo;
|
|
16
|
-
category: string;
|
|
17
|
-
author: string;
|
|
18
|
-
decrypt(): Promise<void>;
|
|
19
|
-
};
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.decryptMessageNode = exports.decodeMessageNode = void 0;
|
|
4
|
-
const boom_1 = require("@hapi/boom");
|
|
5
|
-
const WAProto_1 = require("../../WAProto");
|
|
6
|
-
const WABinary_1 = require("../WABinary");
|
|
7
|
-
const generics_1 = require("./generics");
|
|
8
|
-
const NO_MESSAGE_FOUND_ERROR_TEXT = 'Message absent from node';
|
|
9
|
-
/**
|
|
10
|
-
* Decode the received node as a message.
|
|
11
|
-
* @note this will only parse the message, not decrypt it
|
|
12
|
-
*/
|
|
13
|
-
function decodeMessageNode(stanza, meId, meLid) {
|
|
14
|
-
let msgType;
|
|
15
|
-
let chatId;
|
|
16
|
-
let author;
|
|
17
|
-
const msgId = stanza.attrs.id;
|
|
18
|
-
const from = stanza.attrs.from;
|
|
19
|
-
const participant = stanza.attrs.participant;
|
|
20
|
-
const recipient = stanza.attrs.recipient;
|
|
21
|
-
const isMe = (jid) => (0, WABinary_1.areJidsSameUser)(jid, meId);
|
|
22
|
-
const isMeLid = (jid) => (0, WABinary_1.areJidsSameUser)(jid, meLid);
|
|
23
|
-
if ((0, WABinary_1.isJidUser)(from)) {
|
|
24
|
-
if (recipient) {
|
|
25
|
-
if (!isMe(from)) {
|
|
26
|
-
throw new boom_1.Boom('receipient present, but msg not from me', { data: stanza });
|
|
27
|
-
}
|
|
28
|
-
chatId = recipient;
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
chatId = from;
|
|
32
|
-
}
|
|
33
|
-
msgType = 'chat';
|
|
34
|
-
author = from;
|
|
35
|
-
}
|
|
36
|
-
else if ((0, WABinary_1.isLidUser)(from)) {
|
|
37
|
-
if (recipient) {
|
|
38
|
-
if (!isMeLid(from)) {
|
|
39
|
-
throw new boom_1.Boom('receipient present, but msg not from me', { data: stanza });
|
|
40
|
-
}
|
|
41
|
-
chatId = recipient;
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
chatId = from;
|
|
45
|
-
}
|
|
46
|
-
msgType = 'chat';
|
|
47
|
-
author = from;
|
|
48
|
-
}
|
|
49
|
-
else if ((0, WABinary_1.isJidGroup)(from)) {
|
|
50
|
-
if (!participant) {
|
|
51
|
-
throw new boom_1.Boom('No participant in group message');
|
|
52
|
-
}
|
|
53
|
-
msgType = 'group';
|
|
54
|
-
author = participant;
|
|
55
|
-
chatId = from;
|
|
56
|
-
}
|
|
57
|
-
else if ((0, WABinary_1.isJidBroadcast)(from)) {
|
|
58
|
-
if (!participant) {
|
|
59
|
-
throw new boom_1.Boom('No participant in group message');
|
|
60
|
-
}
|
|
61
|
-
const isParticipantMe = isMe(participant);
|
|
62
|
-
if ((0, WABinary_1.isJidStatusBroadcast)(from)) {
|
|
63
|
-
msgType = isParticipantMe ? 'direct_peer_status' : 'other_status';
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
msgType = isParticipantMe ? 'peer_broadcast' : 'other_broadcast';
|
|
67
|
-
}
|
|
68
|
-
chatId = from;
|
|
69
|
-
author = participant;
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
throw new boom_1.Boom('Unknown message type', { data: stanza });
|
|
73
|
-
}
|
|
74
|
-
const fromMe = ((0, WABinary_1.isLidUser)(from) ? isMeLid : isMe)(stanza.attrs.participant || stanza.attrs.from);
|
|
75
|
-
const pushname = stanza.attrs.notify;
|
|
76
|
-
const key = {
|
|
77
|
-
remoteJid: chatId,
|
|
78
|
-
fromMe,
|
|
79
|
-
id: msgId,
|
|
80
|
-
participant
|
|
81
|
-
};
|
|
82
|
-
const fullMessage = {
|
|
83
|
-
key,
|
|
84
|
-
messageTimestamp: +stanza.attrs.t,
|
|
85
|
-
pushName: pushname,
|
|
86
|
-
broadcast: (0, WABinary_1.isJidBroadcast)(from)
|
|
87
|
-
};
|
|
88
|
-
if (key.fromMe) {
|
|
89
|
-
fullMessage.status = WAProto_1.proto.WebMessageInfo.Status.SERVER_ACK;
|
|
90
|
-
}
|
|
91
|
-
return {
|
|
92
|
-
fullMessage,
|
|
93
|
-
author,
|
|
94
|
-
sender: msgType === 'chat' ? author : chatId
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
exports.decodeMessageNode = decodeMessageNode;
|
|
98
|
-
const decryptMessageNode = (stanza, meId, meLid, repository, logger) => {
|
|
99
|
-
const { fullMessage, author, sender } = decodeMessageNode(stanza, meId, meLid);
|
|
100
|
-
return {
|
|
101
|
-
fullMessage,
|
|
102
|
-
category: stanza.attrs.category,
|
|
103
|
-
author,
|
|
104
|
-
async decrypt() {
|
|
105
|
-
var _a;
|
|
106
|
-
let decryptables = 0;
|
|
107
|
-
if (Array.isArray(stanza.content)) {
|
|
108
|
-
for (const { tag, attrs, content } of stanza.content) {
|
|
109
|
-
if (tag === 'verified_name' && content instanceof Uint8Array) {
|
|
110
|
-
const cert = WAProto_1.proto.VerifiedNameCertificate.decode(content);
|
|
111
|
-
const details = WAProto_1.proto.VerifiedNameCertificate.Details.decode(cert.details);
|
|
112
|
-
fullMessage.verifiedBizName = details.verifiedName;
|
|
113
|
-
}
|
|
114
|
-
if (tag !== 'enc') {
|
|
115
|
-
continue;
|
|
116
|
-
}
|
|
117
|
-
if (!(content instanceof Uint8Array)) {
|
|
118
|
-
continue;
|
|
119
|
-
}
|
|
120
|
-
decryptables += 1;
|
|
121
|
-
let msgBuffer;
|
|
122
|
-
try {
|
|
123
|
-
const e2eType = attrs.type;
|
|
124
|
-
switch (e2eType) {
|
|
125
|
-
case 'skmsg':
|
|
126
|
-
msgBuffer = await repository.decryptGroupMessage({
|
|
127
|
-
group: sender,
|
|
128
|
-
authorJid: author,
|
|
129
|
-
msg: content
|
|
130
|
-
});
|
|
131
|
-
break;
|
|
132
|
-
case 'pkmsg':
|
|
133
|
-
case 'msg':
|
|
134
|
-
const user = (0, WABinary_1.isJidUser)(sender) ? sender : author;
|
|
135
|
-
msgBuffer = await repository.decryptMessage({
|
|
136
|
-
jid: user,
|
|
137
|
-
type: e2eType,
|
|
138
|
-
ciphertext: content
|
|
139
|
-
});
|
|
140
|
-
break;
|
|
141
|
-
default:
|
|
142
|
-
throw new Error(`Unknown e2e type: ${e2eType}`);
|
|
143
|
-
}
|
|
144
|
-
let msg = WAProto_1.proto.Message.decode((0, generics_1.unpadRandomMax16)(msgBuffer));
|
|
145
|
-
msg = ((_a = msg.deviceSentMessage) === null || _a === void 0 ? void 0 : _a.message) || msg;
|
|
146
|
-
if (msg.senderKeyDistributionMessage) {
|
|
147
|
-
await repository.processSenderKeyDistributionMessage({
|
|
148
|
-
authorJid: author,
|
|
149
|
-
item: msg.senderKeyDistributionMessage
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
if (fullMessage.message) {
|
|
153
|
-
Object.assign(fullMessage.message, msg);
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
fullMessage.message = msg;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
catch (err) {
|
|
160
|
-
logger.error({ key: fullMessage.key, err }, 'failed to decrypt message');
|
|
161
|
-
fullMessage.messageStubType = WAProto_1.proto.WebMessageInfo.StubType.CIPHERTEXT;
|
|
162
|
-
fullMessage.messageStubParameters = [err.message];
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
// if nothing was found to decrypt
|
|
167
|
-
if (!decryptables) {
|
|
168
|
-
fullMessage.messageStubType = WAProto_1.proto.WebMessageInfo.StubType.CIPHERTEXT;
|
|
169
|
-
fullMessage.messageStubParameters = [NO_MESSAGE_FOUND_ERROR_TEXT];
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
};
|
|
174
|
-
exports.decryptMessageNode = decryptMessageNode;
|
|
@@ -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 {};
|