@sixcore/baileys 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/WAProto/index.js +14270 -302
- package/jessica.js +91 -0
- package/lib/Defaults/baileys-version.json +1 -1
- package/lib/Defaults/index.js +117 -79
- package/lib/Defaults/phonenumber-mcc.json +223 -0
- package/lib/Signal/Group/ciphertext-message.d.ts +9 -0
- package/lib/Signal/Group/ciphertext-message.js +15 -0
- package/lib/Signal/Group/group-session-builder.d.ts +14 -0
- package/lib/Signal/Group/group-session-builder.js +64 -0
- package/lib/Signal/Group/group_cipher.d.ts +17 -0
- package/lib/Signal/Group/group_cipher.js +96 -0
- package/lib/Signal/Group/index.d.ts +11 -0
- package/lib/Signal/Group/index.js +57 -0
- package/lib/Signal/Group/keyhelper.d.ts +10 -0
- package/lib/Signal/Group/keyhelper.js +55 -0
- package/lib/Signal/Group/queue-job.d.ts +1 -0
- package/lib/Signal/Group/queue-job.js +57 -0
- package/lib/Signal/Group/sender-chain-key.d.ts +13 -0
- package/lib/Signal/Group/sender-chain-key.js +34 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +66 -0
- package/lib/Signal/Group/sender-key-message.d.ts +18 -0
- package/lib/Signal/Group/sender-key-message.js +69 -0
- package/lib/Signal/Group/sender-key-name.d.ts +17 -0
- package/lib/Signal/Group/sender-key-name.js +51 -0
- package/lib/Signal/Group/sender-key-record.d.ts +30 -0
- package/lib/Signal/Group/sender-key-record.js +53 -0
- package/lib/Signal/Group/sender-key-state.d.ts +38 -0
- package/lib/Signal/Group/sender-key-state.js +99 -0
- package/lib/Signal/Group/sender-message-key.d.ts +11 -0
- package/{WASignalGroup/sender_message_key.js → lib/Signal/Group/sender-message-key.js} +6 -16
- package/lib/Signal/libsignal.js +51 -29
- package/lib/Socket/business.d.ts +43 -42
- package/lib/Socket/chats.d.ts +222 -36
- package/lib/Socket/chats.js +173 -153
- package/lib/Socket/dugong.d.ts +254 -0
- package/lib/Socket/dugong.js +484 -0
- package/lib/Socket/groups.d.ts +7 -7
- package/lib/Socket/groups.js +37 -35
- package/lib/Socket/index.d.ts +52 -51
- package/lib/Socket/index.js +1 -0
- package/lib/Socket/messages-recv.d.ts +37 -34
- package/lib/Socket/messages-recv.js +175 -37
- package/lib/Socket/messages-send.d.ts +12 -18
- package/lib/Socket/messages-send.js +396 -574
- package/lib/Socket/newsletter.d.ts +28 -26
- package/lib/Socket/newsletter.js +123 -25
- package/lib/Socket/registration.d.ts +52 -49
- package/lib/Socket/registration.js +7 -7
- package/lib/Socket/socket.d.ts +0 -1
- package/lib/Socket/socket.js +49 -27
- package/lib/Socket/usync.d.ts +10 -11
- package/lib/Store/make-cache-manager-store.d.ts +1 -2
- package/lib/Store/make-in-memory-store.d.ts +2 -2
- package/lib/Store/make-in-memory-store.js +1 -5
- package/lib/Store/make-ordered-dictionary.js +2 -2
- package/lib/Types/Auth.d.ts +1 -0
- package/lib/Types/Call.d.ts +1 -1
- package/lib/Types/Chat.d.ts +7 -12
- package/lib/Types/Events.d.ts +2 -17
- package/lib/Types/GroupMetadata.d.ts +2 -3
- package/lib/Types/Label.d.ts +0 -11
- package/lib/Types/Label.js +1 -1
- package/lib/Types/LabelAssociation.js +1 -1
- package/lib/Types/Message.d.ts +10 -170
- package/lib/Types/Newsletter.d.ts +97 -86
- package/lib/Types/Newsletter.js +38 -32
- package/lib/Types/Socket.d.ts +2 -7
- package/lib/Types/index.d.ts +0 -9
- package/lib/Types/index.js +1 -1
- package/lib/Utils/auth-utils.js +14 -35
- package/lib/Utils/business.d.ts +1 -1
- package/lib/Utils/business.js +2 -2
- package/lib/Utils/chat-utils.d.ts +12 -11
- package/lib/Utils/chat-utils.js +36 -52
- package/lib/Utils/crypto.d.ts +16 -15
- package/lib/Utils/crypto.js +26 -74
- package/lib/Utils/decode-wa-message.d.ts +0 -17
- package/lib/Utils/decode-wa-message.js +17 -53
- package/lib/Utils/event-buffer.js +7 -10
- package/lib/Utils/generics.d.ts +17 -13
- package/lib/Utils/generics.js +79 -58
- package/lib/Utils/history.d.ts +2 -6
- package/lib/Utils/history.js +6 -4
- package/lib/Utils/logger.d.ts +3 -1
- package/lib/Utils/lt-hash.js +12 -12
- package/lib/Utils/make-mutex.d.ts +2 -2
- package/lib/Utils/messages-media.d.ts +28 -25
- package/lib/Utils/messages-media.js +733 -557
- package/lib/Utils/messages.js +68 -473
- package/lib/Utils/noise-handler.d.ts +5 -4
- package/lib/Utils/noise-handler.js +14 -19
- package/lib/Utils/process-message.d.ts +5 -5
- package/lib/Utils/process-message.js +23 -75
- package/lib/Utils/signal.d.ts +1 -2
- package/lib/Utils/signal.js +26 -32
- package/lib/Utils/use-multi-file-auth-state.d.ts +1 -0
- package/lib/Utils/use-multi-file-auth-state.js +66 -242
- package/lib/Utils/validate-connection.d.ts +1 -1
- package/lib/Utils/validate-connection.js +88 -64
- package/lib/WABinary/constants.d.ts +27 -24
- package/lib/WABinary/decode.d.ts +2 -1
- package/lib/WABinary/decode.js +11 -23
- package/lib/WABinary/encode.d.ts +2 -1
- package/lib/WABinary/encode.js +147 -134
- package/lib/WABinary/generic-utils.d.ts +5 -2
- package/lib/WABinary/generic-utils.js +125 -37
- package/lib/WABinary/jid-utils.d.ts +1 -1
- package/lib/WAM/BinaryInfo.d.ts +11 -2
- package/lib/WAM/encode.d.ts +2 -1
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +3 -3
- package/lib/WAUSync/USyncUser.d.ts +2 -0
- package/lib/index.d.ts +12 -0
- package/lib/index.js +64 -1
- package/package.json +113 -51
- package/WAProto/GenerateStatics.sh +0 -4
- package/WAProto/WAProto.proto +0 -4357
- package/WAProto/index.d.ts +0 -50383
- package/WASignalGroup/GroupProtocol.js +0 -1697
- package/WASignalGroup/ciphertext_message.js +0 -16
- package/WASignalGroup/generate-proto.sh +0 -1
- package/WASignalGroup/group.proto +0 -42
- package/WASignalGroup/group_cipher.js +0 -120
- package/WASignalGroup/group_session_builder.js +0 -46
- package/WASignalGroup/index.js +0 -5
- package/WASignalGroup/keyhelper.js +0 -21
- package/WASignalGroup/protobufs.js +0 -3
- package/WASignalGroup/queue_job.js +0 -69
- package/WASignalGroup/sender_chain_key.js +0 -50
- package/WASignalGroup/sender_key_distribution_message.js +0 -78
- package/WASignalGroup/sender_key_message.js +0 -92
- package/WASignalGroup/sender_key_name.js +0 -70
- package/WASignalGroup/sender_key_record.js +0 -56
- package/WASignalGroup/sender_key_state.js +0 -129
- package/lib/Utils/use-single-file-auth-state.d.ts +0 -12
- package/lib/Utils/use-single-file-auth-state.js +0 -75
- package/src/Defaults/baileys-version.json +0 -3
- package/src/Defaults/index.ts +0 -133
- package/src/Signal/Group/ciphertext-message.ts +0 -9
- package/src/Signal/Group/group-session-builder.ts +0 -56
- package/src/Signal/Group/group_cipher.ts +0 -117
- package/src/Signal/Group/index.ts +0 -11
- package/src/Signal/Group/keyhelper.ts +0 -28
- package/src/Signal/Group/sender-chain-key.ts +0 -34
- package/src/Signal/Group/sender-key-distribution-message.ts +0 -95
- package/src/Signal/Group/sender-key-message.ts +0 -96
- package/src/Signal/Group/sender-key-name.ts +0 -66
- package/src/Signal/Group/sender-key-record.ts +0 -69
- package/src/Signal/Group/sender-key-state.ts +0 -134
- package/src/Signal/Group/sender-message-key.ts +0 -36
- package/src/Signal/libsignal.ts +0 -447
- package/src/Signal/lid-mapping.ts +0 -209
- package/src/Socket/Client/index.ts +0 -2
- package/src/Socket/Client/types.ts +0 -22
- package/src/Socket/Client/websocket.ts +0 -56
- package/src/Socket/business.ts +0 -421
- package/src/Socket/chats.ts +0 -1223
- package/src/Socket/communities.ts +0 -477
- package/src/Socket/groups.ts +0 -361
- package/src/Socket/index.ts +0 -22
- package/src/Socket/messages-recv.ts +0 -1563
- package/src/Socket/messages-send.ts +0 -1210
- package/src/Socket/mex.ts +0 -58
- package/src/Socket/newsletter.ts +0 -229
- package/src/Socket/socket.ts +0 -1072
- package/src/Types/Auth.ts +0 -115
- package/src/Types/Bussines.ts +0 -20
- package/src/Types/Call.ts +0 -14
- package/src/Types/Chat.ts +0 -138
- package/src/Types/Contact.ts +0 -24
- package/src/Types/Events.ts +0 -132
- package/src/Types/GroupMetadata.ts +0 -70
- package/src/Types/Label.ts +0 -48
- package/src/Types/LabelAssociation.ts +0 -35
- package/src/Types/Message.ts +0 -424
- package/src/Types/Newsletter.ts +0 -98
- package/src/Types/Product.ts +0 -85
- package/src/Types/Signal.ts +0 -76
- package/src/Types/Socket.ts +0 -150
- package/src/Types/State.ts +0 -43
- package/src/Types/USync.ts +0 -27
- package/src/Types/globals.d.ts +0 -8
- package/src/Types/index.ts +0 -67
- package/src/Utils/auth-utils.ts +0 -331
- package/src/Utils/browser-utils.ts +0 -31
- package/src/Utils/business.ts +0 -286
- package/src/Utils/chat-utils.ts +0 -933
- package/src/Utils/crypto.ts +0 -184
- package/src/Utils/decode-wa-message.ts +0 -355
- package/src/Utils/event-buffer.ts +0 -662
- package/src/Utils/generics.ts +0 -470
- package/src/Utils/history.ts +0 -114
- package/src/Utils/index.ts +0 -18
- package/src/Utils/link-preview.ts +0 -111
- package/src/Utils/logger.ts +0 -13
- package/src/Utils/lt-hash.ts +0 -65
- package/src/Utils/make-mutex.ts +0 -45
- package/src/Utils/message-retry-manager.ts +0 -229
- package/src/Utils/messages-media.ts +0 -820
- package/src/Utils/messages.ts +0 -1137
- package/src/Utils/noise-handler.ts +0 -192
- package/src/Utils/pre-key-manager.ts +0 -126
- package/src/Utils/process-message.ts +0 -622
- package/src/Utils/signal.ts +0 -214
- package/src/Utils/use-multi-file-auth-state.ts +0 -136
- package/src/Utils/validate-connection.ts +0 -253
- package/src/WABinary/constants.ts +0 -1305
- package/src/WABinary/decode.ts +0 -281
- package/src/WABinary/encode.ts +0 -253
- package/src/WABinary/generic-utils.ts +0 -127
- package/src/WABinary/index.ts +0 -5
- package/src/WABinary/jid-utils.ts +0 -128
- package/src/WABinary/types.ts +0 -17
- package/src/WAM/BinaryInfo.ts +0 -12
- package/src/WAM/constants.ts +0 -22889
- package/src/WAM/encode.ts +0 -169
- package/src/WAM/index.ts +0 -3
- package/src/WAUSync/Protocols/USyncContactProtocol.ts +0 -32
- package/src/WAUSync/Protocols/USyncDeviceProtocol.ts +0 -78
- package/src/WAUSync/Protocols/USyncDisappearingModeProtocol.ts +0 -35
- package/src/WAUSync/Protocols/USyncStatusProtocol.ts +0 -44
- package/src/WAUSync/Protocols/UsyncBotProfileProtocol.ts +0 -76
- package/src/WAUSync/Protocols/UsyncLIDProtocol.ts +0 -33
- package/src/WAUSync/Protocols/index.ts +0 -4
- package/src/WAUSync/USyncQuery.ts +0 -133
- package/src/WAUSync/USyncUser.ts +0 -32
- package/src/WAUSync/index.ts +0 -3
- package/src/index.ts +0 -13
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { SenderChainKey } from './sender-chain-key';
|
|
2
|
+
import { SenderMessageKey } from './sender-message-key';
|
|
3
|
+
interface SenderChainKeyStructure {
|
|
4
|
+
iteration: number;
|
|
5
|
+
seed: Uint8Array;
|
|
6
|
+
}
|
|
7
|
+
interface SenderSigningKeyStructure {
|
|
8
|
+
public: Uint8Array;
|
|
9
|
+
private?: Uint8Array;
|
|
10
|
+
}
|
|
11
|
+
interface SenderMessageKeyStructure {
|
|
12
|
+
iteration: number;
|
|
13
|
+
seed: Uint8Array;
|
|
14
|
+
}
|
|
15
|
+
interface SenderKeyStateStructure {
|
|
16
|
+
senderKeyId: number;
|
|
17
|
+
senderChainKey: SenderChainKeyStructure;
|
|
18
|
+
senderSigningKey: SenderSigningKeyStructure;
|
|
19
|
+
senderMessageKeys: SenderMessageKeyStructure[];
|
|
20
|
+
}
|
|
21
|
+
export declare class SenderKeyState {
|
|
22
|
+
private readonly MAX_MESSAGE_KEYS;
|
|
23
|
+
private readonly senderKeyStateStructure;
|
|
24
|
+
constructor(id?: number | null, iteration?: number | null, chainKey?: Uint8Array | null, signatureKeyPair?: {
|
|
25
|
+
public: Uint8Array;
|
|
26
|
+
private: Uint8Array;
|
|
27
|
+
} | null, signatureKeyPublic?: Uint8Array | null, signatureKeyPrivate?: Uint8Array | null, senderKeyStateStructure?: SenderKeyStateStructure | null);
|
|
28
|
+
getKeyId(): number;
|
|
29
|
+
getSenderChainKey(): SenderChainKey;
|
|
30
|
+
setSenderChainKey(chainKey: SenderChainKey): void;
|
|
31
|
+
getSigningKeyPublic(): Buffer;
|
|
32
|
+
getSigningKeyPrivate(): Buffer | undefined;
|
|
33
|
+
hasSenderMessageKey(iteration: number): boolean;
|
|
34
|
+
addSenderMessageKey(senderMessageKey: SenderMessageKey): void;
|
|
35
|
+
removeSenderMessageKey(iteration: number): SenderMessageKey | null;
|
|
36
|
+
getStructure(): SenderKeyStateStructure;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SenderKeyState = void 0;
|
|
4
|
+
const sender_chain_key_1 = require("./sender-chain-key");
|
|
5
|
+
const sender_message_key_1 = require("./sender-message-key");
|
|
6
|
+
class SenderKeyState {
|
|
7
|
+
constructor(id, iteration, chainKey, signatureKeyPair, signatureKeyPublic, signatureKeyPrivate, senderKeyStateStructure) {
|
|
8
|
+
this.MAX_MESSAGE_KEYS = 2000;
|
|
9
|
+
if (senderKeyStateStructure) {
|
|
10
|
+
this.senderKeyStateStructure = senderKeyStateStructure;
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
if (signatureKeyPair) {
|
|
14
|
+
signatureKeyPublic = signatureKeyPair.public;
|
|
15
|
+
signatureKeyPrivate = signatureKeyPair.private;
|
|
16
|
+
}
|
|
17
|
+
chainKey = typeof chainKey === 'string' ? Buffer.from(chainKey, 'base64') : chainKey;
|
|
18
|
+
const senderChainKeyStructure = {
|
|
19
|
+
iteration: iteration || 0,
|
|
20
|
+
seed: chainKey || Buffer.alloc(0)
|
|
21
|
+
};
|
|
22
|
+
const signingKeyStructure = {
|
|
23
|
+
public: typeof signatureKeyPublic === 'string'
|
|
24
|
+
? Buffer.from(signatureKeyPublic, 'base64')
|
|
25
|
+
: signatureKeyPublic || Buffer.alloc(0)
|
|
26
|
+
};
|
|
27
|
+
if (signatureKeyPrivate) {
|
|
28
|
+
signingKeyStructure.private =
|
|
29
|
+
typeof signatureKeyPrivate === 'string' ? Buffer.from(signatureKeyPrivate, 'base64') : signatureKeyPrivate;
|
|
30
|
+
}
|
|
31
|
+
this.senderKeyStateStructure = {
|
|
32
|
+
senderKeyId: id || 0,
|
|
33
|
+
senderChainKey: senderChainKeyStructure,
|
|
34
|
+
senderSigningKey: signingKeyStructure,
|
|
35
|
+
senderMessageKeys: []
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
getKeyId() {
|
|
40
|
+
return this.senderKeyStateStructure.senderKeyId;
|
|
41
|
+
}
|
|
42
|
+
getSenderChainKey() {
|
|
43
|
+
return new sender_chain_key_1.SenderChainKey(this.senderKeyStateStructure.senderChainKey.iteration, this.senderKeyStateStructure.senderChainKey.seed);
|
|
44
|
+
}
|
|
45
|
+
setSenderChainKey(chainKey) {
|
|
46
|
+
this.senderKeyStateStructure.senderChainKey = {
|
|
47
|
+
iteration: chainKey.getIteration(),
|
|
48
|
+
seed: chainKey.getSeed()
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
getSigningKeyPublic() {
|
|
52
|
+
const publicKey = this.senderKeyStateStructure.senderSigningKey.public;
|
|
53
|
+
if (publicKey instanceof Buffer) {
|
|
54
|
+
return publicKey;
|
|
55
|
+
}
|
|
56
|
+
else if (typeof publicKey === 'string') {
|
|
57
|
+
return Buffer.from(publicKey, 'base64');
|
|
58
|
+
}
|
|
59
|
+
return Buffer.from(publicKey || []);
|
|
60
|
+
}
|
|
61
|
+
getSigningKeyPrivate() {
|
|
62
|
+
const privateKey = this.senderKeyStateStructure.senderSigningKey.private;
|
|
63
|
+
if (!privateKey) {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
if (privateKey instanceof Buffer) {
|
|
67
|
+
return privateKey;
|
|
68
|
+
}
|
|
69
|
+
else if (typeof privateKey === 'string') {
|
|
70
|
+
return Buffer.from(privateKey, 'base64');
|
|
71
|
+
}
|
|
72
|
+
return Buffer.from(privateKey || []);
|
|
73
|
+
}
|
|
74
|
+
hasSenderMessageKey(iteration) {
|
|
75
|
+
return this.senderKeyStateStructure.senderMessageKeys.some(key => key.iteration === iteration);
|
|
76
|
+
}
|
|
77
|
+
addSenderMessageKey(senderMessageKey) {
|
|
78
|
+
this.senderKeyStateStructure.senderMessageKeys.push({
|
|
79
|
+
iteration: senderMessageKey.getIteration(),
|
|
80
|
+
seed: senderMessageKey.getSeed()
|
|
81
|
+
});
|
|
82
|
+
if (this.senderKeyStateStructure.senderMessageKeys.length > this.MAX_MESSAGE_KEYS) {
|
|
83
|
+
this.senderKeyStateStructure.senderMessageKeys.shift();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
removeSenderMessageKey(iteration) {
|
|
87
|
+
const index = this.senderKeyStateStructure.senderMessageKeys.findIndex(key => key.iteration === iteration);
|
|
88
|
+
if (index !== -1) {
|
|
89
|
+
const messageKey = this.senderKeyStateStructure.senderMessageKeys[index];
|
|
90
|
+
this.senderKeyStateStructure.senderMessageKeys.splice(index, 1);
|
|
91
|
+
return new sender_message_key_1.SenderMessageKey(messageKey.iteration, messageKey.seed);
|
|
92
|
+
}
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
getStructure() {
|
|
96
|
+
return this.senderKeyStateStructure;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.SenderKeyState = SenderKeyState;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare class SenderMessageKey {
|
|
2
|
+
private readonly iteration;
|
|
3
|
+
private readonly iv;
|
|
4
|
+
private readonly cipherKey;
|
|
5
|
+
private readonly seed;
|
|
6
|
+
constructor(iteration: number, seed: Uint8Array);
|
|
7
|
+
getIteration(): number;
|
|
8
|
+
getIv(): Uint8Array;
|
|
9
|
+
getCipherKey(): Uint8Array;
|
|
10
|
+
getSeed(): Uint8Array;
|
|
11
|
+
}
|
|
@@ -1,39 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SenderMessageKey = void 0;
|
|
4
|
+
const crypto_1 = require("libsignal/src/crypto");
|
|
2
5
|
class SenderMessageKey {
|
|
3
|
-
iteration = 0;
|
|
4
|
-
|
|
5
|
-
iv = Buffer.alloc(0);
|
|
6
|
-
|
|
7
|
-
cipherKey = Buffer.alloc(0);
|
|
8
|
-
|
|
9
|
-
seed = Buffer.alloc(0);
|
|
10
|
-
|
|
11
6
|
constructor(iteration, seed) {
|
|
12
|
-
const derivative = deriveSecrets(seed, Buffer.alloc(32), Buffer.from('WhisperGroup'));
|
|
7
|
+
const derivative = (0, crypto_1.deriveSecrets)(seed, Buffer.alloc(32), Buffer.from('WhisperGroup'));
|
|
13
8
|
const keys = new Uint8Array(32);
|
|
14
9
|
keys.set(new Uint8Array(derivative[0].slice(16)));
|
|
15
10
|
keys.set(new Uint8Array(derivative[1].slice(0, 16)), 16);
|
|
16
11
|
this.iv = Buffer.from(derivative[0].slice(0, 16));
|
|
17
12
|
this.cipherKey = Buffer.from(keys.buffer);
|
|
18
|
-
|
|
19
13
|
this.iteration = iteration;
|
|
20
14
|
this.seed = seed;
|
|
21
15
|
}
|
|
22
|
-
|
|
23
16
|
getIteration() {
|
|
24
17
|
return this.iteration;
|
|
25
18
|
}
|
|
26
|
-
|
|
27
19
|
getIv() {
|
|
28
20
|
return this.iv;
|
|
29
21
|
}
|
|
30
|
-
|
|
31
22
|
getCipherKey() {
|
|
32
23
|
return this.cipherKey;
|
|
33
24
|
}
|
|
34
|
-
|
|
35
25
|
getSeed() {
|
|
36
26
|
return this.seed;
|
|
37
27
|
}
|
|
38
28
|
}
|
|
39
|
-
|
|
29
|
+
exports.SenderMessageKey = SenderMessageKey;
|
package/lib/Signal/libsignal.js
CHANGED
|
@@ -15,34 +15,50 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.makeLibSignalRepository =
|
|
36
|
+
exports.makeLibSignalRepository = makeLibSignalRepository;
|
|
27
37
|
const libsignal = __importStar(require("libsignal"));
|
|
28
|
-
const WASignalGroup_1 = require("../../WASignalGroup");
|
|
29
38
|
const Utils_1 = require("../Utils");
|
|
30
39
|
const WABinary_1 = require("../WABinary");
|
|
40
|
+
const sender_key_name_1 = require("./Group/sender-key-name");
|
|
41
|
+
const sender_key_record_1 = require("./Group/sender-key-record");
|
|
42
|
+
const Group_1 = require("./Group");
|
|
31
43
|
function makeLibSignalRepository(auth) {
|
|
32
44
|
const storage = signalStorage(auth);
|
|
33
45
|
return {
|
|
34
46
|
decryptGroupMessage({ group, authorJid, msg }) {
|
|
35
47
|
const senderName = jidToSignalSenderKeyName(group, authorJid);
|
|
36
|
-
const cipher = new
|
|
48
|
+
const cipher = new Group_1.GroupCipher(storage, senderName);
|
|
37
49
|
return cipher.decrypt(msg);
|
|
38
50
|
},
|
|
39
51
|
async processSenderKeyDistributionMessage({ item, authorJid }) {
|
|
40
|
-
const builder = new
|
|
52
|
+
const builder = new Group_1.GroupSessionBuilder(storage);
|
|
53
|
+
if (!item.groupId) {
|
|
54
|
+
throw new Error('Group ID is required for sender key distribution message');
|
|
55
|
+
}
|
|
41
56
|
const senderName = jidToSignalSenderKeyName(item.groupId, authorJid);
|
|
42
|
-
const senderMsg = new
|
|
43
|
-
const
|
|
57
|
+
const senderMsg = new Group_1.SenderKeyDistributionMessage(null, null, null, null, item.axolotlSenderKeyDistributionMessage);
|
|
58
|
+
const senderNameStr = senderName.toString();
|
|
59
|
+
const { [senderNameStr]: senderKey } = await auth.keys.get('sender-key', [senderNameStr]);
|
|
44
60
|
if (!senderKey) {
|
|
45
|
-
await storage.storeSenderKey(senderName, new
|
|
61
|
+
await storage.storeSenderKey(senderName, new sender_key_record_1.SenderKeyRecord());
|
|
46
62
|
}
|
|
47
63
|
await builder.process(senderName, senderMsg);
|
|
48
64
|
},
|
|
@@ -57,6 +73,8 @@ function makeLibSignalRepository(auth) {
|
|
|
57
73
|
case 'msg':
|
|
58
74
|
result = await session.decryptWhisperMessage(ciphertext);
|
|
59
75
|
break;
|
|
76
|
+
default:
|
|
77
|
+
throw new Error(`Unknown message type: ${type}`);
|
|
60
78
|
}
|
|
61
79
|
return result;
|
|
62
80
|
},
|
|
@@ -69,17 +87,18 @@ function makeLibSignalRepository(auth) {
|
|
|
69
87
|
},
|
|
70
88
|
async encryptGroupMessage({ group, meId, data }) {
|
|
71
89
|
const senderName = jidToSignalSenderKeyName(group, meId);
|
|
72
|
-
const builder = new
|
|
73
|
-
const
|
|
90
|
+
const builder = new Group_1.GroupSessionBuilder(storage);
|
|
91
|
+
const senderNameStr = senderName.toString();
|
|
92
|
+
const { [senderNameStr]: senderKey } = await auth.keys.get('sender-key', [senderNameStr]);
|
|
74
93
|
if (!senderKey) {
|
|
75
|
-
await storage.storeSenderKey(senderName, new
|
|
94
|
+
await storage.storeSenderKey(senderName, new sender_key_record_1.SenderKeyRecord());
|
|
76
95
|
}
|
|
77
96
|
const senderKeyDistributionMessage = await builder.create(senderName);
|
|
78
|
-
const session = new
|
|
97
|
+
const session = new Group_1.GroupCipher(storage, senderName);
|
|
79
98
|
const ciphertext = await session.encrypt(data);
|
|
80
99
|
return {
|
|
81
100
|
ciphertext,
|
|
82
|
-
senderKeyDistributionMessage: senderKeyDistributionMessage.serialize()
|
|
101
|
+
senderKeyDistributionMessage: senderKeyDistributionMessage.serialize()
|
|
83
102
|
};
|
|
84
103
|
},
|
|
85
104
|
async injectE2ESession({ jid, session }) {
|
|
@@ -88,16 +107,15 @@ function makeLibSignalRepository(auth) {
|
|
|
88
107
|
},
|
|
89
108
|
jidToSignalProtocolAddress(jid) {
|
|
90
109
|
return jidToSignalProtocolAddress(jid).toString();
|
|
91
|
-
}
|
|
110
|
+
}
|
|
92
111
|
};
|
|
93
112
|
}
|
|
94
|
-
exports.makeLibSignalRepository = makeLibSignalRepository;
|
|
95
113
|
const jidToSignalProtocolAddress = (jid) => {
|
|
96
114
|
const { user, device } = (0, WABinary_1.jidDecode)(jid);
|
|
97
115
|
return new libsignal.ProtocolAddress(user, device || 0);
|
|
98
116
|
};
|
|
99
117
|
const jidToSignalSenderKeyName = (group, user) => {
|
|
100
|
-
return new
|
|
118
|
+
return new sender_key_name_1.SenderKeyName(group, jidToSignalProtocolAddress(user));
|
|
101
119
|
};
|
|
102
120
|
function signalStorage({ creds, keys }) {
|
|
103
121
|
return {
|
|
@@ -108,7 +126,7 @@ function signalStorage({ creds, keys }) {
|
|
|
108
126
|
}
|
|
109
127
|
},
|
|
110
128
|
storeSession: async (id, session) => {
|
|
111
|
-
await keys.set({
|
|
129
|
+
await keys.set({ session: { [id]: session.serialize() } });
|
|
112
130
|
},
|
|
113
131
|
isTrustedIdentity: () => {
|
|
114
132
|
return true;
|
|
@@ -131,21 +149,25 @@ function signalStorage({ creds, keys }) {
|
|
|
131
149
|
pubKey: Buffer.from(key.keyPair.public)
|
|
132
150
|
};
|
|
133
151
|
},
|
|
134
|
-
loadSenderKey: async (
|
|
152
|
+
loadSenderKey: async (senderKeyName) => {
|
|
153
|
+
const keyId = senderKeyName.toString();
|
|
135
154
|
const { [keyId]: key } = await keys.get('sender-key', [keyId]);
|
|
136
155
|
if (key) {
|
|
137
|
-
return
|
|
156
|
+
return sender_key_record_1.SenderKeyRecord.deserialize(key);
|
|
138
157
|
}
|
|
158
|
+
return new sender_key_record_1.SenderKeyRecord();
|
|
139
159
|
},
|
|
140
|
-
storeSenderKey: async (
|
|
141
|
-
|
|
160
|
+
storeSenderKey: async (senderKeyName, key) => {
|
|
161
|
+
const keyId = senderKeyName.toString();
|
|
162
|
+
const serialized = JSON.stringify(key.serialize());
|
|
163
|
+
await keys.set({ 'sender-key': { [keyId]: Buffer.from(serialized, 'utf-8') } });
|
|
142
164
|
},
|
|
143
|
-
getOurRegistrationId: () =>
|
|
165
|
+
getOurRegistrationId: () => creds.registrationId,
|
|
144
166
|
getOurIdentity: () => {
|
|
145
167
|
const { signedIdentityKey } = creds;
|
|
146
168
|
return {
|
|
147
169
|
privKey: Buffer.from(signedIdentityKey.private),
|
|
148
|
-
pubKey: (0, Utils_1.generateSignalPubKey)(signedIdentityKey.public)
|
|
170
|
+
pubKey: (0, Utils_1.generateSignalPubKey)(signedIdentityKey.public)
|
|
149
171
|
};
|
|
150
172
|
}
|
|
151
173
|
};
|
package/lib/Socket/business.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { GetCatalogOptions, ProductCreate, ProductUpdate, SocketConfig } from '../Types';
|
|
2
3
|
import { BinaryNode } from '../WABinary';
|
|
3
4
|
export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
4
|
-
logger: Logger
|
|
5
|
+
logger: import("pino").Logger<import("pino").LoggerOptions>;
|
|
5
6
|
getOrderDetails: (orderId: string, tokenBase64: string) => Promise<import("../Types").OrderDetails>;
|
|
6
7
|
getCatalog: ({ jid, limit, cursor }: GetCatalogOptions) => Promise<{
|
|
7
8
|
products: import("../Types").Product[];
|
|
8
|
-
nextPageCursor:
|
|
9
|
+
nextPageCursor: string | undefined;
|
|
9
10
|
}>;
|
|
10
11
|
getCollections: (jid?: string, limit?: number) => Promise<{
|
|
11
12
|
collections: import("../Types").CatalogCollection[];
|
|
@@ -15,26 +16,27 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
|
15
16
|
deleted: number;
|
|
16
17
|
}>;
|
|
17
18
|
productUpdate: (productId: string, update: ProductUpdate) => Promise<import("../Types").Product>;
|
|
18
|
-
sendMessageAck: ({ tag, attrs, content }: BinaryNode
|
|
19
|
+
sendMessageAck: ({ tag, attrs, content }: BinaryNode) => Promise<void>;
|
|
19
20
|
sendRetryRequest: (node: BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
|
|
20
21
|
offerCall: (toJid: string, isVideo?: boolean) => Promise<{
|
|
21
|
-
id:
|
|
22
|
+
id: string;
|
|
22
23
|
to: string;
|
|
23
24
|
}>;
|
|
24
25
|
rejectCall: (callId: string, callFrom: string) => Promise<void>;
|
|
25
|
-
fetchMessageHistory: (count: number, oldestMsgKey: import("../Types").WAMessageKey, oldestMsgTimestamp: number) => Promise<string>;
|
|
26
|
-
requestPlaceholderResend: (messageKey: import("../Types").WAMessageKey) => Promise<string | undefined>;
|
|
27
26
|
getPrivacyTokens: (jids: string[]) => Promise<BinaryNode>;
|
|
28
27
|
assertSessions: (jids: string[], force: boolean) => Promise<boolean>;
|
|
29
28
|
relayMessage: (jid: string, message: import("../Types").WAProto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, cachedGroupMetadata, statusJidList }: import("../Types").MessageRelayOptions) => Promise<string>;
|
|
30
29
|
sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../Types").MessageReceiptType) => Promise<void>;
|
|
31
|
-
sendReceipts: (keys: import("../Types").
|
|
32
|
-
getButtonArgs: (message: import("../Types").WAProto.IMessage) =>
|
|
33
|
-
|
|
30
|
+
sendReceipts: (keys: import("../Types").WAProto.IMessageKey[], type: import("../Types").MessageReceiptType) => Promise<void>;
|
|
31
|
+
getButtonArgs: (message: import("../Types").WAProto.IMessage) => {
|
|
32
|
+
[key: string]: string;
|
|
33
|
+
};
|
|
34
|
+
readMessages: (keys: import("../Types").WAProto.IMessageKey[]) => Promise<void>;
|
|
34
35
|
refreshMediaConn: (forceGet?: boolean) => Promise<import("../Types").MediaConnInfo>;
|
|
35
36
|
getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<import("../WABinary").JidWithDevice[]>;
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
createParticipantNodes: (jids: string[], message: import("../Types").WAProto.IMessage, extraAttrs?: {
|
|
38
|
+
[key: string]: string;
|
|
39
|
+
} | undefined) => Promise<{
|
|
38
40
|
nodes: BinaryNode[];
|
|
39
41
|
shouldIncludeDeviceIdentity: boolean;
|
|
40
42
|
}>;
|
|
@@ -43,14 +45,12 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
|
43
45
|
[_: string]: string;
|
|
44
46
|
}>;
|
|
45
47
|
updateMediaMessage: (message: import("../Types").WAProto.IWebMessageInfo) => Promise<import("../Types").WAProto.IWebMessageInfo>;
|
|
46
|
-
sendStatusMentions: (content: import("../Types").AnyMessageContent, jids?: string[]) => Promise<import("../Types").WAProto.WebMessageInfo>;
|
|
47
|
-
sendAlbumMessage: (jid: string, medias: import("../Types").Media[], options?: import("../Types").MiscMessageGenerationOptions) => Promise<import("../Types").WAProto.WebMessageInfo>;
|
|
48
48
|
sendMessage: (jid: string, content: import("../Types").AnyMessageContent, options?: import("../Types").MiscMessageGenerationOptions) => Promise<import("../Types").WAProto.WebMessageInfo | undefined>;
|
|
49
49
|
subscribeNewsletterUpdates: (jid: string) => Promise<{
|
|
50
50
|
duration: string;
|
|
51
51
|
}>;
|
|
52
52
|
newsletterReactionMode: (jid: string, mode: import("../Types").NewsletterReactionMode) => Promise<void>;
|
|
53
|
-
newsletterUpdateDescription: (jid: string, description?: string) => Promise<void>;
|
|
53
|
+
newsletterUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>;
|
|
54
54
|
newsletterUpdateName: (jid: string, name: string) => Promise<void>;
|
|
55
55
|
newsletterUpdatePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
56
56
|
newsletterRemovePicture: (jid: string) => Promise<void>;
|
|
@@ -58,16 +58,16 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
|
58
58
|
newsletterFollow: (jid: string) => Promise<void>;
|
|
59
59
|
newsletterUnmute: (jid: string) => Promise<void>;
|
|
60
60
|
newsletterMute: (jid: string) => Promise<void>;
|
|
61
|
-
newsletterAction: (jid: string, type: "
|
|
62
|
-
newsletterCreate: (name: string, description: string) => Promise<import("../Types").NewsletterMetadata>;
|
|
63
|
-
newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole) => Promise<import("../Types").NewsletterMetadata>;
|
|
61
|
+
newsletterAction: (jid: string, type: "mute" | "follow" | "unfollow" | "unmute") => Promise<void>;
|
|
62
|
+
newsletterCreate: (name: string, description: string, reaction_codes: string) => Promise<import("../Types").NewsletterMetadata>;
|
|
63
|
+
newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole | undefined) => Promise<import("../Types").NewsletterMetadata>;
|
|
64
64
|
newsletterAdminCount: (jid: string) => Promise<number>;
|
|
65
65
|
newsletterChangeOwner: (jid: string, user: string) => Promise<void>;
|
|
66
66
|
newsletterDemote: (jid: string, user: string) => Promise<void>;
|
|
67
67
|
newsletterDelete: (jid: string) => Promise<void>;
|
|
68
|
-
newsletterReactMessage: (jid: string, serverId: string, code?: string) => Promise<void>;
|
|
69
|
-
newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
|
|
70
|
-
newsletterFetchUpdates: (jid: string, count: number, after?: number, since?: number) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
|
|
68
|
+
newsletterReactMessage: (jid: string, serverId: string, code?: string | undefined) => Promise<void>;
|
|
69
|
+
newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number | undefined) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
|
|
70
|
+
newsletterFetchUpdates: (jid: string, count: number, after?: number | undefined, since?: number | undefined) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
|
|
71
71
|
groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>;
|
|
72
72
|
groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>;
|
|
73
73
|
groupLeave: (id: string) => Promise<void>;
|
|
@@ -75,7 +75,7 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
|
75
75
|
groupRequestParticipantsList: (jid: string) => Promise<{
|
|
76
76
|
[key: string]: string;
|
|
77
77
|
}[]>;
|
|
78
|
-
groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "
|
|
78
|
+
groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "reject" | "approve") => Promise<{
|
|
79
79
|
status: string;
|
|
80
80
|
jid: string;
|
|
81
81
|
}[]>;
|
|
@@ -84,31 +84,32 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
|
84
84
|
jid: string;
|
|
85
85
|
content: BinaryNode;
|
|
86
86
|
}[]>;
|
|
87
|
-
groupUpdateDescription: (jid: string, description?: string) => Promise<void>;
|
|
87
|
+
groupUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>;
|
|
88
88
|
groupInviteCode: (jid: string) => Promise<string | undefined>;
|
|
89
89
|
groupRevokeInvite: (jid: string) => Promise<string | undefined>;
|
|
90
90
|
groupAcceptInvite: (code: string) => Promise<string | undefined>;
|
|
91
91
|
groupAcceptInviteV4: (key: string | import("../Types").WAProto.IMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<string>;
|
|
92
92
|
groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>;
|
|
93
93
|
groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
|
|
94
|
-
groupSettingUpdate: (jid: string, setting: "announcement" | "
|
|
95
|
-
groupMemberAddMode: (jid: string, mode: "
|
|
94
|
+
groupSettingUpdate: (jid: string, setting: "announcement" | "locked" | "not_announcement" | "unlocked") => Promise<void>;
|
|
95
|
+
groupMemberAddMode: (jid: string, mode: "all_member_add" | "admin_add") => Promise<void>;
|
|
96
96
|
groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
|
|
97
97
|
groupFetchAllParticipating: () => Promise<{
|
|
98
98
|
[_: string]: import("../Types").GroupMetadata;
|
|
99
99
|
}>;
|
|
100
100
|
processingMutex: {
|
|
101
|
-
mutex<T>(code: () =>
|
|
101
|
+
mutex<T>(code: () => T | Promise<T>): Promise<T>;
|
|
102
102
|
};
|
|
103
103
|
upsertMessage: (msg: import("../Types").WAProto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>;
|
|
104
104
|
appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
|
|
105
|
-
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string) => Promise<void>;
|
|
106
|
-
presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
|
|
107
|
-
profilePictureUrl: (jid: string, type?: "
|
|
105
|
+
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string | undefined) => Promise<void>;
|
|
106
|
+
presenceSubscribe: (toJid: string, tcToken?: Buffer | undefined) => Promise<void>;
|
|
107
|
+
profilePictureUrl: (jid: string, type?: "image" | "preview", timeoutMs?: number | undefined) => Promise<string | undefined>;
|
|
108
108
|
onWhatsApp: (...jids: string[]) => Promise<{
|
|
109
|
-
exists: boolean;
|
|
110
109
|
jid: string;
|
|
111
|
-
|
|
110
|
+
exists: unknown;
|
|
111
|
+
lid: unknown;
|
|
112
|
+
}[] | undefined>;
|
|
112
113
|
fetchBlocklist: () => Promise<string[]>;
|
|
113
114
|
fetchStatus: (jid: string) => Promise<{
|
|
114
115
|
status: string | undefined;
|
|
@@ -126,25 +127,25 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
|
126
127
|
updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
|
|
127
128
|
updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
128
129
|
updateDefaultDisappearingMode: (duration: number) => Promise<void>;
|
|
129
|
-
getBusinessProfile: (jid: string) => Promise<import("../Types").WABusinessProfile
|
|
130
|
+
getBusinessProfile: (jid: string) => Promise<void | import("../Types").WABusinessProfile>;
|
|
130
131
|
resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
|
|
131
132
|
chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
|
|
132
|
-
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number |
|
|
133
|
+
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>;
|
|
133
134
|
addChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
134
135
|
removeChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
135
136
|
addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
136
137
|
removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
137
138
|
star: (jid: string, messages: {
|
|
138
139
|
id: string;
|
|
139
|
-
fromMe?: boolean;
|
|
140
|
+
fromMe?: boolean | undefined;
|
|
140
141
|
}[], star: boolean) => Promise<void>;
|
|
141
142
|
type: "md";
|
|
142
143
|
ws: any;
|
|
143
144
|
ev: import("../Types").BaileysEventEmitter & {
|
|
144
|
-
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (
|
|
145
|
+
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
|
|
145
146
|
buffer(): void;
|
|
146
|
-
createBufferedFunction<A extends any[],
|
|
147
|
-
flush(force?: boolean): boolean;
|
|
147
|
+
createBufferedFunction<A extends any[], T_1>(work: (...args: A) => Promise<T_1>): (...args: A) => Promise<T_1>;
|
|
148
|
+
flush(force?: boolean | undefined): boolean;
|
|
148
149
|
isBuffering(): boolean;
|
|
149
150
|
};
|
|
150
151
|
authState: {
|
|
@@ -154,17 +155,17 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
|
154
155
|
signalRepository: import("../Types").SignalRepository;
|
|
155
156
|
user: import("../Types").Contact | undefined;
|
|
156
157
|
generateMessageTag: () => string;
|
|
157
|
-
query: (node: BinaryNode, timeoutMs?: number) => Promise<BinaryNode>;
|
|
158
|
-
waitForMessage: <
|
|
158
|
+
query: (node: BinaryNode, timeoutMs?: number | undefined) => Promise<BinaryNode>;
|
|
159
|
+
waitForMessage: <T_2>(msgId: string, timeoutMs?: number | undefined) => Promise<T_2>;
|
|
159
160
|
waitForSocketOpen: () => Promise<void>;
|
|
160
161
|
sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
|
|
161
162
|
sendNode: (frame: BinaryNode) => Promise<void>;
|
|
162
|
-
logout: (msg?: string) => Promise<void>;
|
|
163
|
+
logout: (msg?: string | undefined) => Promise<void>;
|
|
163
164
|
end: (error: Error | undefined) => void;
|
|
164
|
-
onUnexpectedError: (err: Error | Boom
|
|
165
|
+
onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void;
|
|
165
166
|
uploadPreKeys: (count?: number) => Promise<void>;
|
|
166
167
|
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
167
|
-
requestPairingCode: (phoneNumber: string
|
|
168
|
-
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number) => Promise<void>;
|
|
168
|
+
requestPairingCode: (phoneNumber: string) => Promise<string>;
|
|
169
|
+
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
|
|
169
170
|
sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>;
|
|
170
171
|
};
|