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
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Boom } from '@hapi/boom';
|
|
3
|
-
import { proto } from '../../WAProto';
|
|
4
|
-
import { AnyMessageContent, MediaConnInfo, MessageReceiptType, MessageRelayOptions, MiscMessageGenerationOptions, SocketConfig, WAMessageKey } from '../Types';
|
|
5
|
-
import { BinaryNode } from '../WABinary';
|
|
6
|
-
export declare const makeMessagesSocket: (config: SocketConfig) => {
|
|
7
|
-
getPrivacyTokens: (jids: string[]) => Promise<BinaryNode>;
|
|
8
|
-
assertSessions: (jids: string[], force: boolean) => Promise<boolean>;
|
|
9
|
-
relayMessage: (jid: string, message: proto.IMessage, { messageId: msgId, participant, additionalAttributes, useUserDevicesCache, cachedGroupMetadata, statusJidList }: MessageRelayOptions) => Promise<string>;
|
|
10
|
-
sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: MessageReceiptType) => Promise<void>;
|
|
11
|
-
sendReceipts: (keys: WAMessageKey[], type: MessageReceiptType) => Promise<void>;
|
|
12
|
-
getButtonArgs: (message: proto.IMessage) => BinaryNode['attrs'];
|
|
13
|
-
readMessages: (keys: WAMessageKey[]) => Promise<void>;
|
|
14
|
-
refreshMediaConn: (forceGet?: boolean) => Promise<MediaConnInfo>;
|
|
15
|
-
waUploadToServer: import("../Types").WAMediaUploadFunction;
|
|
16
|
-
fetchPrivacySettings: (force?: boolean) => Promise<{
|
|
17
|
-
[_: string]: string;
|
|
18
|
-
}>;
|
|
19
|
-
updateMediaMessage: (message: proto.IWebMessageInfo) => Promise<proto.IWebMessageInfo>;
|
|
20
|
-
sendMessage: (jid: string, content: AnyMessageContent, options?: MiscMessageGenerationOptions) => Promise<proto.WebMessageInfo | undefined>;
|
|
21
|
-
groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>;
|
|
22
|
-
groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>;
|
|
23
|
-
groupLeave: (id: string) => Promise<void>;
|
|
24
|
-
groupUpdateSubject: (jid: string, subject: string) => Promise<void>;
|
|
25
|
-
groupRequestParticipantsList: (jid: string) => Promise<{
|
|
26
|
-
[key: string]: string;
|
|
27
|
-
}[]>;
|
|
28
|
-
groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "reject" | "approve") => Promise<{
|
|
29
|
-
status: string;
|
|
30
|
-
jid: string; /** Bulk read messages. Keys can be from different chats & participants */
|
|
31
|
-
}[]>;
|
|
32
|
-
groupParticipantsUpdate: (jid: string, participants: string[], action: import("../Types").ParticipantAction) => Promise<{
|
|
33
|
-
status: string;
|
|
34
|
-
jid: string;
|
|
35
|
-
content: BinaryNode;
|
|
36
|
-
}[]>;
|
|
37
|
-
groupUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>;
|
|
38
|
-
groupInviteCode: (jid: string) => Promise<string | undefined>;
|
|
39
|
-
groupRevokeInvite: (jid: string) => Promise<string | undefined>;
|
|
40
|
-
groupAcceptInvite: (code: string) => Promise<string | undefined>;
|
|
41
|
-
groupAcceptInviteV4: (key: string | proto.IMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => Promise<string>;
|
|
42
|
-
groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>;
|
|
43
|
-
groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
|
|
44
|
-
groupSettingUpdate: (jid: string, setting: "announcement" | "locked" | "not_announcement" | "unlocked") => Promise<void>;
|
|
45
|
-
groupMemberAddMode: (jid: string, mode: "all_member_add" | "admin_add") => Promise<void>;
|
|
46
|
-
groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
|
|
47
|
-
groupFetchAllParticipating: () => Promise<{
|
|
48
|
-
[_: string]: import("../Types").GroupMetadata;
|
|
49
|
-
}>;
|
|
50
|
-
processingMutex: {
|
|
51
|
-
mutex<T>(code: () => T | Promise<T>): Promise<T>;
|
|
52
|
-
};
|
|
53
|
-
upsertMessage: (msg: proto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>;
|
|
54
|
-
appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
|
|
55
|
-
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string | undefined) => Promise<void>;
|
|
56
|
-
presenceSubscribe: (toJid: string, tcToken?: Buffer | undefined) => Promise<void>;
|
|
57
|
-
profilePictureUrl: (jid: string, type?: "image" | "preview", timeoutMs?: number | undefined) => Promise<string | undefined>;
|
|
58
|
-
onWhatsApp: (...jids: string[]) => Promise<{
|
|
59
|
-
exists: boolean;
|
|
60
|
-
jid: string;
|
|
61
|
-
}[]>;
|
|
62
|
-
fetchBlocklist: () => Promise<string[]>;
|
|
63
|
-
fetchStatus: (jid: string) => Promise<{
|
|
64
|
-
status: string | undefined;
|
|
65
|
-
setAt: Date;
|
|
66
|
-
} | undefined>;
|
|
67
|
-
updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
68
|
-
removeProfilePicture: (jid: string) => Promise<void>;
|
|
69
|
-
updateProfileStatus: (status: string) => Promise<void>;
|
|
70
|
-
updateProfileName: (name: string) => Promise<void>;
|
|
71
|
-
updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
|
|
72
|
-
updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
73
|
-
updateOnlinePrivacy: (value: import("../Types").WAPrivacyOnlineValue) => Promise<void>;
|
|
74
|
-
updateProfilePicturePrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
75
|
-
updateStatusPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
76
|
-
updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
|
|
77
|
-
updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
78
|
-
updateDefaultDisappearingMode: (duration: number) => Promise<void>;
|
|
79
|
-
getBusinessProfile: (jid: string) => Promise<void | import("../Types").WABusinessProfile>;
|
|
80
|
-
resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
|
|
81
|
-
chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
|
|
82
|
-
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>;
|
|
83
|
-
addChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
84
|
-
removeChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
85
|
-
addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
86
|
-
removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
87
|
-
star: (jid: string, messages: {
|
|
88
|
-
id: string;
|
|
89
|
-
fromMe?: boolean | undefined;
|
|
90
|
-
}[], star: boolean) => Promise<void>;
|
|
91
|
-
type: "md";
|
|
92
|
-
ws: any;
|
|
93
|
-
ev: import("../Types").BaileysEventEmitter & {
|
|
94
|
-
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
|
|
95
|
-
buffer(): void;
|
|
96
|
-
createBufferedFunction<A extends any[], T_1>(work: (...args: A) => Promise<T_1>): (...args: A) => Promise<T_1>;
|
|
97
|
-
flush(force?: boolean | undefined): boolean;
|
|
98
|
-
isBuffering(): boolean;
|
|
99
|
-
};
|
|
100
|
-
authState: {
|
|
101
|
-
creds: import("../Types").AuthenticationCreds;
|
|
102
|
-
keys: import("../Types").SignalKeyStoreWithTransaction;
|
|
103
|
-
};
|
|
104
|
-
signalRepository: import("../Types").SignalRepository;
|
|
105
|
-
user: import("../Types").Contact | undefined;
|
|
106
|
-
generateMessageTag: () => string;
|
|
107
|
-
query: (node: BinaryNode, timeoutMs?: number | undefined) => Promise<BinaryNode>;
|
|
108
|
-
waitForMessage: <T_2>(msgId: string, timeoutMs?: number | undefined) => Promise<T_2>;
|
|
109
|
-
waitForSocketOpen: () => Promise<void>;
|
|
110
|
-
sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
|
|
111
|
-
sendNode: (frame: BinaryNode) => Promise<void>;
|
|
112
|
-
logout: (msg?: string | undefined) => Promise<void>;
|
|
113
|
-
end: (error: Error | undefined) => void;
|
|
114
|
-
onUnexpectedError: (err: Error | Boom<any>, msg: string) => void;
|
|
115
|
-
uploadPreKeys: (count?: number) => Promise<void>;
|
|
116
|
-
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
117
|
-
requestPairingCode: (phoneNumber: string) => Promise<string>;
|
|
118
|
-
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
|
|
119
|
-
};
|
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { AxiosRequestConfig } from 'axios';
|
|
3
|
-
import { KeyPair, SignedKeyPair, SocketConfig } from '../Types';
|
|
4
|
-
export declare const makeRegistrationSocket: (config: SocketConfig) => {
|
|
5
|
-
register: (code: string) => Promise<ExistsResponse>;
|
|
6
|
-
requestRegistrationCode: (registrationOptions?: RegistrationOptions) => Promise<ExistsResponse>;
|
|
7
|
-
getOrderDetails: (orderId: string, tokenBase64: string) => Promise<import("../Types").OrderDetails>;
|
|
8
|
-
getCatalog: ({ jid, limit, cursor }: import("../Types").GetCatalogOptions) => Promise<{
|
|
9
|
-
products: import("../Types").Product[];
|
|
10
|
-
nextPageCursor: string | undefined;
|
|
11
|
-
}>;
|
|
12
|
-
getCollections: (jid?: string | undefined, limit?: number) => Promise<{
|
|
13
|
-
collections: import("../Types").CatalogCollection[];
|
|
14
|
-
}>;
|
|
15
|
-
productCreate: (create: import("../Types").ProductCreate) => Promise<import("../Types").Product>;
|
|
16
|
-
productDelete: (productIds: string[]) => Promise<{
|
|
17
|
-
deleted: number;
|
|
18
|
-
}>;
|
|
19
|
-
productUpdate: (productId: string, update: import("../Types").ProductUpdate) => Promise<import("../Types").Product>;
|
|
20
|
-
sendMessageAck: ({ tag, attrs }: import("../WABinary").BinaryNode) => Promise<void>;
|
|
21
|
-
sendRetryRequest: (node: import("../WABinary").BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
|
|
22
|
-
rejectCall: (callId: string, callFrom: string) => Promise<void>;
|
|
23
|
-
getPrivacyTokens: (jids: string[]) => Promise<import("../WABinary").BinaryNode>;
|
|
24
|
-
assertSessions: (jids: string[], force: boolean) => Promise<boolean>;
|
|
25
|
-
relayMessage: (jid: string, message: import("../Types").WAProto.IMessage, { messageId: msgId, participant, additionalAttributes, useUserDevicesCache, cachedGroupMetadata, statusJidList }: import("../Types").MessageRelayOptions) => Promise<string>;
|
|
26
|
-
sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../Types").MessageReceiptType) => Promise<void>;
|
|
27
|
-
sendReceipts: (keys: import("../Types").WAProto.IMessageKey[], type: import("../Types").MessageReceiptType) => Promise<void>;
|
|
28
|
-
getButtonArgs: (message: import("../Types").WAProto.IMessage) => {
|
|
29
|
-
[key: string]: string;
|
|
30
|
-
};
|
|
31
|
-
readMessages: (keys: import("../Types").WAProto.IMessageKey[]) => Promise<void>;
|
|
32
|
-
refreshMediaConn: (forceGet?: boolean) => Promise<import("../Types").MediaConnInfo>;
|
|
33
|
-
waUploadToServer: import("../Types").WAMediaUploadFunction;
|
|
34
|
-
fetchPrivacySettings: (force?: boolean) => Promise<{
|
|
35
|
-
[_: string]: string;
|
|
36
|
-
}>;
|
|
37
|
-
updateMediaMessage: (message: import("../Types").WAProto.IWebMessageInfo) => Promise<import("../Types").WAProto.IWebMessageInfo>;
|
|
38
|
-
sendMessage: (jid: string, content: import("../Types").AnyMessageContent, options?: import("../Types").MiscMessageGenerationOptions) => Promise<import("../Types").WAProto.WebMessageInfo | undefined>;
|
|
39
|
-
groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>;
|
|
40
|
-
groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>;
|
|
41
|
-
groupLeave: (id: string) => Promise<void>;
|
|
42
|
-
/** the network code of your mobile network
|
|
43
|
-
* @see {@link https://de.wikipedia.org/wiki/Mobile_Network_Code}
|
|
44
|
-
*/
|
|
45
|
-
groupUpdateSubject: (jid: string, subject: string) => Promise<void>;
|
|
46
|
-
groupRequestParticipantsList: (jid: string) => Promise<{
|
|
47
|
-
[key: string]: string;
|
|
48
|
-
}[]>;
|
|
49
|
-
groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "reject" | "approve") => Promise<{
|
|
50
|
-
status: string;
|
|
51
|
-
jid: string;
|
|
52
|
-
}[]>;
|
|
53
|
-
groupParticipantsUpdate: (jid: string, participants: string[], action: import("../Types").ParticipantAction) => Promise<{
|
|
54
|
-
status: string;
|
|
55
|
-
jid: string;
|
|
56
|
-
content: import("../WABinary").BinaryNode;
|
|
57
|
-
}[]>;
|
|
58
|
-
groupUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>;
|
|
59
|
-
groupInviteCode: (jid: string) => Promise<string | undefined>;
|
|
60
|
-
groupRevokeInvite: (jid: string) => Promise<string | undefined>;
|
|
61
|
-
groupAcceptInvite: (code: string) => Promise<string | undefined>;
|
|
62
|
-
groupAcceptInviteV4: (key: string | import("../Types").WAProto.IMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<string>;
|
|
63
|
-
groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>;
|
|
64
|
-
groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
|
|
65
|
-
groupSettingUpdate: (jid: string, setting: "announcement" | "locked" | "not_announcement" | "unlocked") => Promise<void>;
|
|
66
|
-
groupMemberAddMode: (jid: string, mode: "all_member_add" | "admin_add") => Promise<void>;
|
|
67
|
-
groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
|
|
68
|
-
groupFetchAllParticipating: () => Promise<{
|
|
69
|
-
[_: string]: import("../Types").GroupMetadata;
|
|
70
|
-
}>;
|
|
71
|
-
processingMutex: {
|
|
72
|
-
mutex<T>(code: () => T | Promise<T>): Promise<T>;
|
|
73
|
-
};
|
|
74
|
-
upsertMessage: (msg: import("../Types").WAProto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>;
|
|
75
|
-
appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
|
|
76
|
-
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string | undefined) => Promise<void>;
|
|
77
|
-
presenceSubscribe: (toJid: string, tcToken?: Buffer | undefined) => Promise<void>;
|
|
78
|
-
profilePictureUrl: (jid: string, type?: "image" | "preview", timeoutMs?: number | undefined) => Promise<string | undefined>;
|
|
79
|
-
onWhatsApp: (...jids: string[]) => Promise<{
|
|
80
|
-
exists: boolean;
|
|
81
|
-
jid: string;
|
|
82
|
-
}[]>;
|
|
83
|
-
fetchBlocklist: () => Promise<string[]>;
|
|
84
|
-
fetchStatus: (jid: string) => Promise<{
|
|
85
|
-
status: string | undefined;
|
|
86
|
-
setAt: Date;
|
|
87
|
-
} | undefined>;
|
|
88
|
-
updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
89
|
-
removeProfilePicture: (jid: string) => Promise<void>;
|
|
90
|
-
updateProfileStatus: (status: string) => Promise<void>;
|
|
91
|
-
updateProfileName: (name: string) => Promise<void>;
|
|
92
|
-
updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
|
|
93
|
-
updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
94
|
-
updateOnlinePrivacy: (value: import("../Types").WAPrivacyOnlineValue) => Promise<void>;
|
|
95
|
-
updateProfilePicturePrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
96
|
-
updateStatusPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
97
|
-
updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
|
|
98
|
-
updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
99
|
-
updateDefaultDisappearingMode: (duration: number) => Promise<void>;
|
|
100
|
-
getBusinessProfile: (jid: string) => Promise<void | import("../Types").WABusinessProfile>;
|
|
101
|
-
resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
|
|
102
|
-
chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
|
|
103
|
-
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>;
|
|
104
|
-
addChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
105
|
-
removeChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
106
|
-
addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
107
|
-
removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
108
|
-
star: (jid: string, messages: {
|
|
109
|
-
id: string;
|
|
110
|
-
fromMe?: boolean | undefined;
|
|
111
|
-
}[], star: boolean) => Promise<void>;
|
|
112
|
-
type: "md";
|
|
113
|
-
ws: any;
|
|
114
|
-
ev: import("../Types").BaileysEventEmitter & {
|
|
115
|
-
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
|
|
116
|
-
buffer(): void;
|
|
117
|
-
createBufferedFunction<A extends any[], T_1>(work: (...args: A) => Promise<T_1>): (...args: A) => Promise<T_1>;
|
|
118
|
-
flush(force?: boolean | undefined): boolean;
|
|
119
|
-
isBuffering(): boolean;
|
|
120
|
-
};
|
|
121
|
-
authState: {
|
|
122
|
-
creds: import("../Types").AuthenticationCreds;
|
|
123
|
-
keys: import("../Types").SignalKeyStoreWithTransaction;
|
|
124
|
-
};
|
|
125
|
-
signalRepository: import("../Types").SignalRepository;
|
|
126
|
-
user: import("../Types").Contact | undefined;
|
|
127
|
-
generateMessageTag: () => string;
|
|
128
|
-
query: (node: import("../WABinary").BinaryNode, timeoutMs?: number | undefined) => Promise<import("../WABinary").BinaryNode>;
|
|
129
|
-
waitForMessage: <T_2>(msgId: string, timeoutMs?: number | undefined) => Promise<T_2>;
|
|
130
|
-
waitForSocketOpen: () => Promise<void>;
|
|
131
|
-
sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
|
|
132
|
-
sendNode: (frame: import("../WABinary").BinaryNode) => Promise<void>;
|
|
133
|
-
logout: (msg?: string | undefined) => Promise<void>;
|
|
134
|
-
end: (error: Error | undefined) => void;
|
|
135
|
-
onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void;
|
|
136
|
-
uploadPreKeys: (count?: number) => Promise<void>;
|
|
137
|
-
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
138
|
-
requestPairingCode: (phoneNumber: string) => Promise<string>;
|
|
139
|
-
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
|
|
140
|
-
};
|
|
141
|
-
export interface RegistrationData {
|
|
142
|
-
registrationId: number;
|
|
143
|
-
signedPreKey: SignedKeyPair;
|
|
144
|
-
noiseKey: KeyPair;
|
|
145
|
-
signedIdentityKey: KeyPair;
|
|
146
|
-
identityId: Buffer;
|
|
147
|
-
phoneId: string;
|
|
148
|
-
deviceId: string;
|
|
149
|
-
backupToken: Buffer;
|
|
150
|
-
}
|
|
151
|
-
export interface RegistrationOptions {
|
|
152
|
-
/** your phone number */
|
|
153
|
-
phoneNumber?: string;
|
|
154
|
-
/** the country code of your phone number */
|
|
155
|
-
phoneNumberCountryCode: string;
|
|
156
|
-
/** your phone number without country code */
|
|
157
|
-
phoneNumberNationalNumber: string;
|
|
158
|
-
/** the country code of your mobile network
|
|
159
|
-
* @see {@link https://de.wikipedia.org/wiki/Mobile_Country_Code}
|
|
160
|
-
*/
|
|
161
|
-
phoneNumberMobileCountryCode: string;
|
|
162
|
-
/** the network code of your mobile network
|
|
163
|
-
* @see {@link https://de.wikipedia.org/wiki/Mobile_Network_Code}
|
|
164
|
-
*/
|
|
165
|
-
phoneNumberMobileNetworkCode: string;
|
|
166
|
-
/**
|
|
167
|
-
* How to send the one time code
|
|
168
|
-
*/
|
|
169
|
-
method?: 'sms' | 'voice' | 'captcha';
|
|
170
|
-
/**
|
|
171
|
-
* The captcha code if it was requested
|
|
172
|
-
*/
|
|
173
|
-
captcha?: string;
|
|
174
|
-
}
|
|
175
|
-
export type RegistrationParams = RegistrationData & RegistrationOptions;
|
|
176
|
-
export declare function registrationParams(params: RegistrationParams): {
|
|
177
|
-
cc: string;
|
|
178
|
-
in: string;
|
|
179
|
-
Rc: string;
|
|
180
|
-
lg: string;
|
|
181
|
-
lc: string;
|
|
182
|
-
mistyped: string;
|
|
183
|
-
authkey: string;
|
|
184
|
-
e_regid: string;
|
|
185
|
-
e_keytype: string;
|
|
186
|
-
e_ident: string;
|
|
187
|
-
e_skey_id: string;
|
|
188
|
-
e_skey_val: string;
|
|
189
|
-
e_skey_sig: string;
|
|
190
|
-
fdid: string;
|
|
191
|
-
network_ratio_type: string;
|
|
192
|
-
expid: string;
|
|
193
|
-
simnum: string;
|
|
194
|
-
hasinrc: string;
|
|
195
|
-
pid: string;
|
|
196
|
-
id: string;
|
|
197
|
-
backup_token: string;
|
|
198
|
-
token: string;
|
|
199
|
-
fraud_checkpoint_code: string | undefined;
|
|
200
|
-
};
|
|
201
|
-
/**
|
|
202
|
-
* Requests a registration code for the given phone number.
|
|
203
|
-
*/
|
|
204
|
-
export declare function mobileRegisterCode(params: RegistrationParams, fetchOptions?: AxiosRequestConfig): Promise<ExistsResponse>;
|
|
205
|
-
export declare function mobileRegisterExists(params: RegistrationParams, fetchOptions?: AxiosRequestConfig): Promise<ExistsResponse>;
|
|
206
|
-
/**
|
|
207
|
-
* Registers the phone number on whatsapp with the received OTP code.
|
|
208
|
-
*/
|
|
209
|
-
export declare function mobileRegister(params: RegistrationParams & {
|
|
210
|
-
code: string;
|
|
211
|
-
}, fetchOptions?: AxiosRequestConfig): Promise<ExistsResponse>;
|
|
212
|
-
/**
|
|
213
|
-
* Encrypts the given string as AEAD aes-256-gcm with the public whatsapp key and a random keypair.
|
|
214
|
-
*/
|
|
215
|
-
export declare function mobileRegisterEncrypt(data: string): string;
|
|
216
|
-
export declare function mobileRegisterFetch(path: string, opts?: AxiosRequestConfig): Promise<ExistsResponse>;
|
|
217
|
-
export interface ExistsResponse {
|
|
218
|
-
status: 'fail' | 'sent';
|
|
219
|
-
voice_length?: number;
|
|
220
|
-
voice_wait?: number;
|
|
221
|
-
sms_length?: number;
|
|
222
|
-
sms_wait?: number;
|
|
223
|
-
reason?: 'incorrect' | 'missing_param' | 'code_checkpoint';
|
|
224
|
-
login?: string;
|
|
225
|
-
flash_type?: number;
|
|
226
|
-
ab_hash?: string;
|
|
227
|
-
ab_key?: string;
|
|
228
|
-
exp_cfg?: string;
|
|
229
|
-
lid?: string;
|
|
230
|
-
image_blob?: string;
|
|
231
|
-
audio_blob?: string;
|
|
232
|
-
}
|
package/lib/Socket/socket.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Boom } from '@hapi/boom';
|
|
3
|
-
import { SocketConfig } from '../Types';
|
|
4
|
-
import { BinaryNode } from '../WABinary';
|
|
5
|
-
/**
|
|
6
|
-
* Connects to WA servers and performs:
|
|
7
|
-
* - simple queries (no retry mechanism, wait for connection establishment)
|
|
8
|
-
* - listen to messages and emit events
|
|
9
|
-
* - query phone connection
|
|
10
|
-
*/
|
|
11
|
-
export declare const makeSocket: (config: SocketConfig) => {
|
|
12
|
-
type: "md";
|
|
13
|
-
ws: any;
|
|
14
|
-
ev: import("../Types").BaileysEventEmitter & {
|
|
15
|
-
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
|
|
16
|
-
buffer(): void;
|
|
17
|
-
createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): (...args: A) => Promise<T>;
|
|
18
|
-
flush(force?: boolean | undefined): boolean;
|
|
19
|
-
isBuffering(): boolean;
|
|
20
|
-
};
|
|
21
|
-
authState: {
|
|
22
|
-
creds: import("../Types").AuthenticationCreds;
|
|
23
|
-
keys: import("../Types").SignalKeyStoreWithTransaction;
|
|
24
|
-
};
|
|
25
|
-
signalRepository: import("../Types").SignalRepository;
|
|
26
|
-
readonly user: import("../Types").Contact | undefined;
|
|
27
|
-
generateMessageTag: () => string;
|
|
28
|
-
query: (node: BinaryNode, timeoutMs?: number) => Promise<BinaryNode>;
|
|
29
|
-
waitForMessage: <T_1>(msgId: string, timeoutMs?: number | undefined) => Promise<T_1>;
|
|
30
|
-
waitForSocketOpen: () => Promise<void>;
|
|
31
|
-
sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
|
|
32
|
-
sendNode: (frame: BinaryNode) => Promise<void>;
|
|
33
|
-
logout: (msg?: string) => Promise<void>;
|
|
34
|
-
end: (error: Error | undefined) => void;
|
|
35
|
-
onUnexpectedError: (err: Error | Boom, msg: string) => void;
|
|
36
|
-
uploadPreKeys: (count?: number) => Promise<void>;
|
|
37
|
-
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
38
|
-
requestPairingCode: (phoneNumber: string) => Promise<string>;
|
|
39
|
-
/** Waits for the connection to WA to reach a state */
|
|
40
|
-
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
|
|
41
|
-
};
|
|
42
|
-
export type Socket = ReturnType<typeof makeSocket>;
|
package/lib/Store/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { AuthenticationCreds } from '../Types';
|
|
2
|
-
declare const makeCacheManagerAuthState: (store: Store, sessionKey: string) => Promise<{
|
|
3
|
-
clearState: () => Promise<void>;
|
|
4
|
-
saveCreds: () => Promise<void>;
|
|
5
|
-
state: {
|
|
6
|
-
creds: AuthenticationCreds;
|
|
7
|
-
keys: {
|
|
8
|
-
get: (type: string, ids: string[]) => Promise<{}>;
|
|
9
|
-
set: (data: any) => Promise<void>;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
}>;
|
|
13
|
-
export default makeCacheManagerAuthState;
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import type KeyedDB from '@adiwajshing/keyed-db';
|
|
2
|
-
import type { Comparable } from '@adiwajshing/keyed-db/lib/Types';
|
|
3
|
-
import type { Logger } from 'pino';
|
|
4
|
-
import { proto } from '../../WAProto';
|
|
5
|
-
import type makeMDSocket from '../Socket';
|
|
6
|
-
import type { BaileysEventEmitter, Chat, ConnectionState, Contact, GroupMetadata, PresenceData, WAMessage, WAMessageCursor, WAMessageKey } from '../Types';
|
|
7
|
-
import { Label } from '../Types/Label';
|
|
8
|
-
import { LabelAssociation } from '../Types/LabelAssociation';
|
|
9
|
-
import { ObjectRepository } from './object-repository';
|
|
10
|
-
type WASocket = ReturnType<typeof makeMDSocket>;
|
|
11
|
-
export declare const waChatKey: (pin: boolean) => {
|
|
12
|
-
key: (c: Chat) => string;
|
|
13
|
-
compare: (k1: string, k2: string) => number;
|
|
14
|
-
};
|
|
15
|
-
export declare const waMessageID: (m: WAMessage) => string;
|
|
16
|
-
export declare const waLabelAssociationKey: Comparable<LabelAssociation, string>;
|
|
17
|
-
export type BaileysInMemoryStoreConfig = {
|
|
18
|
-
chatKey?: Comparable<Chat, string>;
|
|
19
|
-
labelAssociationKey?: Comparable<LabelAssociation, string>;
|
|
20
|
-
logger?: Logger;
|
|
21
|
-
};
|
|
22
|
-
declare const _default: ({ logger: _logger, chatKey, labelAssociationKey }: BaileysInMemoryStoreConfig) => {
|
|
23
|
-
chats: KeyedDB<Chat, string>;
|
|
24
|
-
contacts: {
|
|
25
|
-
[_: string]: Contact;
|
|
26
|
-
};
|
|
27
|
-
messages: {
|
|
28
|
-
[_: string]: {
|
|
29
|
-
array: proto.IWebMessageInfo[];
|
|
30
|
-
get: (id: string) => proto.IWebMessageInfo | undefined;
|
|
31
|
-
upsert: (item: proto.IWebMessageInfo, mode: "append" | "prepend") => void;
|
|
32
|
-
update: (item: proto.IWebMessageInfo) => boolean;
|
|
33
|
-
remove: (item: proto.IWebMessageInfo) => boolean;
|
|
34
|
-
updateAssign: (id: string, update: Partial<proto.IWebMessageInfo>) => boolean;
|
|
35
|
-
clear: () => void;
|
|
36
|
-
filter: (contain: (item: proto.IWebMessageInfo) => boolean) => void;
|
|
37
|
-
toJSON: () => proto.IWebMessageInfo[];
|
|
38
|
-
fromJSON: (newItems: proto.IWebMessageInfo[]) => void;
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
groupMetadata: {
|
|
42
|
-
[_: string]: GroupMetadata;
|
|
43
|
-
};
|
|
44
|
-
state: ConnectionState;
|
|
45
|
-
presences: {
|
|
46
|
-
[id: string]: {
|
|
47
|
-
[participant: string]: PresenceData;
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
labels: ObjectRepository<Label>;
|
|
51
|
-
labelAssociations: KeyedDB<LabelAssociation, string>;
|
|
52
|
-
bind: (ev: BaileysEventEmitter) => void;
|
|
53
|
-
/** loads messages from the store, if not found -- uses the legacy connection */
|
|
54
|
-
loadMessages: (jid: string, count: number, cursor: WAMessageCursor) => Promise<proto.IWebMessageInfo[]>;
|
|
55
|
-
/**
|
|
56
|
-
* Get all available labels for profile
|
|
57
|
-
*
|
|
58
|
-
* Keep in mind that the list is formed from predefined tags and tags
|
|
59
|
-
* that were "caught" during their editing.
|
|
60
|
-
*/
|
|
61
|
-
getLabels: () => ObjectRepository<Label>;
|
|
62
|
-
/**
|
|
63
|
-
* Get labels for chat
|
|
64
|
-
*
|
|
65
|
-
* @returns Label IDs
|
|
66
|
-
**/
|
|
67
|
-
getChatLabels: (chatId: string) => LabelAssociation[];
|
|
68
|
-
/**
|
|
69
|
-
* Get labels for message
|
|
70
|
-
*
|
|
71
|
-
* @returns Label IDs
|
|
72
|
-
**/
|
|
73
|
-
getMessageLabels: (messageId: string) => string[];
|
|
74
|
-
loadMessage: (jid: string, id: string) => Promise<proto.IWebMessageInfo | undefined>;
|
|
75
|
-
mostRecentMessage: (jid: string) => Promise<proto.IWebMessageInfo>;
|
|
76
|
-
fetchImageUrl: (jid: string, sock: WASocket | undefined) => Promise<string | null | undefined>;
|
|
77
|
-
fetchGroupMetadata: (jid: string, sock: WASocket | undefined) => Promise<GroupMetadata>;
|
|
78
|
-
fetchMessageReceipts: ({ remoteJid, id }: WAMessageKey) => Promise<proto.IUserReceipt[] | null | undefined>;
|
|
79
|
-
toJSON: () => {
|
|
80
|
-
chats: KeyedDB<Chat, string>;
|
|
81
|
-
contacts: {
|
|
82
|
-
[_: string]: Contact;
|
|
83
|
-
};
|
|
84
|
-
messages: {
|
|
85
|
-
[_: string]: {
|
|
86
|
-
array: proto.IWebMessageInfo[];
|
|
87
|
-
get: (id: string) => proto.IWebMessageInfo | undefined;
|
|
88
|
-
upsert: (item: proto.IWebMessageInfo, mode: "append" | "prepend") => void;
|
|
89
|
-
update: (item: proto.IWebMessageInfo) => boolean;
|
|
90
|
-
remove: (item: proto.IWebMessageInfo) => boolean;
|
|
91
|
-
updateAssign: (id: string, update: Partial<proto.IWebMessageInfo>) => boolean;
|
|
92
|
-
clear: () => void;
|
|
93
|
-
filter: (contain: (item: proto.IWebMessageInfo) => boolean) => void;
|
|
94
|
-
toJSON: () => proto.IWebMessageInfo[];
|
|
95
|
-
fromJSON: (newItems: proto.IWebMessageInfo[]) => void;
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
labels: ObjectRepository<Label>;
|
|
99
|
-
labelAssociations: KeyedDB<LabelAssociation, string>;
|
|
100
|
-
};
|
|
101
|
-
fromJSON: (json: {
|
|
102
|
-
chats: Chat[];
|
|
103
|
-
contacts: {
|
|
104
|
-
[id: string]: Contact;
|
|
105
|
-
};
|
|
106
|
-
messages: {
|
|
107
|
-
[id: string]: proto.IWebMessageInfo[];
|
|
108
|
-
};
|
|
109
|
-
labels: {
|
|
110
|
-
[labelId: string]: Label;
|
|
111
|
-
};
|
|
112
|
-
labelAssociations: LabelAssociation[];
|
|
113
|
-
}) => void;
|
|
114
|
-
writeToFile: (path: string) => void;
|
|
115
|
-
readFromFile: (path: string) => void;
|
|
116
|
-
};
|
|
117
|
-
export default _default;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
declare function makeOrderedDictionary<T>(idGetter: (item: T) => string): {
|
|
2
|
-
array: T[];
|
|
3
|
-
get: (id: string) => T | undefined;
|
|
4
|
-
upsert: (item: T, mode: 'append' | 'prepend') => void;
|
|
5
|
-
update: (item: T) => boolean;
|
|
6
|
-
remove: (item: T) => boolean;
|
|
7
|
-
updateAssign: (id: string, update: Partial<T>) => boolean;
|
|
8
|
-
clear: () => void;
|
|
9
|
-
filter: (contain: (item: T) => boolean) => void;
|
|
10
|
-
toJSON: () => T[];
|
|
11
|
-
fromJSON: (newItems: T[]) => void;
|
|
12
|
-
};
|
|
13
|
-
export default makeOrderedDictionary;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare class ObjectRepository<T extends object> {
|
|
2
|
-
readonly entityMap: Map<string, T>;
|
|
3
|
-
constructor(entities?: Record<string, T>);
|
|
4
|
-
findById(id: string): T | undefined;
|
|
5
|
-
findAll(): T[];
|
|
6
|
-
upsertById(id: string, entity: T): Map<string, T>;
|
|
7
|
-
deleteById(id: string): boolean;
|
|
8
|
-
count(): number;
|
|
9
|
-
toJSON(): T[];
|
|
10
|
-
}
|
package/lib/Types/Auth.d.ts
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import type { proto } from '../../WAProto';
|
|
3
|
-
import { RegistrationOptions } from '../Socket/registration';
|
|
4
|
-
import type { Contact } from './Contact';
|
|
5
|
-
import type { MinimalMessage } from './Message';
|
|
6
|
-
export type KeyPair = {
|
|
7
|
-
public: Uint8Array;
|
|
8
|
-
private: Uint8Array;
|
|
9
|
-
};
|
|
10
|
-
export type SignedKeyPair = {
|
|
11
|
-
keyPair: KeyPair;
|
|
12
|
-
signature: Uint8Array;
|
|
13
|
-
keyId: number;
|
|
14
|
-
timestampS?: number;
|
|
15
|
-
};
|
|
16
|
-
export type ProtocolAddress = {
|
|
17
|
-
name: string;
|
|
18
|
-
deviceId: number;
|
|
19
|
-
};
|
|
20
|
-
export type SignalIdentity = {
|
|
21
|
-
identifier: ProtocolAddress;
|
|
22
|
-
identifierKey: Uint8Array;
|
|
23
|
-
};
|
|
24
|
-
export type LTHashState = {
|
|
25
|
-
version: number;
|
|
26
|
-
hash: Buffer;
|
|
27
|
-
indexValueMap: {
|
|
28
|
-
[indexMacBase64: string]: {
|
|
29
|
-
valueMac: Uint8Array | Buffer;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
export type SignalCreds = {
|
|
34
|
-
readonly signedIdentityKey: KeyPair;
|
|
35
|
-
readonly signedPreKey: SignedKeyPair;
|
|
36
|
-
readonly registrationId: number;
|
|
37
|
-
};
|
|
38
|
-
export type AccountSettings = {
|
|
39
|
-
/** unarchive chats when a new message is received */
|
|
40
|
-
unarchiveChats: boolean;
|
|
41
|
-
/** the default mode to start new conversations with */
|
|
42
|
-
defaultDisappearingMode?: Pick<proto.IConversation, 'ephemeralExpiration' | 'ephemeralSettingTimestamp'>;
|
|
43
|
-
};
|
|
44
|
-
export type AuthenticationCreds = SignalCreds & {
|
|
45
|
-
readonly noiseKey: KeyPair;
|
|
46
|
-
readonly pairingEphemeralKeyPair: KeyPair;
|
|
47
|
-
advSecretKey: string;
|
|
48
|
-
me?: Contact;
|
|
49
|
-
account?: proto.IADVSignedDeviceIdentity;
|
|
50
|
-
signalIdentities?: SignalIdentity[];
|
|
51
|
-
myAppStateKeyId?: string;
|
|
52
|
-
firstUnuploadedPreKeyId: number;
|
|
53
|
-
nextPreKeyId: number;
|
|
54
|
-
lastAccountSyncTimestamp?: number;
|
|
55
|
-
platform?: string;
|
|
56
|
-
processedHistoryMessages: MinimalMessage[];
|
|
57
|
-
/** number of times history & app state has been synced */
|
|
58
|
-
accountSyncCounter: number;
|
|
59
|
-
accountSettings: AccountSettings;
|
|
60
|
-
deviceId: string;
|
|
61
|
-
phoneId: string;
|
|
62
|
-
identityId: Buffer;
|
|
63
|
-
registered: boolean;
|
|
64
|
-
backupToken: Buffer;
|
|
65
|
-
registration: RegistrationOptions;
|
|
66
|
-
pairingCode: string | undefined;
|
|
67
|
-
};
|
|
68
|
-
export type SignalDataTypeMap = {
|
|
69
|
-
'pre-key': KeyPair;
|
|
70
|
-
'session': Uint8Array;
|
|
71
|
-
'sender-key': Uint8Array;
|
|
72
|
-
'sender-key-memory': {
|
|
73
|
-
[jid: string]: boolean;
|
|
74
|
-
};
|
|
75
|
-
'app-state-sync-key': proto.Message.IAppStateSyncKeyData;
|
|
76
|
-
'app-state-sync-version': LTHashState;
|
|
77
|
-
};
|
|
78
|
-
export type SignalDataSet = {
|
|
79
|
-
[T in keyof SignalDataTypeMap]?: {
|
|
80
|
-
[id: string]: SignalDataTypeMap[T] | null;
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
type Awaitable<T> = T | Promise<T>;
|
|
84
|
-
export type SignalKeyStore = {
|
|
85
|
-
get<T extends keyof SignalDataTypeMap>(type: T, ids: string[]): Awaitable<{
|
|
86
|
-
[id: string]: SignalDataTypeMap[T];
|
|
87
|
-
}>;
|
|
88
|
-
set(data: SignalDataSet): Awaitable<void>;
|
|
89
|
-
/** clear all the data in the store */
|
|
90
|
-
clear?(): Awaitable<void>;
|
|
91
|
-
};
|
|
92
|
-
export type SignalKeyStoreWithTransaction = SignalKeyStore & {
|
|
93
|
-
isInTransaction: () => boolean;
|
|
94
|
-
transaction<T>(exec: () => Promise<T>): Promise<T>;
|
|
95
|
-
};
|
|
96
|
-
export type TransactionCapabilityOptions = {
|
|
97
|
-
maxCommitRetries: number;
|
|
98
|
-
delayBetweenTriesMs: number;
|
|
99
|
-
};
|
|
100
|
-
export type SignalAuthState = {
|
|
101
|
-
creds: SignalCreds;
|
|
102
|
-
keys: SignalKeyStore | SignalKeyStoreWithTransaction;
|
|
103
|
-
};
|
|
104
|
-
export type AuthenticationState = {
|
|
105
|
-
creds: AuthenticationCreds;
|
|
106
|
-
keys: SignalKeyStore;
|
|
107
|
-
};
|
|
108
|
-
export {};
|