angularsockets 1.0.1 → 1.0.2
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 +1880 -36
- package/WAProto/index.d.ts +50383 -0
- package/WAProto/index.js +37203 -11791
- package/WASignalGroup/GroupProtocol.js +1697 -0
- package/WASignalGroup/ciphertext_message.js +16 -0
- package/WASignalGroup/group_cipher.js +120 -0
- package/WASignalGroup/group_session_builder.js +46 -0
- package/WASignalGroup/index.js +5 -0
- package/WASignalGroup/keyhelper.js +21 -0
- package/WASignalGroup/protobufs.js +3 -0
- package/WASignalGroup/queue_job.js +69 -0
- package/WASignalGroup/sender_chain_key.js +50 -0
- package/WASignalGroup/sender_key_distribution_message.js +78 -0
- package/WASignalGroup/sender_key_message.js +92 -0
- package/WASignalGroup/sender_key_name.js +70 -0
- package/WASignalGroup/sender_key_record.js +56 -0
- package/WASignalGroup/sender_key_state.js +129 -0
- package/{lib/Signal/Group/sender-message-key.js → WASignalGroup/sender_message_key.js} +16 -6
- package/lib/Defaults/baileys-version.json +1 -1
- package/lib/Defaults/index.js +79 -101
- package/lib/Signal/libsignal.js +29 -51
- package/lib/Socket/Client/web-socket-client.js +0 -2
- package/lib/Socket/business.d.ts +42 -43
- package/lib/Socket/chats.d.ts +9 -8
- package/lib/Socket/chats.js +107 -21
- package/lib/Socket/groups.d.ts +7 -7
- package/lib/Socket/groups.js +24 -25
- package/lib/Socket/index.d.ts +51 -52
- package/lib/Socket/messages-recv.d.ts +34 -37
- package/lib/Socket/messages-recv.js +37 -175
- package/lib/Socket/messages-send.d.ts +16 -10
- package/lib/Socket/messages-send.js +540 -346
- package/lib/Socket/newsletter.d.ts +26 -28
- package/lib/Socket/newsletter.js +4 -4
- package/lib/Socket/registration.d.ts +49 -52
- package/lib/Socket/registration.js +7 -7
- package/lib/Socket/socket.d.ts +1 -0
- package/lib/Socket/socket.js +36 -23
- package/lib/Socket/usync.d.ts +11 -10
- package/lib/Store/make-cache-manager-store.d.ts +2 -1
- package/lib/Store/make-in-memory-store.d.ts +2 -2
- package/lib/Store/make-in-memory-store.js +5 -1
- package/lib/Store/make-ordered-dictionary.js +2 -2
- package/lib/Types/Auth.d.ts +0 -1
- package/lib/Types/Call.d.ts +1 -1
- package/lib/Types/Chat.d.ts +12 -7
- package/lib/Types/Events.d.ts +17 -2
- package/lib/Types/GroupMetadata.d.ts +3 -2
- package/lib/Types/Label.d.ts +11 -0
- package/lib/Types/Label.js +1 -1
- package/lib/Types/LabelAssociation.js +1 -1
- package/lib/Types/Message.d.ts +170 -10
- package/lib/Types/Newsletter.js +3 -3
- package/lib/Types/Socket.d.ts +7 -2
- package/lib/Types/index.d.ts +9 -0
- package/lib/Types/index.js +1 -1
- package/lib/Utils/auth-utils.js +35 -14
- package/lib/Utils/business.d.ts +1 -1
- package/lib/Utils/business.js +2 -2
- package/lib/Utils/chat-utils.d.ts +11 -12
- package/lib/Utils/chat-utils.js +52 -36
- package/lib/Utils/crypto.d.ts +15 -16
- package/lib/Utils/crypto.js +74 -26
- package/lib/Utils/decode-wa-message.d.ts +17 -0
- package/lib/Utils/decode-wa-message.js +53 -17
- package/lib/Utils/event-buffer.js +10 -7
- package/lib/Utils/generics.d.ts +13 -17
- package/lib/Utils/generics.js +26 -15
- package/lib/Utils/history.d.ts +6 -2
- package/lib/Utils/history.js +4 -6
- package/lib/Utils/logger.d.ts +1 -3
- package/lib/Utils/lt-hash.js +12 -12
- package/lib/Utils/make-mutex.d.ts +2 -2
- package/lib/Utils/messages-media.d.ts +25 -28
- package/lib/Utils/messages-media.js +47 -57
- package/lib/Utils/messages.js +461 -44
- package/lib/Utils/noise-handler.d.ts +4 -5
- package/lib/Utils/noise-handler.js +19 -14
- package/lib/Utils/process-message.d.ts +5 -5
- package/lib/Utils/process-message.js +75 -23
- package/lib/Utils/signal.d.ts +2 -1
- package/lib/Utils/signal.js +43 -35
- package/lib/Utils/use-multi-file-auth-state.d.ts +0 -1
- package/lib/Utils/use-multi-file-auth-state.js +251 -36
- package/lib/Utils/use-single-file-auth-state.d.ts +12 -0
- package/lib/Utils/use-single-file-auth-state.js +75 -0
- package/lib/Utils/validate-connection.d.ts +1 -1
- package/lib/Utils/validate-connection.js +1 -1
- package/lib/WABinary/decode.d.ts +1 -2
- package/lib/WABinary/decode.js +23 -11
- package/lib/WABinary/encode.d.ts +1 -2
- package/lib/WABinary/encode.js +46 -22
- package/lib/WABinary/generic-utils.d.ts +2 -4
- package/lib/WABinary/generic-utils.js +2 -10
- package/lib/WABinary/jid-utils.d.ts +1 -1
- package/lib/WAM/BinaryInfo.d.ts +2 -11
- package/lib/WAM/encode.d.ts +1 -2
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +3 -3
- package/lib/WAUSync/USyncUser.d.ts +0 -2
- package/lib/index.js +0 -6
- package/package.json +96 -104
- package/engine-requirements.js +0 -10
- package/lib/Defaults/phonenumber-mcc.json +0 -223
- package/lib/Signal/Group/ciphertext-message.d.ts +0 -9
- package/lib/Signal/Group/ciphertext-message.js +0 -15
- package/lib/Signal/Group/group-session-builder.d.ts +0 -14
- package/lib/Signal/Group/group-session-builder.js +0 -64
- package/lib/Signal/Group/group_cipher.d.ts +0 -17
- package/lib/Signal/Group/group_cipher.js +0 -96
- package/lib/Signal/Group/index.d.ts +0 -11
- package/lib/Signal/Group/index.js +0 -57
- package/lib/Signal/Group/keyhelper.d.ts +0 -10
- package/lib/Signal/Group/keyhelper.js +0 -55
- package/lib/Signal/Group/queue-job.d.ts +0 -1
- package/lib/Signal/Group/queue-job.js +0 -57
- package/lib/Signal/Group/sender-chain-key.d.ts +0 -13
- package/lib/Signal/Group/sender-chain-key.js +0 -34
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -16
- package/lib/Signal/Group/sender-key-distribution-message.js +0 -66
- package/lib/Signal/Group/sender-key-message.d.ts +0 -18
- package/lib/Signal/Group/sender-key-message.js +0 -69
- package/lib/Signal/Group/sender-key-name.d.ts +0 -17
- package/lib/Signal/Group/sender-key-name.js +0 -51
- package/lib/Signal/Group/sender-key-record.d.ts +0 -30
- package/lib/Signal/Group/sender-key-record.js +0 -53
- package/lib/Signal/Group/sender-key-state.d.ts +0 -38
- package/lib/Signal/Group/sender-key-state.js +0 -99
- package/lib/Signal/Group/sender-message-key.d.ts +0 -11
- package/lib/Socket/dugong.d.ts +0 -175
- package/lib/Socket/dugong.js +0 -342
- package/lib/index.d.ts +0 -12
|
@@ -1,11 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.decryptMessageNode = exports.
|
|
3
|
+
exports.decryptMessageNode = exports.NACK_REASONS = exports.MISSING_KEYS_ERROR_TEXT = exports.NO_MESSAGE_FOUND_ERROR_TEXT = void 0;
|
|
4
|
+
exports.decodeMessageNode = decodeMessageNode;
|
|
4
5
|
const boom_1 = require("@hapi/boom");
|
|
5
6
|
const WAProto_1 = require("../../WAProto");
|
|
6
7
|
const WABinary_1 = require("../WABinary");
|
|
7
8
|
const generics_1 = require("./generics");
|
|
8
|
-
|
|
9
|
+
exports.NO_MESSAGE_FOUND_ERROR_TEXT = 'Message absent from node';
|
|
10
|
+
exports.MISSING_KEYS_ERROR_TEXT = 'Key used already or never filled';
|
|
11
|
+
exports.NACK_REASONS = {
|
|
12
|
+
ParsingError: 487,
|
|
13
|
+
UnrecognizedStanza: 488,
|
|
14
|
+
UnrecognizedStanzaClass: 489,
|
|
15
|
+
UnrecognizedStanzaType: 490,
|
|
16
|
+
InvalidProtobuf: 491,
|
|
17
|
+
InvalidHostedCompanionStanza: 493,
|
|
18
|
+
MissingMessageSecret: 495,
|
|
19
|
+
SignalErrorOldCounter: 496,
|
|
20
|
+
MessageDeletedOnPeer: 499,
|
|
21
|
+
UnhandledError: 500,
|
|
22
|
+
UnsupportedAdminRevoke: 550,
|
|
23
|
+
UnsupportedLIDGroup: 551,
|
|
24
|
+
DBOperationFailed: 552
|
|
25
|
+
};
|
|
9
26
|
/**
|
|
10
27
|
* Decode the received node as a message.
|
|
11
28
|
* @note this will only parse the message, not decrypt it
|
|
@@ -77,13 +94,21 @@ function decodeMessageNode(stanza, meId, meLid) {
|
|
|
77
94
|
else {
|
|
78
95
|
throw new boom_1.Boom('Unknown message type', { data: stanza });
|
|
79
96
|
}
|
|
80
|
-
const fromMe = (0, WABinary_1.isJidNewsLetter)(from) ? !!((_a = stanza.attrs) === null || _a === void 0 ? void 0 : _a.is_sender) : ((0, WABinary_1.isLidUser)(from) ? isMeLid : isMe)(stanza.attrs.participant || stanza.attrs.from);
|
|
97
|
+
const fromMe = (0, WABinary_1.isJidNewsLetter)(from) ? !!((_a = stanza.attrs) === null || _a === void 0 ? void 0 : _a.is_sender) : ((0, WABinary_1.isLidUser)(participant || from) ? isMeLid : isMe)(stanza.attrs.participant || stanza.attrs.from);
|
|
81
98
|
const pushname = stanza.attrs.notify;
|
|
82
99
|
const key = {
|
|
83
100
|
remoteJid: chatId,
|
|
84
101
|
fromMe,
|
|
85
102
|
id: msgId,
|
|
86
|
-
participant
|
|
103
|
+
...(stanza.attrs.participant_pn ?? participant) !== undefined && {
|
|
104
|
+
participant: fromMe ? meId : stanza.attrs.participant_pn ?? participant
|
|
105
|
+
},
|
|
106
|
+
...(stanza.attrs.participant_pn ?? participant) !== undefined && {
|
|
107
|
+
participant_pn: fromMe ? meId : stanza.attrs.participant_pn ?? participant
|
|
108
|
+
},
|
|
109
|
+
...(stanza.attrs.participant_lid ?? participant) !== undefined && {
|
|
110
|
+
participant_lid: fromMe ? meLid : stanza.attrs.participant_lid ?? participant
|
|
111
|
+
}
|
|
87
112
|
};
|
|
88
113
|
const fullMessage = {
|
|
89
114
|
key,
|
|
@@ -103,7 +128,6 @@ function decodeMessageNode(stanza, meId, meLid) {
|
|
|
103
128
|
sender: msgType === 'chat' ? author : chatId
|
|
104
129
|
};
|
|
105
130
|
}
|
|
106
|
-
exports.decodeMessageNode = decodeMessageNode;
|
|
107
131
|
const decryptMessageNode = (stanza, meId, meLid, repository, logger) => {
|
|
108
132
|
const { fullMessage, author, sender } = decodeMessageNode(stanza, meId, meLid);
|
|
109
133
|
return {
|
|
@@ -113,8 +137,11 @@ const decryptMessageNode = (stanza, meId, meLid, repository, logger) => {
|
|
|
113
137
|
async decrypt() {
|
|
114
138
|
var _a;
|
|
115
139
|
let decryptables = 0;
|
|
116
|
-
|
|
140
|
+
if ((0, WABinary_1.isJidNewsLetter)(fullMessage.key.remoteJid)) {
|
|
141
|
+
const node = (0, WABinary_1.getBinaryNodeChild)(stanza, 'plaintext');
|
|
142
|
+
const msg = WAProto_1.proto.Message.decode(node === null || node === void 0 ? void 0 : node.content);
|
|
117
143
|
if (msg.senderKeyDistributionMessage) {
|
|
144
|
+
//eslint-disable-next-line max-depth
|
|
118
145
|
try {
|
|
119
146
|
await repository.processSenderKeyDistributionMessage({
|
|
120
147
|
authorJid: author,
|
|
@@ -122,14 +149,9 @@ const decryptMessageNode = (stanza, meId, meLid, repository, logger) => {
|
|
|
122
149
|
});
|
|
123
150
|
}
|
|
124
151
|
catch (err) {
|
|
125
|
-
logger.error({ key: fullMessage.key, err }, 'failed to
|
|
152
|
+
logger.error({ key: fullMessage.key, err }, 'failed to decrypt message');
|
|
126
153
|
}
|
|
127
154
|
}
|
|
128
|
-
}
|
|
129
|
-
if ((0, WABinary_1.isJidNewsLetter)(fullMessage.key.remoteJid)) {
|
|
130
|
-
const node = (0, WABinary_1.getBinaryNodeChild)(stanza, 'plaintext');
|
|
131
|
-
const msg = WAProto_1.proto.Message.decode(node === null || node === void 0 ? void 0 : node.content);
|
|
132
|
-
await processSenderKeyDistribution(msg);
|
|
133
155
|
fullMessage.message = msg;
|
|
134
156
|
decryptables += 1;
|
|
135
157
|
}
|
|
@@ -140,7 +162,7 @@ const decryptMessageNode = (stanza, meId, meLid, repository, logger) => {
|
|
|
140
162
|
const details = WAProto_1.proto.VerifiedNameCertificate.Details.decode(cert.details);
|
|
141
163
|
fullMessage.verifiedBizName = details.verifiedName;
|
|
142
164
|
}
|
|
143
|
-
if (tag !== 'enc') {
|
|
165
|
+
if (tag !== 'enc' && tag !== 'plaintext') {
|
|
144
166
|
continue;
|
|
145
167
|
}
|
|
146
168
|
if (!(content instanceof Uint8Array)) {
|
|
@@ -149,7 +171,7 @@ const decryptMessageNode = (stanza, meId, meLid, repository, logger) => {
|
|
|
149
171
|
decryptables += 1;
|
|
150
172
|
let msgBuffer;
|
|
151
173
|
try {
|
|
152
|
-
const e2eType = attrs.type;
|
|
174
|
+
const e2eType = tag === 'plaintext' ? 'plaintext' : attrs.type;
|
|
153
175
|
switch (e2eType) {
|
|
154
176
|
case 'skmsg':
|
|
155
177
|
msgBuffer = await repository.decryptGroupMessage({
|
|
@@ -167,12 +189,26 @@ const decryptMessageNode = (stanza, meId, meLid, repository, logger) => {
|
|
|
167
189
|
ciphertext: content
|
|
168
190
|
});
|
|
169
191
|
break;
|
|
192
|
+
case 'plaintext':
|
|
193
|
+
msgBuffer = content;
|
|
194
|
+
break;
|
|
170
195
|
default:
|
|
171
196
|
throw new Error(`Unknown e2e type: ${e2eType}`);
|
|
172
197
|
}
|
|
173
|
-
let msg = WAProto_1.proto.Message.decode((0, generics_1.unpadRandomMax16)(msgBuffer));
|
|
198
|
+
let msg = WAProto_1.proto.Message.decode(e2eType !== 'plaintext' ? (0, generics_1.unpadRandomMax16)(msgBuffer) : msgBuffer);
|
|
174
199
|
msg = ((_a = msg.deviceSentMessage) === null || _a === void 0 ? void 0 : _a.message) || msg;
|
|
175
|
-
|
|
200
|
+
if (msg.senderKeyDistributionMessage) {
|
|
201
|
+
//eslint-disable-next-line max-depth
|
|
202
|
+
try {
|
|
203
|
+
await repository.processSenderKeyDistributionMessage({
|
|
204
|
+
authorJid: author,
|
|
205
|
+
item: msg.senderKeyDistributionMessage
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
catch (err) {
|
|
209
|
+
logger.error({ key: fullMessage.key, err }, 'failed to decrypt message');
|
|
210
|
+
}
|
|
211
|
+
}
|
|
176
212
|
if (fullMessage.message) {
|
|
177
213
|
Object.assign(fullMessage.message, msg);
|
|
178
214
|
}
|
|
@@ -190,7 +226,7 @@ const decryptMessageNode = (stanza, meId, meLid, repository, logger) => {
|
|
|
190
226
|
// if nothing was found to decrypt
|
|
191
227
|
if (!decryptables) {
|
|
192
228
|
fullMessage.messageStubType = WAProto_1.proto.WebMessageInfo.StubType.CIPHERTEXT;
|
|
193
|
-
fullMessage.messageStubParameters = [NO_MESSAGE_FOUND_ERROR_TEXT
|
|
229
|
+
fullMessage.messageStubParameters = [exports.NO_MESSAGE_FOUND_ERROR_TEXT];
|
|
194
230
|
}
|
|
195
231
|
}
|
|
196
232
|
};
|
|
@@ -176,6 +176,9 @@ function append(data, historyCache, event, eventData, logger) {
|
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
data.historySets.empty = false;
|
|
179
|
+
data.historySets.syncType = eventData.syncType;
|
|
180
|
+
data.historySets.progress = eventData.progress;
|
|
181
|
+
data.historySets.peerDataRequestSessionId = eventData.peerDataRequestSessionId;
|
|
179
182
|
data.historySets.isLatest = eventData.isLatest || data.historySets.isLatest;
|
|
180
183
|
break;
|
|
181
184
|
case 'chats.upsert':
|
|
@@ -442,7 +445,10 @@ function consolidateEvents(data) {
|
|
|
442
445
|
chats: Object.values(data.historySets.chats),
|
|
443
446
|
messages: Object.values(data.historySets.messages),
|
|
444
447
|
contacts: Object.values(data.historySets.contacts),
|
|
445
|
-
|
|
448
|
+
syncType: data.historySets.syncType,
|
|
449
|
+
progress: data.historySets.progress,
|
|
450
|
+
isLatest: data.historySets.isLatest,
|
|
451
|
+
peerDataRequestSessionId: data.historySets.peerDataRequestSessionId
|
|
446
452
|
};
|
|
447
453
|
}
|
|
448
454
|
const chatUpsertList = Object.values(data.chatUpserts);
|
|
@@ -496,12 +502,9 @@ function consolidateEvents(data) {
|
|
|
496
502
|
return map;
|
|
497
503
|
}
|
|
498
504
|
function concatChats(a, b) {
|
|
499
|
-
if (b.unreadCount === null) {
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
a.unreadCount = undefined;
|
|
503
|
-
b.unreadCount = undefined;
|
|
504
|
-
}
|
|
505
|
+
if (b.unreadCount === null && a.unreadCount < 0) {
|
|
506
|
+
a.unreadCount = undefined;
|
|
507
|
+
b.unreadCount = undefined;
|
|
505
508
|
}
|
|
506
509
|
if (typeof a.unreadCount === 'number' && typeof b.unreadCount === 'number') {
|
|
507
510
|
b = { ...b };
|
package/lib/Utils/generics.d.ts
CHANGED
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { AxiosRequestConfig } from 'axios';
|
|
3
2
|
import { Logger } from 'pino';
|
|
4
3
|
import { proto } from '../../WAProto';
|
|
5
|
-
import { BaileysEventEmitter, BaileysEventMap, WACallUpdateType, WAVersion } from '../Types';
|
|
4
|
+
import { BaileysEventEmitter, BaileysEventMap, BrowsersMap, ConnectionState, WACallUpdateType, WAVersion } from '../Types';
|
|
6
5
|
import { BinaryNode } from '../WABinary';
|
|
7
|
-
export declare const Browsers:
|
|
8
|
-
ubuntu: (browser: any) => [string, string, string];
|
|
9
|
-
macOS: (browser: any) => [string, string, string];
|
|
10
|
-
baileys: (browser: any) => [string, string, string];
|
|
11
|
-
windows: (browser: any) => [string, string, string];
|
|
12
|
-
/** The appropriate browser based on your OS & release */
|
|
13
|
-
appropriate: (browser: any) => [string, string, string];
|
|
14
|
-
};
|
|
6
|
+
export declare const Browsers: BrowsersMap;
|
|
15
7
|
export declare const getPlatformId: (browser: string) => any;
|
|
8
|
+
export declare const BufferJSON: {
|
|
9
|
+
replacer: (k: any, value: any) => any;
|
|
10
|
+
reviver: (_: any, value: any) => any;
|
|
11
|
+
};
|
|
16
12
|
export declare const getKeyAuthor: (key: proto.IMessageKey | undefined | null, meId?: string) => string;
|
|
17
|
-
export declare const writeRandomPadMax16: (msg: Uint8Array) =>
|
|
18
|
-
export declare const unpadRandomMax16: (e: Uint8Array | Buffer) => Uint8Array
|
|
19
|
-
export declare const encodeWAMessage: (message: proto.IMessage) =>
|
|
13
|
+
export declare const writeRandomPadMax16: (msg: Uint8Array) => any;
|
|
14
|
+
export declare const unpadRandomMax16: (e: Uint8Array | Buffer) => Uint8Array<any>;
|
|
15
|
+
export declare const encodeWAMessage: (message: proto.IMessage) => any;
|
|
20
16
|
export declare const generateRegistrationId: () => number;
|
|
21
|
-
export declare const encodeBigEndian: (e: number, t?: number) => Uint8Array
|
|
17
|
+
export declare const encodeBigEndian: (e: number, t?: number) => Uint8Array<ArrayBuffer>;
|
|
22
18
|
export declare const toNumber: (t: Long | number | null | undefined) => number;
|
|
23
19
|
/** unix timestamp of a date in seconds */
|
|
24
20
|
export declare const unixTimestampSeconds: (date?: Date) => number;
|
|
@@ -38,14 +34,14 @@ export declare function promiseTimeout<T>(ms: number | undefined, promise: (reso
|
|
|
38
34
|
export declare const generateMessageIDV2: (userId?: string) => string;
|
|
39
35
|
export declare const generateMessageID: () => string;
|
|
40
36
|
export declare function bindWaitForEvent<T extends keyof BaileysEventMap>(ev: BaileysEventEmitter, event: T): (check: (u: BaileysEventMap[T]) => boolean | undefined, timeoutMs?: number) => Promise<void>;
|
|
41
|
-
export declare const bindWaitForConnectionUpdate: (ev: BaileysEventEmitter) => (check: (u: Partial<
|
|
37
|
+
export declare const bindWaitForConnectionUpdate: (ev: BaileysEventEmitter) => (check: (u: Partial<ConnectionState>) => boolean | undefined, timeoutMs?: number) => Promise<void>;
|
|
42
38
|
export declare const printQRIfNecessaryListener: (ev: BaileysEventEmitter, logger: Logger) => void;
|
|
43
39
|
/**
|
|
44
40
|
* utility that fetches latest baileys version from the master branch.
|
|
45
41
|
* Use to ensure your WA connection is always on the latest version
|
|
46
42
|
*/
|
|
47
43
|
export declare const fetchLatestBaileysVersion: (options?: AxiosRequestConfig<any>) => Promise<{
|
|
48
|
-
version:
|
|
44
|
+
version: any;
|
|
49
45
|
isLatest: boolean;
|
|
50
46
|
error?: undefined;
|
|
51
47
|
} | {
|
|
@@ -87,6 +83,6 @@ export declare const getCodeFromWSError: (error: Error) => number;
|
|
|
87
83
|
* Is the given platform WA business
|
|
88
84
|
* @param platform AuthenticationCreds.platform
|
|
89
85
|
*/
|
|
90
|
-
export declare const isWABusinessPlatform: (platform: string) =>
|
|
86
|
+
export declare const isWABusinessPlatform: (platform: string) => platform is "smbi" | "smba";
|
|
91
87
|
export declare function trimUndefined(obj: any): any;
|
|
92
88
|
export declare function bytesToCrockford(buffer: Buffer): string;
|
package/lib/Utils/generics.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.isWABusinessPlatform = exports.getCodeFromWSError = exports.getCallStatusFromNode = exports.getErrorCodeFromStreamError = exports.getStatusFromReceiptType = exports.generateMdTagPrefix = exports.fetchLatestWaWebVersion = exports.fetchLatestBaileysVersion = exports.printQRIfNecessaryListener = exports.bindWaitForConnectionUpdate = exports.generateMessageID = exports.generateMessageIDV2 = exports.delayCancellable = exports.delay = exports.debouncedTimeout = exports.unixTimestampSeconds = exports.toNumber = exports.encodeBigEndian = exports.generateRegistrationId = exports.encodeWAMessage = exports.unpadRandomMax16 = exports.writeRandomPadMax16 = exports.getKeyAuthor = exports.BufferJSON = exports.getPlatformId = exports.Browsers = void 0;
|
|
7
|
+
exports.promiseTimeout = promiseTimeout;
|
|
8
|
+
exports.bindWaitForEvent = bindWaitForEvent;
|
|
9
|
+
exports.trimUndefined = trimUndefined;
|
|
10
|
+
exports.bytesToCrockford = bytesToCrockford;
|
|
7
11
|
const boom_1 = require("@hapi/boom");
|
|
8
12
|
const axios_1 = __importDefault(require("axios"));
|
|
9
13
|
const crypto_1 = require("crypto");
|
|
@@ -12,6 +16,13 @@ const WAProto_1 = require("../../WAProto");
|
|
|
12
16
|
const baileys_version_json_1 = require("../Defaults/baileys-version.json");
|
|
13
17
|
const Types_1 = require("../Types");
|
|
14
18
|
const WABinary_1 = require("../WABinary");
|
|
19
|
+
const COMPANION_PLATFORM_MAP = {
|
|
20
|
+
'Chrome': '49',
|
|
21
|
+
'Edge': '50',
|
|
22
|
+
'Firefox': '51',
|
|
23
|
+
'Opera': '53',
|
|
24
|
+
'Safari': '54'
|
|
25
|
+
};
|
|
15
26
|
const PLATFORM_MAP = {
|
|
16
27
|
'aix': 'AIX',
|
|
17
28
|
'darwin': 'Mac OS',
|
|
@@ -26,12 +37,14 @@ exports.Browsers = {
|
|
|
26
37
|
macOS: (browser) => ['Mac OS', browser, '14.4.1'],
|
|
27
38
|
baileys: (browser) => ['Baileys', browser, '6.5.0'],
|
|
28
39
|
windows: (browser) => ['Windows', browser, '10.0.22631'],
|
|
40
|
+
iOS: (browser) => ['iOS', browser, '18.2'],
|
|
41
|
+
linux: (browser) => ['Linux', browser, '6.12.6'],
|
|
42
|
+
/** The appropriate browser based on your OS & release */
|
|
29
43
|
appropriate: (browser) => [PLATFORM_MAP[(0, os_1.platform)()] || 'Ubuntu', browser, (0, os_1.release)()]
|
|
30
44
|
};
|
|
31
|
-
|
|
32
45
|
const getPlatformId = (browser) => {
|
|
33
46
|
const platformType = WAProto_1.proto.DeviceProps.PlatformType[browser.toUpperCase()];
|
|
34
|
-
return platformType ? platformType.toString() : '
|
|
47
|
+
return platformType ? platformType.toString().charCodeAt(0).toString() : '49'; //chrome
|
|
35
48
|
};
|
|
36
49
|
exports.getPlatformId = getPlatformId;
|
|
37
50
|
exports.BufferJSON = {
|
|
@@ -88,7 +101,7 @@ const encodeBigEndian = (e, t = 4) => {
|
|
|
88
101
|
return a;
|
|
89
102
|
};
|
|
90
103
|
exports.encodeBigEndian = encodeBigEndian;
|
|
91
|
-
const toNumber = (t) => ((typeof t === 'object' && t) ? ('toNumber' in t ? t.toNumber() : t.low) : t);
|
|
104
|
+
const toNumber = (t) => ((typeof t === 'object' && t) ? ('toNumber' in t ? t.toNumber() : t.low) : t || 0);
|
|
92
105
|
exports.toNumber = toNumber;
|
|
93
106
|
/** unix timestamp of a date in seconds */
|
|
94
107
|
const unixTimestampSeconds = (date = new Date()) => Math.floor(date.getTime() / 1000);
|
|
@@ -154,7 +167,6 @@ async function promiseTimeout(ms, promise) {
|
|
|
154
167
|
.finally(cancel);
|
|
155
168
|
return p;
|
|
156
169
|
}
|
|
157
|
-
exports.promiseTimeout = promiseTimeout;
|
|
158
170
|
const generateMessageIDV2 = (userId) => {
|
|
159
171
|
const data = Buffer.alloc(8 + 20 + 16);
|
|
160
172
|
data.writeBigUInt64BE(BigInt(Math.floor(Date.now() / 1000)));
|
|
@@ -168,11 +180,11 @@ const generateMessageIDV2 = (userId) => {
|
|
|
168
180
|
const random = (0, crypto_1.randomBytes)(16);
|
|
169
181
|
random.copy(data, 28);
|
|
170
182
|
const hash = (0, crypto_1.createHash)('sha256').update(data).digest();
|
|
171
|
-
return
|
|
183
|
+
return hash.toString('hex').toUpperCase().substring(0, 32);
|
|
172
184
|
};
|
|
173
185
|
exports.generateMessageIDV2 = generateMessageIDV2;
|
|
174
186
|
// generate a random ID to attach to a message
|
|
175
|
-
const generateMessageID = () =>
|
|
187
|
+
const generateMessageID = () => (0, crypto_1.randomBytes)(16).toString('hex').toUpperCase();
|
|
176
188
|
exports.generateMessageID = generateMessageID;
|
|
177
189
|
function bindWaitForEvent(ev, event) {
|
|
178
190
|
return async (check, timeoutMs) => {
|
|
@@ -199,7 +211,6 @@ function bindWaitForEvent(ev, event) {
|
|
|
199
211
|
}));
|
|
200
212
|
};
|
|
201
213
|
}
|
|
202
|
-
exports.bindWaitForEvent = bindWaitForEvent;
|
|
203
214
|
const bindWaitForConnectionUpdate = (ev) => bindWaitForEvent(ev, 'connection.update');
|
|
204
215
|
exports.bindWaitForConnectionUpdate = bindWaitForConnectionUpdate;
|
|
205
216
|
const printQRIfNecessaryListener = (ev, logger) => {
|
|
@@ -220,7 +231,7 @@ exports.printQRIfNecessaryListener = printQRIfNecessaryListener;
|
|
|
220
231
|
* Use to ensure your WA connection is always on the latest version
|
|
221
232
|
*/
|
|
222
233
|
const fetchLatestBaileysVersion = async (options = {}) => {
|
|
223
|
-
const URL = 'https://raw.githubusercontent.com/
|
|
234
|
+
const URL = 'https://raw.githubusercontent.com/WhiskeySockets/Baileys/master/src/Defaults/baileys-version.json';
|
|
224
235
|
try {
|
|
225
236
|
const result = await axios_1.default.get(URL, {
|
|
226
237
|
...options,
|
|
@@ -272,6 +283,7 @@ const generateMdTagPrefix = () => {
|
|
|
272
283
|
};
|
|
273
284
|
exports.generateMdTagPrefix = generateMdTagPrefix;
|
|
274
285
|
const STATUS_MAP = {
|
|
286
|
+
'sender': WAProto_1.proto.WebMessageInfo.Status.SERVER_ACK,
|
|
275
287
|
'played': WAProto_1.proto.WebMessageInfo.Status.PLAYED,
|
|
276
288
|
'read': WAProto_1.proto.WebMessageInfo.Status.READ,
|
|
277
289
|
'read-self': WAProto_1.proto.WebMessageInfo.Status.READ
|
|
@@ -320,7 +332,8 @@ const getCallStatusFromNode = ({ tag, attrs }) => {
|
|
|
320
332
|
status = 'timeout';
|
|
321
333
|
}
|
|
322
334
|
else {
|
|
323
|
-
|
|
335
|
+
//fired when accepted/rejected/timeout/caller hangs up
|
|
336
|
+
status = 'terminate';
|
|
324
337
|
}
|
|
325
338
|
break;
|
|
326
339
|
case 'reject':
|
|
@@ -369,14 +382,13 @@ function trimUndefined(obj) {
|
|
|
369
382
|
}
|
|
370
383
|
return obj;
|
|
371
384
|
}
|
|
372
|
-
exports.trimUndefined = trimUndefined;
|
|
373
385
|
const CROCKFORD_CHARACTERS = '123456789ABCDEFGHJKLMNPQRSTVWXYZ';
|
|
374
386
|
function bytesToCrockford(buffer) {
|
|
375
387
|
let value = 0;
|
|
376
388
|
let bitCount = 0;
|
|
377
389
|
const crockford = [];
|
|
378
|
-
for (
|
|
379
|
-
value = (value << 8) | (
|
|
390
|
+
for (const element of buffer) {
|
|
391
|
+
value = (value << 8) | (element & 0xff);
|
|
380
392
|
bitCount += 8;
|
|
381
393
|
while (bitCount >= 5) {
|
|
382
394
|
crockford.push(CROCKFORD_CHARACTERS.charAt((value >>> (bitCount - 5)) & 31));
|
|
@@ -388,4 +400,3 @@ function bytesToCrockford(buffer) {
|
|
|
388
400
|
}
|
|
389
401
|
return crockford.join('');
|
|
390
402
|
}
|
|
391
|
-
exports.bytesToCrockford = bytesToCrockford;
|
package/lib/Utils/history.d.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { AxiosRequestConfig } from 'axios';
|
|
2
2
|
import { proto } from '../../WAProto';
|
|
3
3
|
import { Chat, Contact } from '../Types';
|
|
4
|
-
export declare const downloadHistory: (msg: proto.Message.IHistorySyncNotification, options: AxiosRequestConfig<
|
|
4
|
+
export declare const downloadHistory: (msg: proto.Message.IHistorySyncNotification, options: AxiosRequestConfig<{}>) => Promise<proto.HistorySync>;
|
|
5
5
|
export declare const processHistoryMessage: (item: proto.IHistorySync) => {
|
|
6
6
|
chats: Chat[];
|
|
7
7
|
contacts: Contact[];
|
|
8
8
|
messages: proto.IWebMessageInfo[];
|
|
9
|
+
syncType: proto.HistorySync.HistorySyncType;
|
|
10
|
+
progress: number | null | undefined;
|
|
9
11
|
};
|
|
10
|
-
export declare const downloadAndProcessHistorySyncNotification: (msg: proto.Message.IHistorySyncNotification, options: AxiosRequestConfig<
|
|
12
|
+
export declare const downloadAndProcessHistorySyncNotification: (msg: proto.Message.IHistorySyncNotification, options: AxiosRequestConfig<{}>) => Promise<{
|
|
11
13
|
chats: Chat[];
|
|
12
14
|
contacts: Contact[];
|
|
13
15
|
messages: proto.IWebMessageInfo[];
|
|
16
|
+
syncType: proto.HistorySync.HistorySyncType;
|
|
17
|
+
progress: number | null | undefined;
|
|
14
18
|
}>;
|
|
15
19
|
export declare const getHistoryMsg: (message: proto.IMessage) => proto.Message.IHistorySyncNotification | null | undefined;
|
package/lib/Utils/history.js
CHANGED
|
@@ -32,13 +32,9 @@ const processHistoryMessage = (item) => {
|
|
|
32
32
|
case WAProto_1.proto.HistorySync.HistorySyncType.INITIAL_BOOTSTRAP:
|
|
33
33
|
case WAProto_1.proto.HistorySync.HistorySyncType.RECENT:
|
|
34
34
|
case WAProto_1.proto.HistorySync.HistorySyncType.FULL:
|
|
35
|
+
case WAProto_1.proto.HistorySync.HistorySyncType.ON_DEMAND:
|
|
35
36
|
for (const chat of item.conversations) {
|
|
36
|
-
contacts.push({
|
|
37
|
-
id: chat.id,
|
|
38
|
-
name: chat.name || undefined,
|
|
39
|
-
lid: chat.lidJid || undefined,
|
|
40
|
-
jid: (0, WABinary_1.isJidUser)(chat.id) ? chat.id : undefined
|
|
41
|
-
});
|
|
37
|
+
contacts.push({ id: chat.id, name: chat.name || undefined });
|
|
42
38
|
const msgs = chat.messages || [];
|
|
43
39
|
delete chat.messages;
|
|
44
40
|
delete chat.archived;
|
|
@@ -79,6 +75,8 @@ const processHistoryMessage = (item) => {
|
|
|
79
75
|
chats,
|
|
80
76
|
contacts,
|
|
81
77
|
messages,
|
|
78
|
+
syncType: item.syncType,
|
|
79
|
+
progress: item.progress
|
|
82
80
|
};
|
|
83
81
|
};
|
|
84
82
|
exports.processHistoryMessage = processHistoryMessage;
|
package/lib/Utils/logger.d.ts
CHANGED
package/lib/Utils/lt-hash.js
CHANGED
|
@@ -12,33 +12,33 @@ class d {
|
|
|
12
12
|
constructor(e) {
|
|
13
13
|
this.salt = e;
|
|
14
14
|
}
|
|
15
|
-
add(e, t) {
|
|
15
|
+
async add(e, t) {
|
|
16
16
|
var r = this;
|
|
17
17
|
for (const item of t) {
|
|
18
|
-
e = r._addSingle(e, item);
|
|
18
|
+
e = await r._addSingle(e, item);
|
|
19
19
|
}
|
|
20
20
|
return e;
|
|
21
21
|
}
|
|
22
|
-
subtract(e, t) {
|
|
22
|
+
async subtract(e, t) {
|
|
23
23
|
var r = this;
|
|
24
24
|
for (const item of t) {
|
|
25
|
-
e = r._subtractSingle(e, item);
|
|
25
|
+
e = await r._subtractSingle(e, item);
|
|
26
26
|
}
|
|
27
27
|
return e;
|
|
28
28
|
}
|
|
29
|
-
subtractThenAdd(e, t, r) {
|
|
29
|
+
async subtractThenAdd(e, t, r) {
|
|
30
30
|
var n = this;
|
|
31
|
-
return n.add(n.subtract(e, r), t);
|
|
31
|
+
return n.add(await n.subtract(e, r), t);
|
|
32
32
|
}
|
|
33
|
-
_addSingle(e, t) {
|
|
33
|
+
async _addSingle(e, t) {
|
|
34
34
|
var r = this;
|
|
35
|
-
const n = new Uint8Array((0, crypto_1.hkdf)(Buffer.from(t), o, { info: r.salt })).buffer;
|
|
36
|
-
return r.performPointwiseWithOverflow(e, n, ((e, t) => e + t));
|
|
35
|
+
const n = new Uint8Array(await (0, crypto_1.hkdf)(Buffer.from(t), o, { info: r.salt })).buffer;
|
|
36
|
+
return r.performPointwiseWithOverflow(await e, n, ((e, t) => e + t));
|
|
37
37
|
}
|
|
38
|
-
_subtractSingle(e, t) {
|
|
38
|
+
async _subtractSingle(e, t) {
|
|
39
39
|
var r = this;
|
|
40
|
-
const n = new Uint8Array((0, crypto_1.hkdf)(Buffer.from(t), o, { info: r.salt })).buffer;
|
|
41
|
-
return r.performPointwiseWithOverflow(e, n, ((e, t) => e - t));
|
|
40
|
+
const n = new Uint8Array(await (0, crypto_1.hkdf)(Buffer.from(t), o, { info: r.salt })).buffer;
|
|
41
|
+
return r.performPointwiseWithOverflow(await e, n, ((e, t) => e - t));
|
|
42
42
|
}
|
|
43
43
|
performPointwiseWithOverflow(e, t, r) {
|
|
44
44
|
const n = new DataView(e), i = new DataView(t), a = new ArrayBuffer(n.byteLength), s = new DataView(a);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const makeMutex: () => {
|
|
2
|
-
mutex<T>(code: () => T |
|
|
2
|
+
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
3
3
|
};
|
|
4
4
|
export type Mutex = ReturnType<typeof makeMutex>;
|
|
5
5
|
export declare const makeKeyedMutex: () => {
|
|
6
|
-
mutex<T>(key: string, task: () => T |
|
|
6
|
+
mutex<T>(key: string, task: () => Promise<T> | T): Promise<T>;
|
|
7
7
|
};
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
/// <reference types="node" />
|
|
4
1
|
import { Boom } from '@hapi/boom';
|
|
5
2
|
import { AxiosRequestConfig } from 'axios';
|
|
6
3
|
import type { Logger } from 'pino';
|
|
7
|
-
import { Readable
|
|
4
|
+
import { Readable } from 'stream';
|
|
8
5
|
import { URL } from 'url';
|
|
9
6
|
import { proto } from '../../WAProto';
|
|
10
7
|
import { DownloadableMessage, MediaConnInfo, MediaDecryptionKeyInfo, MediaType, SocketConfig, WAMediaUpload, WAMediaUploadFunction, WAMessageContent } from '../Types';
|
|
@@ -13,10 +10,10 @@ export declare const hkdfInfoKey: (type: MediaType) => string;
|
|
|
13
10
|
/** generates all the keys required to encrypt/decrypt & sign a media message */
|
|
14
11
|
export declare function getMediaKeys(buffer: Uint8Array | string | null | undefined, mediaType: MediaType): MediaDecryptionKeyInfo;
|
|
15
12
|
export declare const extractImageThumb: (bufferOrFilePath: Readable | Buffer | string, width?: number) => Promise<{
|
|
16
|
-
buffer:
|
|
13
|
+
buffer: any;
|
|
17
14
|
original: {
|
|
18
|
-
width:
|
|
19
|
-
height:
|
|
15
|
+
width: any;
|
|
16
|
+
height: any;
|
|
20
17
|
};
|
|
21
18
|
}>;
|
|
22
19
|
export declare const encodeBase64EncodedStringForUpload: (b64: string) => string;
|
|
@@ -24,25 +21,25 @@ export declare const generateProfilePicture: (mediaUpload: WAMediaUpload) => Pro
|
|
|
24
21
|
img: Buffer;
|
|
25
22
|
}>;
|
|
26
23
|
/** gets the SHA256 of the given media message */
|
|
27
|
-
export declare const mediaMessageSHA256B64: (message: WAMessageContent) =>
|
|
28
|
-
export declare function getAudioDuration(buffer: Buffer | string | Readable): Promise<
|
|
24
|
+
export declare const mediaMessageSHA256B64: (message: WAMessageContent) => any;
|
|
25
|
+
export declare function getAudioDuration(buffer: Buffer | string | Readable): Promise<any>;
|
|
29
26
|
/**
|
|
30
27
|
referenced from and modifying https://github.com/wppconnect-team/wa-js/blob/main/src/chat/functions/prepareAudioWaveform.ts
|
|
31
28
|
*/
|
|
32
|
-
export declare function getAudioWaveform(buffer: Buffer | string | Readable, logger?: Logger): Promise<Uint8Array | undefined>;
|
|
33
|
-
export declare const toReadable: (buffer: Buffer) =>
|
|
34
|
-
export declare const toBuffer: (stream: Readable) => Promise<
|
|
29
|
+
export declare function getAudioWaveform(buffer: Buffer | string | Readable, logger?: Logger): Promise<Uint8Array<ArrayBuffer> | undefined>;
|
|
30
|
+
export declare const toReadable: (buffer: Buffer) => any;
|
|
31
|
+
export declare const toBuffer: (stream: Readable) => Promise<any>;
|
|
35
32
|
export declare const getStream: (item: WAMediaUpload, opts?: AxiosRequestConfig) => Promise<{
|
|
36
|
-
readonly stream:
|
|
33
|
+
readonly stream: any;
|
|
37
34
|
readonly type: "buffer";
|
|
38
35
|
} | {
|
|
39
|
-
readonly stream:
|
|
36
|
+
readonly stream: any;
|
|
40
37
|
readonly type: "readable";
|
|
41
38
|
} | {
|
|
42
39
|
readonly stream: Readable;
|
|
43
40
|
readonly type: "remote";
|
|
44
41
|
} | {
|
|
45
|
-
readonly stream:
|
|
42
|
+
readonly stream: any;
|
|
46
43
|
readonly type: "file";
|
|
47
44
|
}>;
|
|
48
45
|
/** generates a thumbnail for a given media, if required */
|
|
@@ -65,20 +62,20 @@ type EncryptedStreamOptions = {
|
|
|
65
62
|
};
|
|
66
63
|
export declare const prepareStream: (media: WAMediaUpload, mediaType: MediaType, { logger, saveOriginalFileIfRequired, opts }?: EncryptedStreamOptions) => Promise<{
|
|
67
64
|
mediaKey: undefined;
|
|
68
|
-
encWriteStream:
|
|
69
|
-
fileLength:
|
|
70
|
-
fileSha256:
|
|
65
|
+
encWriteStream: any;
|
|
66
|
+
fileLength: any;
|
|
67
|
+
fileSha256: any;
|
|
71
68
|
fileEncSha256: undefined;
|
|
72
69
|
bodyPath: string | undefined;
|
|
73
70
|
didSaveToTmpPath: boolean;
|
|
74
71
|
}>;
|
|
75
72
|
export declare const encryptedStream: (media: WAMediaUpload, mediaType: MediaType, { logger, saveOriginalFileIfRequired, opts }?: EncryptedStreamOptions) => Promise<{
|
|
76
|
-
mediaKey:
|
|
77
|
-
encWriteStream:
|
|
73
|
+
mediaKey: any;
|
|
74
|
+
encWriteStream: any;
|
|
78
75
|
bodyPath: string | undefined;
|
|
79
|
-
mac:
|
|
80
|
-
fileEncSha256:
|
|
81
|
-
fileSha256:
|
|
76
|
+
mac: any;
|
|
77
|
+
fileEncSha256: any;
|
|
78
|
+
fileSha256: any;
|
|
82
79
|
fileLength: number;
|
|
83
80
|
didSaveToTmpPath: boolean;
|
|
84
81
|
}>;
|
|
@@ -88,12 +85,12 @@ export type MediaDownloadOptions = {
|
|
|
88
85
|
options?: AxiosRequestConfig<any>;
|
|
89
86
|
};
|
|
90
87
|
export declare const getUrlFromDirectPath: (directPath: string) => string;
|
|
91
|
-
export declare const downloadContentFromMessage: ({ mediaKey, directPath, url }: DownloadableMessage, type: MediaType, opts?: MediaDownloadOptions) => Promise<
|
|
88
|
+
export declare const downloadContentFromMessage: ({ mediaKey, directPath, url }: DownloadableMessage, type: MediaType, opts?: MediaDownloadOptions) => Promise<any>;
|
|
92
89
|
/**
|
|
93
90
|
* Decrypts and downloads an AES256-CBC encrypted file given the keys.
|
|
94
91
|
* Assumes the SHA256 of the plaintext is appended to the end of the ciphertext
|
|
95
92
|
* */
|
|
96
|
-
export declare const downloadEncryptedContent: (downloadUrl: string, { cipherKey, iv }: MediaDecryptionKeyInfo, { startByte, endByte, options }?: MediaDownloadOptions) => Promise<
|
|
93
|
+
export declare const downloadEncryptedContent: (downloadUrl: string, { cipherKey, iv }: MediaDecryptionKeyInfo, { startByte, endByte, options }?: MediaDownloadOptions) => Promise<any>;
|
|
97
94
|
export declare function extensionForMediaMessage(message: WAMessageContent): string;
|
|
98
95
|
export declare const getWAUploadToServer: ({ customUploadHosts, fetchAgent, logger, options }: SocketConfig, refreshMediaConn: (force: boolean) => Promise<MediaConnInfo>) => WAMediaUploadFunction;
|
|
99
96
|
/**
|
|
@@ -101,12 +98,12 @@ export declare const getWAUploadToServer: ({ customUploadHosts, fetchAgent, logg
|
|
|
101
98
|
*/
|
|
102
99
|
export declare const encryptMediaRetryRequest: (key: proto.IMessageKey, mediaKey: Buffer | Uint8Array, meId: string) => BinaryNode;
|
|
103
100
|
export declare const decodeMediaRetryNode: (node: BinaryNode) => {
|
|
104
|
-
key:
|
|
101
|
+
key: import("../Types").WAMessageKey;
|
|
105
102
|
media?: {
|
|
106
103
|
ciphertext: Uint8Array;
|
|
107
104
|
iv: Uint8Array;
|
|
108
|
-
}
|
|
109
|
-
error?: Boom
|
|
105
|
+
};
|
|
106
|
+
error?: Boom;
|
|
110
107
|
};
|
|
111
108
|
export declare const decryptMediaRetryData: ({ ciphertext, iv }: {
|
|
112
109
|
ciphertext: Uint8Array;
|