zaileys 0.29.7-beta → 0.29.9-beta
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/README.md +0 -342
- package/bun.lock +1027 -0
- package/dist/classes/Client.d.ts +17 -0
- package/dist/classes/Event.d.ts +12 -0
- package/dist/classes/Parser.d.ts +3 -0
- package/dist/database/handler.d.ts +12 -0
- package/dist/database/schema.d.ts +63 -0
- package/dist/helpers/adapter.d.ts +57 -0
- package/dist/helpers/error.d.ts +8 -0
- package/dist/index.d.ts +2 -235
- package/dist/types/adapter/general.d.ts +156 -0
- package/dist/types/classes/client.d.ts +152 -0
- package/dist/types/classes/event.d.ts +65 -0
- package/dist/zaileys.cjs.js +1 -0
- package/dist/zaileys.esm.js +1 -0
- package/package.json +42 -29
- package/rollup.config.js +38 -0
- package/src/classes/Client.ts +73 -0
- package/src/classes/Event.ts +59 -0
- package/src/classes/Parser.ts +3 -0
- package/src/database/handler.ts +272 -0
- package/src/database/schema.ts +37 -0
- package/src/helpers/adapter.ts +125 -0
- package/src/helpers/error.ts +13 -0
- package/src/index.ts +2 -0
- package/src/types/adapter/general.ts +178 -0
- package/src/types/classes/client.ts +53 -0
- package/src/types/classes/event.ts +29 -0
- package/src/types/libsignal.d.ts +4 -0
- package/test/example.ts +37 -0
- package/tsconfig.json +16 -0
- package/LICENSE +0 -21
- package/dist/index.d.mts +0 -235
- package/dist/index.js +0 -1
- package/dist/index.mjs +0 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ClientClassesType } from "../types/classes/client";
|
|
3
|
+
import { EventCallbackType, EventEnumType } from "../types/classes/event";
|
|
4
|
+
declare class Client {
|
|
5
|
+
private props;
|
|
6
|
+
options: z.infer<typeof ClientClassesType> | undefined;
|
|
7
|
+
private chatId;
|
|
8
|
+
private logger;
|
|
9
|
+
private event;
|
|
10
|
+
private db;
|
|
11
|
+
private socket;
|
|
12
|
+
private groupCache;
|
|
13
|
+
constructor(props: z.input<typeof ClientClassesType>);
|
|
14
|
+
initialize(): Promise<void>;
|
|
15
|
+
on<T extends EventEnumType>(event: T, handler: EventCallbackType[T]): void;
|
|
16
|
+
}
|
|
17
|
+
export default Client;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { WASocket } from "baileys";
|
|
2
|
+
import { EventCallbackType, EventEnumType } from "../types/classes/event";
|
|
3
|
+
import Client from "./Client";
|
|
4
|
+
declare class Event {
|
|
5
|
+
private client;
|
|
6
|
+
private events;
|
|
7
|
+
constructor(client: Client);
|
|
8
|
+
setup(sock: WASocket): void;
|
|
9
|
+
on<T extends EventEnumType>(event: T, handler: EventCallbackType[T]): void;
|
|
10
|
+
private emit;
|
|
11
|
+
}
|
|
12
|
+
export default Event;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Kysely } from "kysely";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { AuthAdapterHandlerType } from "../types/adapter/general";
|
|
4
|
+
import { AdapterDatabaseType } from "../types/classes/client";
|
|
5
|
+
import type { DB } from "./schema";
|
|
6
|
+
import { BaileysEventEmitter } from "baileys";
|
|
7
|
+
export declare const ConnectDB: (type: z.infer<typeof AdapterDatabaseType>["type"], url: string) => Kysely<DB>;
|
|
8
|
+
export declare const MigrateDB: (db: Kysely<DB>) => Promise<void>;
|
|
9
|
+
export declare const AuthAdapterHandler: (db: Kysely<DB>, session: string) => AuthAdapterHandlerType;
|
|
10
|
+
export declare const StoreAdapterHandler: (db: Kysely<DB>, session: string) => Promise<{
|
|
11
|
+
bind: (event: BaileysEventEmitter) => void;
|
|
12
|
+
}>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const AuthSchema: z.ZodObject<{
|
|
3
|
+
session: z.ZodString;
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
value: z.ZodNullable<z.ZodString>;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
session: string;
|
|
8
|
+
value: string | null;
|
|
9
|
+
id: string;
|
|
10
|
+
}, {
|
|
11
|
+
session: string;
|
|
12
|
+
value: string | null;
|
|
13
|
+
id: string;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const ChatSchema: z.ZodObject<{
|
|
16
|
+
session: z.ZodString;
|
|
17
|
+
id: z.ZodString;
|
|
18
|
+
value: z.ZodNullable<z.ZodString>;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
session: string;
|
|
21
|
+
value: string | null;
|
|
22
|
+
id: string;
|
|
23
|
+
}, {
|
|
24
|
+
session: string;
|
|
25
|
+
value: string | null;
|
|
26
|
+
id: string;
|
|
27
|
+
}>;
|
|
28
|
+
export declare const ContactSchema: z.ZodObject<{
|
|
29
|
+
session: z.ZodString;
|
|
30
|
+
id: z.ZodString;
|
|
31
|
+
value: z.ZodNullable<z.ZodString>;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
session: string;
|
|
34
|
+
value: string | null;
|
|
35
|
+
id: string;
|
|
36
|
+
}, {
|
|
37
|
+
session: string;
|
|
38
|
+
value: string | null;
|
|
39
|
+
id: string;
|
|
40
|
+
}>;
|
|
41
|
+
export declare const MessageSchema: z.ZodObject<{
|
|
42
|
+
session: z.ZodString;
|
|
43
|
+
id: z.ZodString;
|
|
44
|
+
value: z.ZodNullable<z.ZodString>;
|
|
45
|
+
}, "strip", z.ZodTypeAny, {
|
|
46
|
+
session: string;
|
|
47
|
+
value: string | null;
|
|
48
|
+
id: string;
|
|
49
|
+
}, {
|
|
50
|
+
session: string;
|
|
51
|
+
value: string | null;
|
|
52
|
+
id: string;
|
|
53
|
+
}>;
|
|
54
|
+
export type AuthTable = z.infer<typeof AuthSchema>;
|
|
55
|
+
export type ChatTable = z.infer<typeof ChatSchema>;
|
|
56
|
+
export type ContactTable = z.infer<typeof ContactSchema>;
|
|
57
|
+
export type MessageTable = z.infer<typeof MessageSchema>;
|
|
58
|
+
export type DB = {
|
|
59
|
+
auth: AuthTable;
|
|
60
|
+
chats: ChatTable;
|
|
61
|
+
contacts: ContactTable;
|
|
62
|
+
messages: MessageTable;
|
|
63
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { AppDataSync, valueReplacer, valueReviver } from "../types/adapter/general";
|
|
2
|
+
export declare const fromObject: (args: AppDataSync) => {
|
|
3
|
+
keyData: Uint8Array<ArrayBuffer>;
|
|
4
|
+
fingerprint: {
|
|
5
|
+
rawId: number;
|
|
6
|
+
currentIndex: number;
|
|
7
|
+
deviceIndexes: number[];
|
|
8
|
+
};
|
|
9
|
+
timestamp: number | import("long").Long;
|
|
10
|
+
};
|
|
11
|
+
export declare const BufferJSON: {
|
|
12
|
+
replacer: (_: string, value: valueReplacer) => valueReplacer | {
|
|
13
|
+
type: string;
|
|
14
|
+
data: string;
|
|
15
|
+
};
|
|
16
|
+
reviver: (_: string, value: valueReviver) => valueReviver | Buffer<ArrayBuffer>;
|
|
17
|
+
};
|
|
18
|
+
export declare const initAuthCreds: () => {
|
|
19
|
+
noiseKey: {
|
|
20
|
+
private: Buffer<any>;
|
|
21
|
+
public: Buffer<any>;
|
|
22
|
+
};
|
|
23
|
+
pairingEphemeralKeyPair: {
|
|
24
|
+
private: Buffer<any>;
|
|
25
|
+
public: Buffer<any>;
|
|
26
|
+
};
|
|
27
|
+
signedIdentityKey: {
|
|
28
|
+
private: Buffer<any>;
|
|
29
|
+
public: Buffer<any>;
|
|
30
|
+
};
|
|
31
|
+
signedPreKey: {
|
|
32
|
+
keyPair: {
|
|
33
|
+
private: Buffer<any>;
|
|
34
|
+
public: Buffer<any>;
|
|
35
|
+
};
|
|
36
|
+
signature: any;
|
|
37
|
+
keyId: number;
|
|
38
|
+
};
|
|
39
|
+
registrationId: number;
|
|
40
|
+
advSecretKey: string;
|
|
41
|
+
processedHistoryMessages: never[];
|
|
42
|
+
nextPreKeyId: number;
|
|
43
|
+
firstUnuploadedPreKeyId: number;
|
|
44
|
+
accountSyncCounter: number;
|
|
45
|
+
accountSettings: {
|
|
46
|
+
unarchiveChats: boolean;
|
|
47
|
+
};
|
|
48
|
+
deviceId: string;
|
|
49
|
+
phoneId: `${string}-${string}-${string}-${string}-${string}`;
|
|
50
|
+
identityId: Buffer<ArrayBufferLike>;
|
|
51
|
+
backupToken: Buffer<ArrayBufferLike>;
|
|
52
|
+
registered: boolean;
|
|
53
|
+
registration: never;
|
|
54
|
+
pairingCode: undefined;
|
|
55
|
+
lastPropHash: undefined;
|
|
56
|
+
routingInfo: undefined;
|
|
57
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,235 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
declare const MESSAGE_TYPE: {
|
|
5
|
-
readonly text: "text";
|
|
6
|
-
readonly conversation: "text";
|
|
7
|
-
readonly imageMessage: "image";
|
|
8
|
-
readonly contactMessage: "contact";
|
|
9
|
-
readonly locationMessage: "location";
|
|
10
|
-
readonly documentMessage: "document";
|
|
11
|
-
readonly audioMessage: "audio";
|
|
12
|
-
readonly videoMessage: "video";
|
|
13
|
-
readonly protocolMessage: "protocol";
|
|
14
|
-
readonly contactsArrayMessage: "contactsArray";
|
|
15
|
-
readonly highlyStructuredMessage: "highlyStructured";
|
|
16
|
-
readonly sendPaymentMessage: "sendPayment";
|
|
17
|
-
readonly liveLocationMessage: "liveLocation";
|
|
18
|
-
readonly requestPaymentMessage: "requestPayment";
|
|
19
|
-
readonly declinePaymentRequestMessage: "declinePaymentRequest";
|
|
20
|
-
readonly cancelPaymentRequestMessage: "cancelPaymentRequest";
|
|
21
|
-
readonly templateMessage: "template";
|
|
22
|
-
readonly stickerMessage: "sticker";
|
|
23
|
-
readonly groupInviteMessage: "groupInvite";
|
|
24
|
-
readonly templateButtonReplyMessage: "templateButtonReply";
|
|
25
|
-
readonly productMessage: "product";
|
|
26
|
-
readonly deviceSentMessage: "deviceSent";
|
|
27
|
-
readonly listMessage: "list";
|
|
28
|
-
readonly viewOnceMessage: "viewOnce";
|
|
29
|
-
readonly orderMessage: "order";
|
|
30
|
-
readonly listResponseMessage: "listResponse";
|
|
31
|
-
readonly ephemeralMessage: "ephemeral";
|
|
32
|
-
readonly invoiceMessage: "invoice";
|
|
33
|
-
readonly buttonsMessage: "buttons";
|
|
34
|
-
readonly buttonsResponseMessage: "buttonsResponse";
|
|
35
|
-
readonly paymentInviteMessage: "paymentInvite";
|
|
36
|
-
readonly interactiveMessage: "interactive";
|
|
37
|
-
readonly reactionMessage: "reaction";
|
|
38
|
-
readonly stickerSyncRmrMessage: "sticker";
|
|
39
|
-
readonly interactiveResponseMessage: "interactiveResponse";
|
|
40
|
-
readonly pollCreationMessage: "pollCreation";
|
|
41
|
-
readonly pollUpdateMessage: "pollUpdate";
|
|
42
|
-
readonly keepInChatMessage: "keepInChat";
|
|
43
|
-
readonly documentWithCaptionMessage: "document";
|
|
44
|
-
readonly requestPhoneNumberMessage: "requestPhoneNumber";
|
|
45
|
-
readonly viewOnceMessageV2: "viewOnce";
|
|
46
|
-
readonly encReactionMessage: "reaction";
|
|
47
|
-
readonly editedMessage: "text";
|
|
48
|
-
readonly viewOnceMessageV2Extension: "viewOnce";
|
|
49
|
-
readonly pollCreationMessageV2: "pollCreation";
|
|
50
|
-
readonly scheduledCallCreationMessage: "scheduledCallCreation";
|
|
51
|
-
readonly groupMentionedMessage: "groupMentioned";
|
|
52
|
-
readonly pinInChatMessage: "pinInChat";
|
|
53
|
-
readonly pollCreationMessageV3: "pollCreation";
|
|
54
|
-
readonly scheduledCallEditMessage: "scheduledCallEdit";
|
|
55
|
-
readonly ptvMessage: "ptv";
|
|
56
|
-
readonly botInvokeMessage: "botInvoke";
|
|
57
|
-
readonly callLogMesssage: "callLog";
|
|
58
|
-
readonly encCommentMessage: "encComment";
|
|
59
|
-
readonly bcallMessage: "bcall";
|
|
60
|
-
readonly lottieStickerMessage: "lottieSticker";
|
|
61
|
-
readonly eventMessage: "event";
|
|
62
|
-
readonly commentMessage: "comment";
|
|
63
|
-
readonly newsletterAdminInviteMessage: "text";
|
|
64
|
-
readonly extendedTextMessageWithParentKey: "text";
|
|
65
|
-
readonly placeholderMessage: "placeholder";
|
|
66
|
-
readonly encEventUpdateMessage: "encEventUpdate";
|
|
67
|
-
};
|
|
68
|
-
declare const VERIFIED_PLATFORM: {
|
|
69
|
-
readonly whatsapp: "0@s.whatsapp.net";
|
|
70
|
-
readonly meta: "13135550002@s.whatsapp.net";
|
|
71
|
-
readonly chatgpt: "18002428478@s.whatsapp.net";
|
|
72
|
-
readonly copilot: "18772241042@s.whatsapp.net";
|
|
73
|
-
readonly instagram: "447723442971@s.whatsapp.net";
|
|
74
|
-
readonly tiktok: "6285574670498@s.whatsapp.net";
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
declare const Config_MESSAGE_TYPE: typeof MESSAGE_TYPE;
|
|
78
|
-
declare const Config_VERIFIED_PLATFORM: typeof VERIFIED_PLATFORM;
|
|
79
|
-
declare namespace Config {
|
|
80
|
-
export { Config_MESSAGE_TYPE as MESSAGE_TYPE, Config_VERIFIED_PLATFORM as VERIFIED_PLATFORM };
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
type FakeVerifiedEnum = keyof typeof VERIFIED_PLATFORM;
|
|
84
|
-
type SendActionType = {
|
|
85
|
-
asReply?: boolean;
|
|
86
|
-
senderId?: string;
|
|
87
|
-
};
|
|
88
|
-
type ReplyActionType = {
|
|
89
|
-
footer?: string;
|
|
90
|
-
fakeVerified?: FakeVerifiedEnum;
|
|
91
|
-
senderId?: string;
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
type Action_FakeVerifiedEnum = FakeVerifiedEnum;
|
|
95
|
-
type Action_ReplyActionType = ReplyActionType;
|
|
96
|
-
type Action_SendActionType = SendActionType;
|
|
97
|
-
declare namespace Action {
|
|
98
|
-
export type { Action_FakeVerifiedEnum as FakeVerifiedEnum, Action_ReplyActionType as ReplyActionType, Action_SendActionType as SendActionType };
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
type MessageTypeEnum = (typeof MESSAGE_TYPE)[keyof typeof MESSAGE_TYPE];
|
|
102
|
-
type DeviceTypeEnum = "unknown" | "android" | "ios" | "desktop" | "web";
|
|
103
|
-
type ExtractCitationType<T> = {
|
|
104
|
-
[K in keyof T as `is${Capitalize<K & string>}`]: boolean;
|
|
105
|
-
};
|
|
106
|
-
type MessageBaseContent<T> = {
|
|
107
|
-
fromMe: boolean;
|
|
108
|
-
chatId: string;
|
|
109
|
-
channelId: string;
|
|
110
|
-
roomId: string;
|
|
111
|
-
roomImage: () => Promise<string | null>;
|
|
112
|
-
senderId: string;
|
|
113
|
-
senderName: string;
|
|
114
|
-
senderDevice: DeviceTypeEnum;
|
|
115
|
-
senderBio: () => Promise<string | null>;
|
|
116
|
-
senderImage: () => Promise<string | null>;
|
|
117
|
-
senderBusiness: () => Promise<WABusinessProfile | null>;
|
|
118
|
-
chatType: MessageTypeEnum;
|
|
119
|
-
timestamp: number;
|
|
120
|
-
text: string;
|
|
121
|
-
command: string;
|
|
122
|
-
mentions: string[] | null;
|
|
123
|
-
isTagMe: boolean;
|
|
124
|
-
isGroup: boolean;
|
|
125
|
-
isStory: boolean;
|
|
126
|
-
isEdited: boolean;
|
|
127
|
-
isChannel: boolean;
|
|
128
|
-
isBroadcast: boolean;
|
|
129
|
-
isEphemeral: boolean;
|
|
130
|
-
isForwarded: boolean;
|
|
131
|
-
citation: {
|
|
132
|
-
[key: string]: unknown;
|
|
133
|
-
} | null;
|
|
134
|
-
media: {
|
|
135
|
-
buffer?: () => Promise<Buffer | null>;
|
|
136
|
-
stream?: () => Promise<Buffer | null>;
|
|
137
|
-
[key: string]: unknown;
|
|
138
|
-
} | null;
|
|
139
|
-
reply: MessageBaseContent<T> | null;
|
|
140
|
-
key: () => proto.IMessageKey;
|
|
141
|
-
message: () => proto.IWebMessageInfo;
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
type Message_DeviceTypeEnum = DeviceTypeEnum;
|
|
145
|
-
type Message_ExtractCitationType<T> = ExtractCitationType<T>;
|
|
146
|
-
type Message_MessageBaseContent<T> = MessageBaseContent<T>;
|
|
147
|
-
type Message_MessageTypeEnum = MessageTypeEnum;
|
|
148
|
-
declare namespace Message {
|
|
149
|
-
export type { Message_DeviceTypeEnum as DeviceTypeEnum, Message_ExtractCitationType as ExtractCitationType, Message_MessageBaseContent as MessageBaseContent, Message_MessageTypeEnum as MessageTypeEnum };
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
type AuthType = "pairing" | "qr";
|
|
153
|
-
type CitationConfig = {
|
|
154
|
-
[key: string]: (() => string[]) | (() => Promise<string[]>);
|
|
155
|
-
};
|
|
156
|
-
interface BaseClientConfig {
|
|
157
|
-
prefix?: string;
|
|
158
|
-
ignoreMe?: boolean;
|
|
159
|
-
authPath?: string;
|
|
160
|
-
authType: AuthType;
|
|
161
|
-
showLogs?: boolean;
|
|
162
|
-
autoMentions?: boolean;
|
|
163
|
-
autoOnline?: boolean;
|
|
164
|
-
autoRead?: boolean;
|
|
165
|
-
autoRejectCall?: boolean;
|
|
166
|
-
citation?: CitationConfig;
|
|
167
|
-
}
|
|
168
|
-
interface PairingClientConfig extends BaseClientConfig {
|
|
169
|
-
authType: "pairing";
|
|
170
|
-
phoneNumber: number;
|
|
171
|
-
}
|
|
172
|
-
interface QRClientConfig extends BaseClientConfig {
|
|
173
|
-
authType: "qr";
|
|
174
|
-
}
|
|
175
|
-
type ClientConfig = PairingClientConfig | QRClientConfig;
|
|
176
|
-
interface BaseContext {
|
|
177
|
-
}
|
|
178
|
-
interface ConnectionContext extends BaseContext {
|
|
179
|
-
status: "connecting" | "open" | "close";
|
|
180
|
-
}
|
|
181
|
-
interface ErrorContext extends BaseContext {
|
|
182
|
-
error: Error;
|
|
183
|
-
}
|
|
184
|
-
interface ClientEvents<B> {
|
|
185
|
-
connection: (ctx: ConnectionContext) => void;
|
|
186
|
-
message: (ctx: MessageBaseContent<B>) => void;
|
|
187
|
-
error: (ctx: ErrorContext) => void;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
type General_AuthType = AuthType;
|
|
191
|
-
type General_BaseClientConfig = BaseClientConfig;
|
|
192
|
-
type General_BaseContext = BaseContext;
|
|
193
|
-
type General_CitationConfig = CitationConfig;
|
|
194
|
-
type General_ClientConfig = ClientConfig;
|
|
195
|
-
type General_ClientEvents<B> = ClientEvents<B>;
|
|
196
|
-
type General_ConnectionContext = ConnectionContext;
|
|
197
|
-
type General_ErrorContext = ErrorContext;
|
|
198
|
-
type General_PairingClientConfig = PairingClientConfig;
|
|
199
|
-
type General_QRClientConfig = QRClientConfig;
|
|
200
|
-
declare namespace General {
|
|
201
|
-
export type { General_AuthType as AuthType, General_BaseClientConfig as BaseClientConfig, General_BaseContext as BaseContext, General_CitationConfig as CitationConfig, General_ClientConfig as ClientConfig, General_ClientEvents as ClientEvents, General_ConnectionContext as ConnectionContext, General_ErrorContext as ErrorContext, General_PairingClientConfig as PairingClientConfig, General_QRClientConfig as QRClientConfig };
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
declare class Client extends EventEmitter {
|
|
205
|
-
private config;
|
|
206
|
-
private authState;
|
|
207
|
-
private authProvider;
|
|
208
|
-
private socket;
|
|
209
|
-
private store;
|
|
210
|
-
private groupCache;
|
|
211
|
-
private logger;
|
|
212
|
-
protected temporaryMessage: MessageBaseContent<any> | null;
|
|
213
|
-
protected parseMention: string[];
|
|
214
|
-
private spinner;
|
|
215
|
-
constructor(config: ClientConfig);
|
|
216
|
-
protected initialize(): Promise<void>;
|
|
217
|
-
private deleteSession;
|
|
218
|
-
on<K extends keyof ClientEvents<typeof this$1.config.citation>>(event: K, listener: ClientEvents<typeof this$1.config.citation>[K]): this;
|
|
219
|
-
emit<K extends keyof ClientEvents<typeof this$1.config.citation>>(event: K, ...args: Parameters<ClientEvents<typeof this$1.config.citation>[K]>): boolean;
|
|
220
|
-
protected generateMentions(mentions: string[]): string[];
|
|
221
|
-
protected generateFakeVerified(key: proto.IMessageKey, platform: FakeVerifiedEnum): {
|
|
222
|
-
participant: "0@s.whatsapp.net" | "13135550002@s.whatsapp.net" | "18002428478@s.whatsapp.net" | "18772241042@s.whatsapp.net" | "447723442971@s.whatsapp.net" | "6285574670498@s.whatsapp.net";
|
|
223
|
-
remoteJid?: string | null | undefined;
|
|
224
|
-
fromMe?: boolean | null | undefined;
|
|
225
|
-
id?: string | null | undefined;
|
|
226
|
-
};
|
|
227
|
-
sendText(text: string, payload?: ReplyActionType): Promise<void>;
|
|
228
|
-
sendReply(text: string, payload?: ReplyActionType): Promise<void>;
|
|
229
|
-
sendImage(image: string | Buffer, payload?: SendActionType): Promise<void>;
|
|
230
|
-
sendVideo(video: string | Buffer, payload?: SendActionType): Promise<void>;
|
|
231
|
-
sendAudio(audio: string | Buffer, payload?: SendActionType): Promise<void>;
|
|
232
|
-
sendSticker(sticker: string | Buffer, payload?: SendActionType): Promise<void>;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
export { Client, Config, General, Message, Action as Types, Client as default };
|
|
1
|
+
import Client from "./classes/Client";
|
|
2
|
+
export default Client;
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
type Awaitable<T> = T | Promise<T>;
|
|
2
|
+
export type AuthAdapterHandlerType = Promise<{
|
|
3
|
+
state: AuthenticationState;
|
|
4
|
+
saveCreds: () => Promise<void>;
|
|
5
|
+
clear: () => Promise<void>;
|
|
6
|
+
removeCreds: () => Promise<void>;
|
|
7
|
+
}>;
|
|
8
|
+
type Contact = {
|
|
9
|
+
id: string;
|
|
10
|
+
lid?: string;
|
|
11
|
+
name?: string;
|
|
12
|
+
notify?: string;
|
|
13
|
+
verifiedName?: string;
|
|
14
|
+
imgUrl?: string | null;
|
|
15
|
+
status?: string;
|
|
16
|
+
};
|
|
17
|
+
type Account = {
|
|
18
|
+
details?: Uint8Array | null;
|
|
19
|
+
accountSignatureKey?: Uint8Array | null;
|
|
20
|
+
accountSignature?: Uint8Array | null;
|
|
21
|
+
deviceSignature?: Uint8Array | null;
|
|
22
|
+
};
|
|
23
|
+
type SignedKeyPair = {
|
|
24
|
+
keyPair: KeyPair;
|
|
25
|
+
signature: Uint8Array;
|
|
26
|
+
keyId: number;
|
|
27
|
+
timestampS?: number;
|
|
28
|
+
};
|
|
29
|
+
type ProtocolAddress = {
|
|
30
|
+
name: string;
|
|
31
|
+
deviceId: number;
|
|
32
|
+
};
|
|
33
|
+
type SignalIdentity = {
|
|
34
|
+
identifier: ProtocolAddress;
|
|
35
|
+
identifierKey: Uint8Array;
|
|
36
|
+
};
|
|
37
|
+
type LTHashState = {
|
|
38
|
+
version: number;
|
|
39
|
+
hash: Buffer;
|
|
40
|
+
indexValueMap: {
|
|
41
|
+
[indexMacBase64: string]: {
|
|
42
|
+
valueMac: Uint8Array | Buffer;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
type SignalCreds = {
|
|
47
|
+
readonly signedIdentityKey: KeyPair;
|
|
48
|
+
readonly signedPreKey: SignedKeyPair;
|
|
49
|
+
readonly registrationId: number;
|
|
50
|
+
};
|
|
51
|
+
type AccountSettings = {
|
|
52
|
+
unarchiveChats: boolean;
|
|
53
|
+
defaultDisappearingMode?: Pick<any, "ephemeralExpiration" | "ephemeralSettingTimestamp">;
|
|
54
|
+
};
|
|
55
|
+
type SignalKeyStore = {
|
|
56
|
+
get<T extends keyof SignalDataTypeMap>(type: T, ids: string[]): Awaitable<{
|
|
57
|
+
[id: string]: SignalDataTypeMap[T];
|
|
58
|
+
}>;
|
|
59
|
+
set(data: SignalDataSet): Awaitable<void>;
|
|
60
|
+
clear?(): Awaitable<void>;
|
|
61
|
+
};
|
|
62
|
+
interface RegistrationOptions {
|
|
63
|
+
phoneNumber?: string;
|
|
64
|
+
phoneNumberCountryCode: string;
|
|
65
|
+
phoneNumberNationalNumber: string;
|
|
66
|
+
phoneNumberMobileCountryCode: string;
|
|
67
|
+
phoneNumberMobileNetworkCode: string;
|
|
68
|
+
method?: "sms" | "voice" | "captcha";
|
|
69
|
+
captcha?: string;
|
|
70
|
+
}
|
|
71
|
+
export type SslOptions = {
|
|
72
|
+
pfx?: string;
|
|
73
|
+
key?: string | string[] | Buffer | Buffer[];
|
|
74
|
+
passphrase?: string;
|
|
75
|
+
cert?: string | string[] | Buffer | Buffer[];
|
|
76
|
+
ca?: string | string[] | Buffer | Buffer[];
|
|
77
|
+
crl?: string | string[];
|
|
78
|
+
ciphers?: string;
|
|
79
|
+
rejectUnauthorized?: boolean;
|
|
80
|
+
minVersion?: string;
|
|
81
|
+
maxVersion?: string;
|
|
82
|
+
verifyIdentity?: boolean;
|
|
83
|
+
};
|
|
84
|
+
export type Fingerprint = {
|
|
85
|
+
rawId: number;
|
|
86
|
+
currentIndex: number;
|
|
87
|
+
deviceIndexes: number[];
|
|
88
|
+
};
|
|
89
|
+
export type AppDataSync = {
|
|
90
|
+
keyData: Uint8Array;
|
|
91
|
+
fingerprint: Fingerprint;
|
|
92
|
+
timestamp: Long | number;
|
|
93
|
+
};
|
|
94
|
+
export type SignalDataTypeMap = {
|
|
95
|
+
session: Uint8Array;
|
|
96
|
+
"pre-key": KeyPair;
|
|
97
|
+
"sender-key": Uint8Array;
|
|
98
|
+
"app-state-sync-key": AppDataSync;
|
|
99
|
+
"app-state-sync-version": LTHashState;
|
|
100
|
+
"sender-key-memory": {
|
|
101
|
+
[jid: string]: boolean;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
export type SignalDataSet = {
|
|
105
|
+
[T in keyof SignalDataTypeMap]?: {
|
|
106
|
+
[id: string]: SignalDataTypeMap[T] | null;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
export type KeyPair = {
|
|
110
|
+
public: Uint8Array;
|
|
111
|
+
private: Uint8Array;
|
|
112
|
+
};
|
|
113
|
+
export type sqlData = {
|
|
114
|
+
constructor: {
|
|
115
|
+
name: "RowDataPacket";
|
|
116
|
+
};
|
|
117
|
+
value?: object[];
|
|
118
|
+
};
|
|
119
|
+
export type valueReplacer = {
|
|
120
|
+
data: number[];
|
|
121
|
+
type: string;
|
|
122
|
+
};
|
|
123
|
+
export type valueReviver = {
|
|
124
|
+
data: string;
|
|
125
|
+
type: string;
|
|
126
|
+
};
|
|
127
|
+
export type AuthenticationState = {
|
|
128
|
+
creds: AuthenticationCreds;
|
|
129
|
+
keys: SignalKeyStore;
|
|
130
|
+
};
|
|
131
|
+
export type AuthenticationCreds = SignalCreds & {
|
|
132
|
+
readonly noiseKey: KeyPair;
|
|
133
|
+
readonly pairingEphemeralKeyPair: KeyPair;
|
|
134
|
+
advSecretKey: string;
|
|
135
|
+
me?: Contact;
|
|
136
|
+
account?: Account;
|
|
137
|
+
signalIdentities?: SignalIdentity[];
|
|
138
|
+
myAppStateKeyId?: string;
|
|
139
|
+
firstUnuploadedPreKeyId: number;
|
|
140
|
+
nextPreKeyId: number;
|
|
141
|
+
lastAccountSyncTimestamp?: number;
|
|
142
|
+
platform?: string;
|
|
143
|
+
processedHistoryMessages: Pick<any, "key" | "messageTimestamp">[];
|
|
144
|
+
accountSyncCounter: number;
|
|
145
|
+
accountSettings: AccountSettings;
|
|
146
|
+
deviceId: string;
|
|
147
|
+
phoneId: string;
|
|
148
|
+
identityId: Buffer;
|
|
149
|
+
registered: boolean;
|
|
150
|
+
backupToken: Buffer;
|
|
151
|
+
registration: RegistrationOptions;
|
|
152
|
+
pairingCode: string | undefined;
|
|
153
|
+
lastPropHash: string | undefined;
|
|
154
|
+
routingInfo: Buffer | undefined;
|
|
155
|
+
};
|
|
156
|
+
export {};
|