@mikudev/baileys-mod 2.0.2 → 3.0.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/newsletter.js +3 -24
  2. package/package.json +2 -2
  3. package/lib/Defaults/index.d.ts +0 -53
  4. package/lib/Signal/Group/ciphertext-message.d.ts +0 -9
  5. package/lib/Signal/Group/group-session-builder.d.ts +0 -14
  6. package/lib/Signal/Group/group_cipher.d.ts +0 -17
  7. package/lib/Signal/Group/index.d.ts +0 -11
  8. package/lib/Signal/Group/keyhelper.d.ts +0 -10
  9. package/lib/Signal/Group/queue-job.d.ts +0 -1
  10. package/lib/Signal/Group/sender-chain-key.d.ts +0 -13
  11. package/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -16
  12. package/lib/Signal/Group/sender-key-message.d.ts +0 -18
  13. package/lib/Signal/Group/sender-key-name.d.ts +0 -17
  14. package/lib/Signal/Group/sender-key-record.d.ts +0 -30
  15. package/lib/Signal/Group/sender-key-state.d.ts +0 -38
  16. package/lib/Signal/Group/sender-message-key.d.ts +0 -11
  17. package/lib/Signal/libsignal.d.ts +0 -3
  18. package/lib/Socket/Client/abstract-socket-client.d.ts +0 -17
  19. package/lib/Socket/Client/index.d.ts +0 -3
  20. package/lib/Socket/Client/mobile-socket-client.d.ts +0 -13
  21. package/lib/Socket/Client/web-socket-client.d.ts +0 -12
  22. package/lib/Socket/business.d.ts +0 -171
  23. package/lib/Socket/chats.d.ts +0 -267
  24. package/lib/Socket/dugong.d.ts +0 -254
  25. package/lib/Socket/groups.d.ts +0 -115
  26. package/lib/Socket/index.d.ts +0 -173
  27. package/lib/Socket/messages-recv.d.ts +0 -161
  28. package/lib/Socket/messages-send.d.ts +0 -149
  29. package/lib/Socket/newsletter.d.ts +0 -134
  30. package/lib/Socket/registration.d.ts +0 -267
  31. package/lib/Socket/socket.d.ts +0 -43
  32. package/lib/Socket/usync.d.ts +0 -36
  33. package/lib/Store/index.d.ts +0 -3
  34. package/lib/Store/make-cache-manager-store.d.ts +0 -13
  35. package/lib/Store/make-in-memory-store.d.ts +0 -118
  36. package/lib/Store/make-ordered-dictionary.d.ts +0 -13
  37. package/lib/Store/object-repository.d.ts +0 -10
  38. package/lib/Types/Auth.d.ts +0 -110
  39. package/lib/Types/Call.d.ts +0 -13
  40. package/lib/Types/Chat.d.ts +0 -102
  41. package/lib/Types/Contact.d.ts +0 -19
  42. package/lib/Types/Events.d.ts +0 -157
  43. package/lib/Types/GroupMetadata.d.ts +0 -55
  44. package/lib/Types/Label.d.ts +0 -35
  45. package/lib/Types/LabelAssociation.d.ts +0 -29
  46. package/lib/Types/Message.d.ts +0 -273
  47. package/lib/Types/Newsletter.d.ts +0 -103
  48. package/lib/Types/Product.d.ts +0 -78
  49. package/lib/Types/Signal.d.ts +0 -57
  50. package/lib/Types/Socket.d.ts +0 -111
  51. package/lib/Types/State.d.ts +0 -27
  52. package/lib/Types/USync.d.ts +0 -25
  53. package/lib/Types/index.d.ts +0 -57
  54. package/lib/Utils/auth-utils.d.ts +0 -18
  55. package/lib/Utils/baileys-event-stream.d.ts +0 -16
  56. package/lib/Utils/business.d.ts +0 -22
  57. package/lib/Utils/chat-utils.d.ts +0 -71
  58. package/lib/Utils/crypto.d.ts +0 -41
  59. package/lib/Utils/decode-wa-message.d.ts +0 -19
  60. package/lib/Utils/event-buffer.d.ts +0 -35
  61. package/lib/Utils/generics.d.ts +0 -92
  62. package/lib/Utils/history.d.ts +0 -15
  63. package/lib/Utils/index.d.ts +0 -17
  64. package/lib/Utils/link-preview.d.ts +0 -21
  65. package/lib/Utils/logger.d.ts +0 -4
  66. package/lib/Utils/lt-hash.d.ts +0 -12
  67. package/lib/Utils/make-mutex.d.ts +0 -7
  68. package/lib/Utils/messages-media.d.ts +0 -116
  69. package/lib/Utils/messages.d.ts +0 -77
  70. package/lib/Utils/noise-handler.d.ts +0 -21
  71. package/lib/Utils/process-message.d.ts +0 -41
  72. package/lib/Utils/signal.d.ts +0 -32
  73. package/lib/Utils/use-multi-file-auth-state.d.ts +0 -13
  74. package/lib/Utils/validate-connection.d.ts +0 -11
  75. package/lib/WABinary/constants.d.ts +0 -30
  76. package/lib/WABinary/decode.d.ts +0 -7
  77. package/lib/WABinary/encode.d.ts +0 -3
  78. package/lib/WABinary/generic-utils.d.ts +0 -17
  79. package/lib/WABinary/index.d.ts +0 -5
  80. package/lib/WABinary/jid-utils.d.ts +0 -31
  81. package/lib/WABinary/types.d.ts +0 -18
  82. package/lib/WAM/BinaryInfo.d.ts +0 -17
  83. package/lib/WAM/constants.d.ts +0 -38
  84. package/lib/WAM/encode.d.ts +0 -3
  85. package/lib/WAM/index.d.ts +0 -3
  86. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -9
  87. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -22
  88. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -12
  89. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -12
  90. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +0 -25
  91. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +0 -8
  92. package/lib/WAUSync/Protocols/index.d.ts +0 -4
  93. package/lib/WAUSync/USyncQuery.d.ts +0 -28
  94. package/lib/WAUSync/USyncUser.d.ts +0 -12
  95. package/lib/WAUSync/index.d.ts +0 -3
  96. package/lib/index.d.ts +0 -12
@@ -1,103 +0,0 @@
1
- import { proto } from "../../WAProto"
2
-
3
- export type NewsletterReactionMode = "ALL" | "BASIC" | "NONE"
4
- export type NewsletterState = "ACTIVE" | "GEOSUSPENDED" | "SUSPENDED"
5
- export type NewsletterVerification = "VERIFIED" | "UNVERIFIED"
6
- export type NewsletterMute = "ON" | "OFF" | "UNDEFINED"
7
- export type NewsletterViewRole = "ADMIN" | "GUEST" | "OWNER" | "SUBSCRIBER"
8
-
9
- export type NewsletterViewerMetadata = {
10
- mute: NewsletterMute
11
- view_role: NewsletterViewRole
12
- }
13
-
14
- export type NewsletterMetadata = {
15
- /** jid of newsletter */
16
- id: string
17
- /** state of newsletter */
18
- state: NewsletterState
19
- /** creation timestamp of newsletter */
20
- creation_time: number
21
- /** name of newsletter */
22
- name: string
23
- /** timestamp of last name modification of newsletter */
24
- nameTime: number
25
- /** description of newsletter */
26
- description: string
27
- /** timestamp of last description modification of newsletter */
28
- descriptionTime: number
29
- /** invite code of newsletter */
30
- invite: string
31
- /** direct path of picture */
32
- picture: string | null
33
- /** direct path of picture preview (lower quality) */
34
- preview: string | null
35
- /** reaction mode of newsletter */
36
- reaction_codes?: NewsletterReactionMode
37
- /** subscribers count of newsletter */
38
- subscribers: number
39
- /** verification state of newsletter */
40
- verification: NewsletterVerification
41
- /** viewer metadata */
42
- viewer_metadata: NewsletterViewerMetadata
43
- }
44
-
45
- export type SubscriberAction = "promote" | "demote"
46
-
47
- export type ReactionModeUpdate = {
48
- reaction_codes: {
49
- blocked_codes: null
50
- enabled_ts_sec: null
51
- value: NewsletterReactionMode
52
- }
53
- }
54
-
55
- /** only exists reaction mode update */
56
- export type NewsletterSettingsUpdate = ReactionModeUpdate
57
-
58
- export type NewsletterReaction = {
59
- count: number
60
- code: string
61
- }
62
-
63
- export type NewsletterFetchedUpdate = {
64
- /** id of message in newsletter, starts from 100 */
65
- server_id: string
66
- /** count of views in this message */
67
- views?: number
68
- /** reactions in this message */
69
- reactions: NewsletterReaction[]
70
- /** the message, if you requested only updates, you will not receive message */
71
- message?: proto.IWebMessageInfo
72
- }
73
-
74
- export const MexOperations = {
75
- PROMOTE: "NotificationNewsletterAdminPromote",
76
- DEMOTE: "NotificationNewsletterAdminDemote",
77
- UPDATE: "NotificationNewsletterUpdate"
78
- } as const
79
-
80
- export const XWAPaths = {
81
- PROMOTE: "xwa2_notify_newsletter_admin_promote",
82
- DEMOTE: "xwa2_notify_newsletter_admin_demote",
83
- ADMIN_COUNT: "xwa2_newsletter_admin",
84
- CREATE: "xwa2_newsletter_create",
85
- NEWSLETTER: "xwa2_newsletter",
86
- SUBSCRIBED: "xwa2_newsletter_subscribed",
87
- METADATA_UPDATE: "xwa2_notify_newsletter_on_metadata_update"
88
- } as const
89
-
90
- export const QueryIds = {
91
- JOB_MUTATION: "7150902998257522",
92
- METADATA: "6620195908089573",
93
- UNFOLLOW: "7238632346214362",
94
- FOLLOW: "7871414976211147",
95
- UNMUTE: "7337137176362961",
96
- MUTE: "25151904754424642",
97
- CREATE: "6996806640408138",
98
- ADMIN_COUNT: "7130823597031706",
99
- CHANGE_OWNER: "7341777602580933",
100
- DELETE: "8316537688363079",
101
- DEMOTE: "6551828931592903",
102
- SUBSCRIBED: "6388546374527196"
103
- } as const
@@ -1,78 +0,0 @@
1
- import { WAMediaUpload } from './Message';
2
- export type CatalogResult = {
3
- data: {
4
- paging: {
5
- cursors: {
6
- before: string;
7
- after: string;
8
- };
9
- };
10
- data: any[];
11
- };
12
- };
13
- export type ProductCreateResult = {
14
- data: {
15
- product: {};
16
- };
17
- };
18
- export type CatalogStatus = {
19
- status: string;
20
- canAppeal: boolean;
21
- };
22
- export type CatalogCollection = {
23
- id: string;
24
- name: string;
25
- products: Product[];
26
- status: CatalogStatus;
27
- };
28
- export type ProductAvailability = 'in stock';
29
- export type ProductBase = {
30
- name: string;
31
- retailerId?: string;
32
- url?: string;
33
- description: string;
34
- price: number;
35
- currency: string;
36
- isHidden?: boolean;
37
- };
38
- export type ProductCreate = ProductBase & {
39
- /** ISO country code for product origin. Set to undefined for no country */
40
- originCountryCode: string | undefined;
41
- /** images of the product */
42
- images: WAMediaUpload[];
43
- };
44
- export type ProductUpdate = Omit<ProductCreate, 'originCountryCode'>;
45
- export type Product = ProductBase & {
46
- id: string;
47
- imageUrls: {
48
- [_: string]: string;
49
- };
50
- reviewStatus: {
51
- [_: string]: string;
52
- };
53
- availability: ProductAvailability;
54
- };
55
- export type OrderPrice = {
56
- currency: string;
57
- total: number;
58
- };
59
- export type OrderProduct = {
60
- id: string;
61
- imageUrl: string;
62
- name: string;
63
- quantity: number;
64
- currency: string;
65
- price: number;
66
- };
67
- export type OrderDetails = {
68
- price: OrderPrice;
69
- products: OrderProduct[];
70
- };
71
- export type CatalogCursor = string;
72
- export type GetCatalogOptions = {
73
- /** cursor to start from */
74
- cursor?: CatalogCursor;
75
- /** number of products to fetch */
76
- limit?: number;
77
- jid?: string;
78
- };
@@ -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 {};
@@ -1,111 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { AxiosRequestConfig } from 'axios';
4
- import type { Agent } from 'https';
5
- import type { Logger } from 'pino';
6
- import type { URL } from 'url';
7
- import { proto } from '../../WAProto';
8
- import { AuthenticationState, SignalAuthState, TransactionCapabilityOptions } from './Auth';
9
- import { MediaConnInfo } from './Message';
10
- import { SignalRepository } from './Signal';
11
- export type WAVersion = [number, number, number];
12
- export type WABrowserDescription = [string, string, string];
13
- export type CacheStore = {
14
- /** get a cached key and change the stats */
15
- get<T>(key: string): T | undefined;
16
- /** set a key in the cache */
17
- set<T>(key: string, value: T): void;
18
- /** delete a key from the cache */
19
- del(key: string): void;
20
- /** flush all data */
21
- flushAll(): void;
22
- };
23
- export type SocketConfig = {
24
- /** the WS url to connect to WA */
25
- waWebSocketUrl: string | URL;
26
- /** Fails the connection if the socket times out in this interval */
27
- connectTimeoutMs: number;
28
- /** Default timeout for queries, undefined for no timeout */
29
- defaultQueryTimeoutMs: number | undefined;
30
- /** ping-pong interval for WS connection */
31
- keepAliveIntervalMs: number;
32
- /** should baileys use the mobile api instead of the multi device api */
33
- mobile?: boolean;
34
- /** proxy agent */
35
- agent?: Agent;
36
- /** pino logger */
37
- logger: Logger;
38
- /** version to connect with */
39
- version: WAVersion;
40
- /** override browser config */
41
- browser: WABrowserDescription;
42
- /** agent used for fetch requests -- uploading/downloading media */
43
- fetchAgent?: Agent;
44
- /** should the QR be printed in the terminal */
45
- printQRInTerminal: boolean;
46
- /** should events be emitted for actions done by this socket connection */
47
- emitOwnEvents: boolean;
48
- /** custom upload hosts to upload media to */
49
- customUploadHosts: MediaConnInfo['hosts'];
50
- /** time to wait between sending new retry requests */
51
- retryRequestDelayMs: number;
52
- /** max retry count */
53
- maxMsgRetryCount: number;
54
- /** time to wait for the generation of the next QR in ms */
55
- qrTimeout?: number;
56
- /** provide an auth state object to maintain the auth state */
57
- auth: AuthenticationState;
58
- /** manage history processing with this control; by default will sync up everything */
59
- shouldSyncHistoryMessage: (msg: proto.Message.IHistorySyncNotification) => boolean;
60
- /** transaction capability options for SignalKeyStore */
61
- transactionOpts: TransactionCapabilityOptions;
62
- /** marks the client as online whenever the socket successfully connects */
63
- markOnlineOnConnect: boolean;
64
- /** provide a cache to store media, so does not have to be re-uploaded */
65
- mediaCache?: CacheStore;
66
- /**
67
- * map to store the retry counts for failed messages;
68
- * used to determine whether to retry a message or not */
69
- msgRetryCounterCache?: CacheStore;
70
- /** provide a cache to store a user's device list */
71
- userDevicesCache?: CacheStore;
72
- /** cache to store call offers */
73
- callOfferCache?: CacheStore;
74
- /** width for link preview images */
75
- linkPreviewImageThumbnailWidth: number;
76
- /** Should Baileys ask the phone for full history, will be received async */
77
- syncFullHistory: boolean;
78
- /** Should baileys fire init queries automatically, default true */
79
- fireInitQueries: boolean;
80
- /**
81
- * generate a high quality link preview,
82
- * entails uploading the jpegThumbnail to WA
83
- * */
84
- generateHighQualityLinkPreview: boolean;
85
- /**
86
- * Returns if a jid should be ignored,
87
- * no event for that jid will be triggered.
88
- * Messages from that jid will also not be decrypted
89
- * */
90
- shouldIgnoreJid: (jid: string) => boolean | undefined;
91
- /**
92
- * Optionally patch the message before sending out
93
- * */
94
- patchMessageBeforeSending: (msg: proto.IMessage, recipientJids: string[]) => Promise<proto.IMessage> | proto.IMessage;
95
- /** verify app state MACs */
96
- appStateMacVerification: {
97
- patch: boolean;
98
- snapshot: boolean;
99
- };
100
- /** options for axios */
101
- options: AxiosRequestConfig<{}>;
102
- /**
103
- * fetch a message from your store
104
- * implement this so that messages failed to send
105
- * (solves the "this message can take a while" issue) can be retried
106
- * */
107
- getMessage: (key: proto.IMessageKey) => Promise<proto.IMessage | undefined>;
108
- makeSignalRepository: (auth: SignalAuthState) => SignalRepository;
109
- /** Socket passthrough */
110
- socket?: any;
111
- };
@@ -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,57 +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 declare enum DisconnectReason {
19
- connectionClosed = 428,
20
- connectionLost = 408,
21
- connectionReplaced = 440,
22
- timedOut = 408,
23
- loggedOut = 401,
24
- badSession = 500,
25
- restartRequired = 515,
26
- multideviceMismatch = 411,
27
- forbidden = 403,
28
- unavailableService = 503
29
- }
30
- export type WAInitResponse = {
31
- ref: string;
32
- ttl: number;
33
- status: 200;
34
- };
35
- export type WABusinessHoursConfig = {
36
- day_of_week: string;
37
- mode: string;
38
- open_time?: number;
39
- close_time?: number;
40
- };
41
- export type WABusinessProfile = {
42
- description: string;
43
- email: string | undefined;
44
- business_hours: {
45
- timezone?: string;
46
- config?: WABusinessHoursConfig[];
47
- business_config?: WABusinessHoursConfig[];
48
- };
49
- website: string[];
50
- category?: string;
51
- wid?: string;
52
- address?: string;
53
- };
54
- export type CurveKeyPair = {
55
- private: Uint8Array;
56
- public: Uint8Array;
57
- };
@@ -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: 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 {};
@@ -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
- };