supunmd-bail 2.0.2 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +2 -2
- package/WAProto/index.js +130529 -45236
- package/engine-requirements.js +1 -1
- package/lib/Defaults/baileys-version.json +1 -1
- package/lib/Defaults/index.d.ts +9 -18
- package/lib/Defaults/index.js +136 -104
- package/lib/Defaults/phonenumber-mcc.json +223 -0
- package/lib/Signal/Group/ciphertext-message.d.ts +0 -1
- package/lib/Signal/Group/ciphertext-message.js +5 -2
- package/lib/Signal/Group/group-session-builder.d.ts +3 -4
- package/lib/Signal/Group/group-session-builder.js +41 -7
- package/lib/Signal/Group/group_cipher.d.ts +4 -4
- package/lib/Signal/Group/group_cipher.js +51 -37
- package/lib/Signal/Group/index.d.ts +11 -12
- package/lib/Signal/Group/index.js +57 -12
- package/lib/Signal/Group/keyhelper.d.ts +1 -2
- package/lib/Signal/Group/keyhelper.js +44 -7
- package/lib/Signal/Group/queue-job.d.ts +0 -1
- package/lib/Signal/Group/queue-job.js +5 -2
- package/lib/Signal/Group/sender-chain-key.d.ts +2 -3
- package/lib/Signal/Group/sender-chain-key.js +15 -7
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +1 -2
- package/lib/Signal/Group/sender-key-distribution-message.js +11 -8
- package/lib/Signal/Group/sender-key-message.d.ts +1 -2
- package/lib/Signal/Group/sender-key-message.js +12 -9
- package/lib/Signal/Group/sender-key-name.d.ts +0 -1
- package/lib/Signal/Group/sender-key-name.js +5 -2
- package/lib/Signal/Group/sender-key-record.d.ts +2 -3
- package/lib/Signal/Group/sender-key-record.js +21 -9
- package/lib/Signal/Group/sender-key-state.d.ts +6 -7
- package/lib/Signal/Group/sender-key-state.js +42 -27
- package/lib/Signal/Group/sender-message-key.d.ts +0 -1
- package/lib/Signal/Group/sender-message-key.js +7 -4
- package/lib/Signal/libsignal.d.ts +3 -5
- package/lib/Signal/libsignal.js +90 -258
- package/lib/Socket/Client/{types.d.ts → abstract-socket-client.d.ts} +3 -2
- package/lib/Socket/Client/abstract-socket-client.js +13 -0
- package/lib/Socket/Client/index.d.ts +3 -3
- package/lib/Socket/Client/index.js +19 -3
- package/lib/Socket/Client/mobile-socket-client.d.ts +13 -0
- package/lib/Socket/Client/mobile-socket-client.js +65 -0
- package/lib/Socket/Client/{websocket.d.ts → web-socket-client.d.ts} +1 -2
- package/lib/Socket/Client/web-socket-client.js +62 -0
- package/lib/Socket/business.d.ts +108 -125
- package/lib/Socket/business.js +43 -159
- package/lib/Socket/chats.d.ts +239 -70
- package/lib/Socket/chats.js +384 -363
- package/lib/Socket/dugong.d.ts +254 -0
- package/lib/Socket/dugong.js +484 -0
- package/lib/Socket/groups.d.ts +56 -78
- package/lib/Socket/groups.js +96 -106
- package/lib/Socket/index.d.ts +115 -173
- package/lib/Socket/index.js +10 -17
- package/lib/Socket/messages-recv.d.ts +79 -91
- package/lib/Socket/messages-recv.js +521 -639
- package/lib/Socket/messages-send.d.ts +91 -111
- package/lib/Socket/messages-send.js +438 -599
- package/lib/Socket/newsletter.d.ts +84 -97
- package/lib/Socket/newsletter.js +1 -181
- package/lib/Socket/registration.d.ts +267 -0
- package/lib/Socket/registration.js +166 -0
- package/lib/Socket/socket.d.ts +18 -26
- package/lib/Socket/socket.js +230 -448
- package/lib/Socket/usync.d.ts +16 -17
- package/lib/Socket/usync.js +26 -19
- package/lib/Store/index.d.ts +3 -0
- package/lib/Store/index.js +10 -0
- package/lib/Store/make-cache-manager-store.d.ts +13 -0
- package/lib/Store/make-cache-manager-store.js +83 -0
- package/lib/Store/make-in-memory-store.d.ts +118 -0
- package/lib/Store/make-in-memory-store.js +427 -0
- package/lib/Store/make-ordered-dictionary.d.ts +13 -0
- package/lib/Store/make-ordered-dictionary.js +81 -0
- package/lib/Store/object-repository.d.ts +10 -0
- package/lib/Store/object-repository.js +27 -0
- package/lib/Types/Auth.d.ts +12 -13
- package/lib/Types/Auth.js +2 -2
- package/lib/Types/Call.d.ts +1 -2
- package/lib/Types/Call.js +2 -2
- package/lib/Types/Chat.d.ts +13 -34
- package/lib/Types/Chat.js +4 -8
- package/lib/Types/Contact.d.ts +1 -6
- package/lib/Types/Contact.js +2 -2
- package/lib/Types/Events.d.ts +15 -60
- package/lib/Types/Events.js +2 -2
- package/lib/Types/GroupMetadata.d.ts +5 -17
- package/lib/Types/GroupMetadata.js +2 -2
- package/lib/Types/Label.d.ts +0 -12
- package/lib/Types/Label.js +5 -3
- package/lib/Types/LabelAssociation.d.ts +0 -1
- package/lib/Types/LabelAssociation.js +5 -3
- package/lib/Types/Message.d.ts +54 -84
- package/lib/Types/Message.js +9 -11
- package/lib/Types/Newsletter.d.ts +98 -130
- package/lib/Types/Newsletter.js +38 -31
- package/lib/Types/Product.d.ts +1 -2
- package/lib/Types/Product.js +2 -2
- package/lib/Types/Signal.d.ts +1 -20
- package/lib/Types/Signal.js +2 -2
- package/lib/Types/Socket.d.ts +25 -47
- package/lib/Types/Socket.js +2 -3
- package/lib/Types/State.d.ts +2 -14
- package/lib/Types/State.js +2 -13
- package/lib/Types/USync.d.ts +2 -3
- package/lib/Types/USync.js +2 -2
- package/lib/Types/index.d.ts +14 -22
- package/lib/Types/index.js +31 -15
- package/lib/Utils/auth-utils.d.ts +6 -7
- package/lib/Utils/auth-utils.js +148 -199
- package/lib/Utils/baileys-event-stream.d.ts +1 -2
- package/lib/Utils/baileys-event-stream.js +22 -15
- package/lib/Utils/business.d.ts +2 -3
- package/lib/Utils/business.js +69 -66
- package/lib/Utils/chat-utils.d.ts +22 -21
- package/lib/Utils/chat-utils.js +226 -260
- package/lib/Utils/crypto.d.ts +19 -19
- package/lib/Utils/crypto.js +86 -77
- package/lib/Utils/decode-wa-message.d.ts +8 -37
- package/lib/Utils/decode-wa-message.js +83 -164
- package/lib/Utils/event-buffer.d.ts +8 -7
- package/lib/Utils/event-buffer.js +76 -110
- package/lib/Utils/generics.d.ts +29 -27
- package/lib/Utils/generics.js +210 -168
- package/lib/Utils/history.d.ts +8 -12
- package/lib/Utils/history.js +46 -34
- package/lib/Utils/index.d.ts +17 -20
- package/lib/Utils/index.js +33 -20
- package/lib/Utils/link-preview.d.ts +5 -5
- package/lib/Utils/link-preview.js +22 -14
- package/lib/Utils/logger.d.ts +3 -11
- package/lib/Utils/logger.js +7 -3
- package/lib/Utils/lt-hash.d.ts +8 -9
- package/lib/Utils/lt-hash.js +28 -25
- package/lib/Utils/make-mutex.d.ts +2 -3
- package/lib/Utils/make-mutex.js +10 -7
- package/lib/Utils/messages-media.d.ts +44 -42
- package/lib/Utils/messages-media.js +475 -319
- package/lib/Utils/messages.d.ts +18 -17
- package/lib/Utils/messages.js +259 -383
- package/lib/Utils/noise-handler.d.ts +15 -14
- package/lib/Utils/noise-handler.js +38 -30
- package/lib/Utils/process-message.d.ts +13 -14
- package/lib/Utils/process-message.js +147 -239
- package/lib/Utils/signal.d.ts +5 -7
- package/lib/Utils/signal.js +72 -78
- package/lib/Utils/use-multi-file-auth-state.d.ts +2 -2
- package/lib/Utils/use-multi-file-auth-state.js +27 -29
- package/lib/Utils/validate-connection.d.ts +7 -7
- package/lib/Utils/validate-connection.js +106 -72
- package/lib/WABinary/constants.d.ts +27 -25
- package/lib/WABinary/constants.js +20 -1281
- package/lib/WABinary/decode.d.ts +5 -5
- package/lib/WABinary/decode.js +42 -28
- package/lib/WABinary/encode.d.ts +3 -3
- package/lib/WABinary/encode.js +154 -105
- package/lib/WABinary/generic-utils.d.ts +7 -5
- package/lib/WABinary/generic-utils.js +63 -56
- package/lib/WABinary/index.d.ts +5 -6
- package/lib/WABinary/index.js +21 -6
- package/lib/WABinary/jid-utils.d.ts +8 -25
- package/lib/WABinary/jid-utils.js +40 -74
- package/lib/WABinary/types.d.ts +1 -2
- package/lib/WABinary/types.js +2 -2
- package/lib/WAM/BinaryInfo.d.ts +11 -3
- package/lib/WAM/BinaryInfo.js +5 -2
- package/lib/WAM/constants.d.ts +3 -5
- package/lib/WAM/constants.js +11958 -19461
- package/lib/WAM/encode.d.ts +3 -3
- package/lib/WAM/encode.js +22 -17
- package/lib/WAM/index.d.ts +3 -4
- package/lib/WAM/index.js +19 -4
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +3 -4
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +11 -8
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +2 -3
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +14 -11
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +2 -3
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +12 -9
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +2 -3
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +13 -9
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +3 -4
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +22 -20
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +3 -5
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +8 -13
- package/lib/WAUSync/Protocols/index.d.ts +4 -5
- package/lib/WAUSync/Protocols/index.js +20 -5
- package/lib/WAUSync/USyncQuery.d.ts +4 -5
- package/lib/WAUSync/USyncQuery.js +35 -40
- package/lib/WAUSync/USyncUser.d.ts +5 -6
- package/lib/WAUSync/USyncUser.js +5 -2
- package/lib/WAUSync/index.d.ts +3 -4
- package/lib/WAUSync/index.js +19 -4
- package/lib/index.d.ts +9 -19
- package/lib/index.js +1 -36
- package/package.json +109 -103
- package/WAProto/GenerateStatics.sh +0 -3
- package/WAProto/WAProto.proto +0 -5519
- package/WAProto/fix-imports.js +0 -29
- package/WAProto/index.d.ts +0 -11969
- package/lib/Signal/lid-mapping.d.ts +0 -23
- package/lib/Signal/lid-mapping.js +0 -171
- package/lib/Socket/Client/types.js +0 -11
- package/lib/Socket/Client/websocket.js +0 -50
- package/lib/Socket/communities.d.ts +0 -244
- package/lib/Socket/communities.js +0 -431
- package/lib/Socket/mex.d.ts +0 -3
- package/lib/Socket/mex.js +0 -42
- package/lib/Types/Bussines.d.ts +0 -25
- package/lib/Types/Bussines.js +0 -2
- package/lib/Utils/browser-utils.d.ts +0 -4
- package/lib/Utils/browser-utils.js +0 -28
- package/lib/Utils/message-retry-manager.d.ts +0 -82
- package/lib/Utils/message-retry-manager.js +0 -149
- package/lib/Utils/pre-key-manager.d.ts +0 -28
- package/lib/Utils/pre-key-manager.js +0 -106
- /package/lib/{supun → supunmd} +0 -0
|
@@ -1,31 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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 {
|
|
4
7
|
constructor(id, iteration, chainKey, signatureKeyPair, signatureKeyPublic, signatureKeyPrivate, senderKeyStateStructure) {
|
|
5
8
|
this.MAX_MESSAGE_KEYS = 2000;
|
|
6
9
|
if (senderKeyStateStructure) {
|
|
7
|
-
this.senderKeyStateStructure =
|
|
8
|
-
...senderKeyStateStructure,
|
|
9
|
-
senderMessageKeys: Array.isArray(senderKeyStateStructure.senderMessageKeys)
|
|
10
|
-
? senderKeyStateStructure.senderMessageKeys
|
|
11
|
-
: []
|
|
12
|
-
};
|
|
10
|
+
this.senderKeyStateStructure = senderKeyStateStructure;
|
|
13
11
|
}
|
|
14
12
|
else {
|
|
15
13
|
if (signatureKeyPair) {
|
|
16
14
|
signatureKeyPublic = signatureKeyPair.public;
|
|
17
15
|
signatureKeyPrivate = signatureKeyPair.private;
|
|
18
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
|
+
}
|
|
19
31
|
this.senderKeyStateStructure = {
|
|
20
32
|
senderKeyId: id || 0,
|
|
21
|
-
senderChainKey:
|
|
22
|
-
|
|
23
|
-
seed: Buffer.from(chainKey || [])
|
|
24
|
-
},
|
|
25
|
-
senderSigningKey: {
|
|
26
|
-
public: Buffer.from(signatureKeyPublic || []),
|
|
27
|
-
private: Buffer.from(signatureKeyPrivate || [])
|
|
28
|
-
},
|
|
33
|
+
senderChainKey: senderChainKeyStructure,
|
|
34
|
+
senderSigningKey: signingKeyStructure,
|
|
29
35
|
senderMessageKeys: []
|
|
30
36
|
};
|
|
31
37
|
}
|
|
@@ -34,7 +40,7 @@ export class SenderKeyState {
|
|
|
34
40
|
return this.senderKeyStateStructure.senderKeyId;
|
|
35
41
|
}
|
|
36
42
|
getSenderChainKey() {
|
|
37
|
-
return new SenderChainKey(this.senderKeyStateStructure.senderChainKey.iteration, this.senderKeyStateStructure.senderChainKey.seed);
|
|
43
|
+
return new sender_chain_key_1.SenderChainKey(this.senderKeyStateStructure.senderChainKey.iteration, this.senderKeyStateStructure.senderChainKey.seed);
|
|
38
44
|
}
|
|
39
45
|
setSenderChainKey(chainKey) {
|
|
40
46
|
this.senderKeyStateStructure.senderChainKey = {
|
|
@@ -43,17 +49,26 @@ export class SenderKeyState {
|
|
|
43
49
|
};
|
|
44
50
|
}
|
|
45
51
|
getSigningKeyPublic() {
|
|
46
|
-
const publicKey =
|
|
47
|
-
if (publicKey
|
|
48
|
-
|
|
49
|
-
fixed[0] = 0x05;
|
|
50
|
-
publicKey.copy(fixed, 1);
|
|
51
|
-
return fixed;
|
|
52
|
+
const publicKey = this.senderKeyStateStructure.senderSigningKey.public;
|
|
53
|
+
if (publicKey instanceof Buffer) {
|
|
54
|
+
return publicKey;
|
|
52
55
|
}
|
|
53
|
-
|
|
56
|
+
else if (typeof publicKey === 'string') {
|
|
57
|
+
return Buffer.from(publicKey, 'base64');
|
|
58
|
+
}
|
|
59
|
+
return Buffer.from(publicKey || []);
|
|
54
60
|
}
|
|
55
61
|
getSigningKeyPrivate() {
|
|
56
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
|
+
}
|
|
57
72
|
return Buffer.from(privateKey || []);
|
|
58
73
|
}
|
|
59
74
|
hasSenderMessageKey(iteration) {
|
|
@@ -73,7 +88,7 @@ export class SenderKeyState {
|
|
|
73
88
|
if (index !== -1) {
|
|
74
89
|
const messageKey = this.senderKeyStateStructure.senderMessageKeys[index];
|
|
75
90
|
this.senderKeyStateStructure.senderMessageKeys.splice(index, 1);
|
|
76
|
-
return new SenderMessageKey(messageKey.iteration, messageKey.seed);
|
|
91
|
+
return new sender_message_key_1.SenderMessageKey(messageKey.iteration, messageKey.seed);
|
|
77
92
|
}
|
|
78
93
|
return null;
|
|
79
94
|
}
|
|
@@ -81,4 +96,4 @@ export class SenderKeyState {
|
|
|
81
96
|
return this.senderKeyStateStructure;
|
|
82
97
|
}
|
|
83
98
|
}
|
|
84
|
-
|
|
99
|
+
exports.SenderKeyState = SenderKeyState;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SenderMessageKey = void 0;
|
|
4
|
+
const crypto_1 = require("libsignal/src/crypto");
|
|
5
|
+
class SenderMessageKey {
|
|
3
6
|
constructor(iteration, seed) {
|
|
4
|
-
const derivative = deriveSecrets(seed, Buffer.alloc(32), Buffer.from('WhisperGroup'));
|
|
7
|
+
const derivative = (0, crypto_1.deriveSecrets)(seed, Buffer.alloc(32), Buffer.from('WhisperGroup'));
|
|
5
8
|
const keys = new Uint8Array(32);
|
|
6
9
|
keys.set(new Uint8Array(derivative[0].slice(16)));
|
|
7
10
|
keys.set(new Uint8Array(derivative[1].slice(0, 16)), 16);
|
|
@@ -23,4 +26,4 @@ export class SenderMessageKey {
|
|
|
23
26
|
return this.seed;
|
|
24
27
|
}
|
|
25
28
|
}
|
|
26
|
-
|
|
29
|
+
exports.SenderMessageKey = SenderMessageKey;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
export declare function makeLibSignalRepository(auth: SignalAuthState, logger: ILogger, pnToLIDFunc?: (jids: string[]) => Promise<LIDMapping[] | undefined>): SignalRepositoryWithLIDStore;
|
|
5
|
-
//# sourceMappingURL=libsignal.d.ts.map
|
|
1
|
+
import { SignalAuthState } from '../Types';
|
|
2
|
+
import { SignalRepository } from '../Types/Signal';
|
|
3
|
+
export declare function makeLibSignalRepository(auth: SignalAuthState): SignalRepository;
|
package/lib/Signal/libsignal.js
CHANGED
|
@@ -1,302 +1,135 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
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
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.makeLibSignalRepository = makeLibSignalRepository;
|
|
37
|
+
const libsignal = __importStar(require("libsignal"));
|
|
38
|
+
const Utils_1 = require("../Utils");
|
|
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");
|
|
43
|
+
function makeLibSignalRepository(auth) {
|
|
44
|
+
const storage = signalStorage(auth);
|
|
45
|
+
return {
|
|
20
46
|
decryptGroupMessage({ group, authorJid, msg }) {
|
|
21
47
|
const senderName = jidToSignalSenderKeyName(group, authorJid);
|
|
22
|
-
const cipher = new GroupCipher(storage, senderName);
|
|
23
|
-
|
|
24
|
-
return parsedKeys.transaction(async () => {
|
|
25
|
-
return cipher.decrypt(msg);
|
|
26
|
-
}, group);
|
|
48
|
+
const cipher = new Group_1.GroupCipher(storage, senderName);
|
|
49
|
+
return cipher.decrypt(msg);
|
|
27
50
|
},
|
|
28
51
|
async processSenderKeyDistributionMessage({ item, authorJid }) {
|
|
29
|
-
const builder = new GroupSessionBuilder(storage);
|
|
52
|
+
const builder = new Group_1.GroupSessionBuilder(storage);
|
|
30
53
|
if (!item.groupId) {
|
|
31
54
|
throw new Error('Group ID is required for sender key distribution message');
|
|
32
55
|
}
|
|
33
56
|
const senderName = jidToSignalSenderKeyName(item.groupId, authorJid);
|
|
34
|
-
const senderMsg = new SenderKeyDistributionMessage(null, null, null, null, item.axolotlSenderKeyDistributionMessage);
|
|
57
|
+
const senderMsg = new Group_1.SenderKeyDistributionMessage(null, null, null, null, item.axolotlSenderKeyDistributionMessage);
|
|
35
58
|
const senderNameStr = senderName.toString();
|
|
36
59
|
const { [senderNameStr]: senderKey } = await auth.keys.get('sender-key', [senderNameStr]);
|
|
37
60
|
if (!senderKey) {
|
|
38
|
-
await storage.storeSenderKey(senderName, new SenderKeyRecord());
|
|
61
|
+
await storage.storeSenderKey(senderName, new sender_key_record_1.SenderKeyRecord());
|
|
39
62
|
}
|
|
40
|
-
|
|
41
|
-
const { [senderNameStr]: senderKey } = await auth.keys.get('sender-key', [senderNameStr]);
|
|
42
|
-
if (!senderKey) {
|
|
43
|
-
await storage.storeSenderKey(senderName, new SenderKeyRecord());
|
|
44
|
-
}
|
|
45
|
-
await builder.process(senderName, senderMsg);
|
|
46
|
-
}, item.groupId);
|
|
63
|
+
await builder.process(senderName, senderMsg);
|
|
47
64
|
},
|
|
48
65
|
async decryptMessage({ jid, type, ciphertext }) {
|
|
49
66
|
const addr = jidToSignalProtocolAddress(jid);
|
|
50
67
|
const session = new libsignal.SessionCipher(storage, addr);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return result;
|
|
68
|
+
let result;
|
|
69
|
+
switch (type) {
|
|
70
|
+
case 'pkmsg':
|
|
71
|
+
result = await session.decryptPreKeyWhisperMessage(ciphertext);
|
|
72
|
+
break;
|
|
73
|
+
case 'msg':
|
|
74
|
+
result = await session.decryptWhisperMessage(ciphertext);
|
|
75
|
+
break;
|
|
76
|
+
default:
|
|
77
|
+
throw new Error(`Unknown message type: ${type}`);
|
|
62
78
|
}
|
|
63
|
-
|
|
64
|
-
// For regular messages, we use a transaction to ensure atomicity
|
|
65
|
-
return parsedKeys.transaction(async () => {
|
|
66
|
-
return await doDecrypt();
|
|
67
|
-
}, jid);
|
|
79
|
+
return result;
|
|
68
80
|
},
|
|
69
81
|
async encryptMessage({ jid, data }) {
|
|
70
82
|
const addr = jidToSignalProtocolAddress(jid);
|
|
71
83
|
const cipher = new libsignal.SessionCipher(storage, addr);
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const type = sigType === 3 ? 'pkmsg' : 'msg';
|
|
76
|
-
return { type, ciphertext: Buffer.from(body, 'binary') };
|
|
77
|
-
}, jid);
|
|
84
|
+
const { type: sigType, body } = await cipher.encrypt(data);
|
|
85
|
+
const type = sigType === 3 ? 'pkmsg' : 'msg';
|
|
86
|
+
return { type, ciphertext: Buffer.from(body, 'binary') };
|
|
78
87
|
},
|
|
79
88
|
async encryptGroupMessage({ group, meId, data }) {
|
|
80
89
|
const senderName = jidToSignalSenderKeyName(group, meId);
|
|
81
|
-
const builder = new GroupSessionBuilder(storage);
|
|
90
|
+
const builder = new Group_1.GroupSessionBuilder(storage);
|
|
82
91
|
const senderNameStr = senderName.toString();
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
};
|
|
95
|
-
}, group);
|
|
92
|
+
const { [senderNameStr]: senderKey } = await auth.keys.get('sender-key', [senderNameStr]);
|
|
93
|
+
if (!senderKey) {
|
|
94
|
+
await storage.storeSenderKey(senderName, new sender_key_record_1.SenderKeyRecord());
|
|
95
|
+
}
|
|
96
|
+
const senderKeyDistributionMessage = await builder.create(senderName);
|
|
97
|
+
const session = new Group_1.GroupCipher(storage, senderName);
|
|
98
|
+
const ciphertext = await session.encrypt(data);
|
|
99
|
+
return {
|
|
100
|
+
ciphertext,
|
|
101
|
+
senderKeyDistributionMessage: senderKeyDistributionMessage.serialize()
|
|
102
|
+
};
|
|
96
103
|
},
|
|
97
104
|
async injectE2ESession({ jid, session }) {
|
|
98
|
-
logger.trace({ jid }, 'injecting E2EE session');
|
|
99
105
|
const cipher = new libsignal.SessionBuilder(storage, jidToSignalProtocolAddress(jid));
|
|
100
|
-
|
|
101
|
-
await cipher.initOutgoing(session);
|
|
102
|
-
}, jid);
|
|
106
|
+
await cipher.initOutgoing(session);
|
|
103
107
|
},
|
|
104
108
|
jidToSignalProtocolAddress(jid) {
|
|
105
109
|
return jidToSignalProtocolAddress(jid).toString();
|
|
106
|
-
},
|
|
107
|
-
// Optimized direct access to LID mapping store
|
|
108
|
-
lidMapping,
|
|
109
|
-
async validateSession(jid) {
|
|
110
|
-
try {
|
|
111
|
-
const addr = jidToSignalProtocolAddress(jid);
|
|
112
|
-
const session = await storage.loadSession(addr.toString());
|
|
113
|
-
if (!session) {
|
|
114
|
-
return { exists: false, reason: 'no session' };
|
|
115
|
-
}
|
|
116
|
-
if (!session.haveOpenSession()) {
|
|
117
|
-
return { exists: false, reason: 'no open session' };
|
|
118
|
-
}
|
|
119
|
-
return { exists: true };
|
|
120
|
-
}
|
|
121
|
-
catch (error) {
|
|
122
|
-
return { exists: false, reason: 'validation error' };
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
async deleteSession(jids) {
|
|
126
|
-
if (!jids.length)
|
|
127
|
-
return;
|
|
128
|
-
// Convert JIDs to signal addresses and prepare for bulk deletion
|
|
129
|
-
const sessionUpdates = {};
|
|
130
|
-
jids.forEach(jid => {
|
|
131
|
-
const addr = jidToSignalProtocolAddress(jid);
|
|
132
|
-
sessionUpdates[addr.toString()] = null;
|
|
133
|
-
});
|
|
134
|
-
// Single transaction for all deletions
|
|
135
|
-
return parsedKeys.transaction(async () => {
|
|
136
|
-
await auth.keys.set({ session: sessionUpdates });
|
|
137
|
-
}, `delete-${jids.length}-sessions`);
|
|
138
|
-
},
|
|
139
|
-
async migrateSession(fromJid, toJid) {
|
|
140
|
-
// TODO: use usync to handle this entire mess
|
|
141
|
-
if (!fromJid || (!isLidUser(toJid) && !isHostedLidUser(toJid)))
|
|
142
|
-
return { migrated: 0, skipped: 0, total: 0 };
|
|
143
|
-
// Only support PN to LID migration
|
|
144
|
-
if (!isPnUser(fromJid) && !isHostedPnUser(fromJid)) {
|
|
145
|
-
return { migrated: 0, skipped: 0, total: 1 };
|
|
146
|
-
}
|
|
147
|
-
const { user } = jidDecode(fromJid);
|
|
148
|
-
logger.debug({ fromJid }, 'bulk device migration - loading all user devices');
|
|
149
|
-
// Get user's device list from storage
|
|
150
|
-
const { [user]: userDevices } = await parsedKeys.get('device-list', [user]);
|
|
151
|
-
if (!userDevices) {
|
|
152
|
-
return { migrated: 0, skipped: 0, total: 0 };
|
|
153
|
-
}
|
|
154
|
-
const { device: fromDevice } = jidDecode(fromJid);
|
|
155
|
-
const fromDeviceStr = fromDevice?.toString() || '0';
|
|
156
|
-
if (!userDevices.includes(fromDeviceStr)) {
|
|
157
|
-
userDevices.push(fromDeviceStr);
|
|
158
|
-
}
|
|
159
|
-
// Filter out cached devices before database fetch
|
|
160
|
-
const uncachedDevices = userDevices.filter(device => {
|
|
161
|
-
const deviceKey = `${user}.${device}`;
|
|
162
|
-
return !migratedSessionCache.has(deviceKey);
|
|
163
|
-
});
|
|
164
|
-
// Bulk check session existence only for uncached devices
|
|
165
|
-
const deviceSessionKeys = uncachedDevices.map(device => `${user}.${device}`);
|
|
166
|
-
const existingSessions = await parsedKeys.get('session', deviceSessionKeys);
|
|
167
|
-
// Step 3: Convert existing sessions to JIDs (only migrate sessions that exist)
|
|
168
|
-
const deviceJids = [];
|
|
169
|
-
for (const [sessionKey, sessionData] of Object.entries(existingSessions)) {
|
|
170
|
-
if (sessionData) {
|
|
171
|
-
// Session exists in storage
|
|
172
|
-
const deviceStr = sessionKey.split('.')[1];
|
|
173
|
-
if (!deviceStr)
|
|
174
|
-
continue;
|
|
175
|
-
const deviceNum = parseInt(deviceStr);
|
|
176
|
-
let jid = deviceNum === 0 ? `${user}@s.whatsapp.net` : `${user}:${deviceNum}@s.whatsapp.net`;
|
|
177
|
-
if (deviceNum === 99) {
|
|
178
|
-
jid = `${user}:99@hosted`;
|
|
179
|
-
}
|
|
180
|
-
deviceJids.push(jid);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
logger.debug({
|
|
184
|
-
fromJid,
|
|
185
|
-
totalDevices: userDevices.length,
|
|
186
|
-
devicesWithSessions: deviceJids.length,
|
|
187
|
-
devices: deviceJids
|
|
188
|
-
}, 'bulk device migration complete - all user devices processed');
|
|
189
|
-
// Single transaction for all migrations
|
|
190
|
-
return parsedKeys.transaction(async () => {
|
|
191
|
-
const migrationOps = deviceJids.map(jid => {
|
|
192
|
-
const lidWithDevice = transferDevice(jid, toJid);
|
|
193
|
-
const fromDecoded = jidDecode(jid);
|
|
194
|
-
const toDecoded = jidDecode(lidWithDevice);
|
|
195
|
-
return {
|
|
196
|
-
fromJid: jid,
|
|
197
|
-
toJid: lidWithDevice,
|
|
198
|
-
pnUser: fromDecoded.user,
|
|
199
|
-
lidUser: toDecoded.user,
|
|
200
|
-
deviceId: fromDecoded.device || 0,
|
|
201
|
-
fromAddr: jidToSignalProtocolAddress(jid),
|
|
202
|
-
toAddr: jidToSignalProtocolAddress(lidWithDevice)
|
|
203
|
-
};
|
|
204
|
-
});
|
|
205
|
-
const totalOps = migrationOps.length;
|
|
206
|
-
let migratedCount = 0;
|
|
207
|
-
// Bulk fetch PN sessions - already exist (verified during device discovery)
|
|
208
|
-
const pnAddrStrings = Array.from(new Set(migrationOps.map(op => op.fromAddr.toString())));
|
|
209
|
-
const pnSessions = await parsedKeys.get('session', pnAddrStrings);
|
|
210
|
-
// Prepare bulk session updates (PN → LID migration + deletion)
|
|
211
|
-
const sessionUpdates = {};
|
|
212
|
-
for (const op of migrationOps) {
|
|
213
|
-
const pnAddrStr = op.fromAddr.toString();
|
|
214
|
-
const lidAddrStr = op.toAddr.toString();
|
|
215
|
-
const pnSession = pnSessions[pnAddrStr];
|
|
216
|
-
if (pnSession) {
|
|
217
|
-
// Session exists (guaranteed from device discovery)
|
|
218
|
-
const fromSession = libsignal.SessionRecord.deserialize(pnSession);
|
|
219
|
-
if (fromSession.haveOpenSession()) {
|
|
220
|
-
// Queue for bulk update: copy to LID, delete from PN
|
|
221
|
-
sessionUpdates[lidAddrStr] = fromSession.serialize();
|
|
222
|
-
sessionUpdates[pnAddrStr] = null;
|
|
223
|
-
migratedCount++;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
// Single bulk session update for all migrations
|
|
228
|
-
if (Object.keys(sessionUpdates).length > 0) {
|
|
229
|
-
await parsedKeys.set({ session: sessionUpdates });
|
|
230
|
-
logger.debug({ migratedSessions: migratedCount }, 'bulk session migration complete');
|
|
231
|
-
// Cache device-level migrations
|
|
232
|
-
for (const op of migrationOps) {
|
|
233
|
-
if (sessionUpdates[op.toAddr.toString()]) {
|
|
234
|
-
const deviceKey = `${op.pnUser}.${op.deviceId}`;
|
|
235
|
-
migratedSessionCache.set(deviceKey, true);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
const skippedCount = totalOps - migratedCount;
|
|
240
|
-
return { migrated: migratedCount, skipped: skippedCount, total: totalOps };
|
|
241
|
-
}, `migrate-${deviceJids.length}-sessions-${jidDecode(toJid)?.user}`);
|
|
242
110
|
}
|
|
243
111
|
};
|
|
244
|
-
return repository;
|
|
245
112
|
}
|
|
246
113
|
const jidToSignalProtocolAddress = (jid) => {
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
if (!user) {
|
|
250
|
-
throw new Error(`JID decoded but user is empty: "${jid}" -> user: "${user}", server: "${server}", device: ${device}`);
|
|
251
|
-
}
|
|
252
|
-
const signalUser = domainType !== WAJIDDomains.WHATSAPP ? `${user}_${domainType}` : user;
|
|
253
|
-
const finalDevice = device || 0;
|
|
254
|
-
if (device === 99 && decoded.server !== 'hosted' && decoded.server !== 'hosted.lid') {
|
|
255
|
-
throw new Error('Unexpected non-hosted device JID with device 99. This ID seems invalid. ID:' + jid);
|
|
256
|
-
}
|
|
257
|
-
return new libsignal.ProtocolAddress(signalUser, finalDevice);
|
|
114
|
+
const { user, device } = (0, WABinary_1.jidDecode)(jid);
|
|
115
|
+
return new libsignal.ProtocolAddress(user, device || 0);
|
|
258
116
|
};
|
|
259
117
|
const jidToSignalSenderKeyName = (group, user) => {
|
|
260
|
-
return new SenderKeyName(group, jidToSignalProtocolAddress(user));
|
|
118
|
+
return new sender_key_name_1.SenderKeyName(group, jidToSignalProtocolAddress(user));
|
|
261
119
|
};
|
|
262
|
-
function signalStorage({ creds, keys }
|
|
263
|
-
// Shared function to resolve PN signal address to LID if mapping exists
|
|
264
|
-
const resolveLIDSignalAddress = async (id) => {
|
|
265
|
-
if (id.includes('.')) {
|
|
266
|
-
const [deviceId, device] = id.split('.');
|
|
267
|
-
const [user, domainType_] = deviceId.split('_');
|
|
268
|
-
const domainType = parseInt(domainType_ || '0');
|
|
269
|
-
if (domainType === WAJIDDomains.LID || domainType === WAJIDDomains.HOSTED_LID)
|
|
270
|
-
return id;
|
|
271
|
-
const pnJid = `${user}${device !== '0' ? `:${device}` : ''}@${domainType === WAJIDDomains.HOSTED ? 'hosted' : 's.whatsapp.net'}`;
|
|
272
|
-
const lidForPN = await lidMapping.getLIDForPN(pnJid);
|
|
273
|
-
if (lidForPN) {
|
|
274
|
-
const lidAddr = jidToSignalProtocolAddress(lidForPN);
|
|
275
|
-
return lidAddr.toString();
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
return id;
|
|
279
|
-
};
|
|
120
|
+
function signalStorage({ creds, keys }) {
|
|
280
121
|
return {
|
|
281
122
|
loadSession: async (id) => {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
if (sess) {
|
|
286
|
-
return libsignal.SessionRecord.deserialize(sess);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
catch (e) {
|
|
290
|
-
return null;
|
|
123
|
+
const { [id]: sess } = await keys.get('session', [id]);
|
|
124
|
+
if (sess) {
|
|
125
|
+
return libsignal.SessionRecord.deserialize(sess);
|
|
291
126
|
}
|
|
292
|
-
return null;
|
|
293
127
|
},
|
|
294
128
|
storeSession: async (id, session) => {
|
|
295
|
-
|
|
296
|
-
await keys.set({ session: { [wireJid]: session.serialize() } });
|
|
129
|
+
await keys.set({ session: { [id]: session.serialize() } });
|
|
297
130
|
},
|
|
298
131
|
isTrustedIdentity: () => {
|
|
299
|
-
return true;
|
|
132
|
+
return true;
|
|
300
133
|
},
|
|
301
134
|
loadPreKey: async (id) => {
|
|
302
135
|
const keyId = id.toString();
|
|
@@ -320,9 +153,9 @@ function signalStorage({ creds, keys }, lidMapping) {
|
|
|
320
153
|
const keyId = senderKeyName.toString();
|
|
321
154
|
const { [keyId]: key } = await keys.get('sender-key', [keyId]);
|
|
322
155
|
if (key) {
|
|
323
|
-
return SenderKeyRecord.deserialize(key);
|
|
156
|
+
return sender_key_record_1.SenderKeyRecord.deserialize(key);
|
|
324
157
|
}
|
|
325
|
-
return new SenderKeyRecord();
|
|
158
|
+
return new sender_key_record_1.SenderKeyRecord();
|
|
326
159
|
},
|
|
327
160
|
storeSenderKey: async (senderKeyName, key) => {
|
|
328
161
|
const keyId = senderKeyName.toString();
|
|
@@ -334,9 +167,8 @@ function signalStorage({ creds, keys }, lidMapping) {
|
|
|
334
167
|
const { signedIdentityKey } = creds;
|
|
335
168
|
return {
|
|
336
169
|
privKey: Buffer.from(signedIdentityKey.private),
|
|
337
|
-
pubKey:
|
|
170
|
+
pubKey: (0, Utils_1.generateSignalPubKey)(signedIdentityKey.public)
|
|
338
171
|
};
|
|
339
172
|
}
|
|
340
173
|
};
|
|
341
174
|
}
|
|
342
|
-
//# sourceMappingURL=libsignal.js.map
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
1
3
|
import { EventEmitter } from 'events';
|
|
2
4
|
import { URL } from 'url';
|
|
3
|
-
import
|
|
5
|
+
import { SocketConfig } from '../../Types';
|
|
4
6
|
export declare abstract class AbstractSocketClient extends EventEmitter {
|
|
5
7
|
url: URL;
|
|
6
8
|
config: SocketConfig;
|
|
@@ -13,4 +15,3 @@ export declare abstract class AbstractSocketClient extends EventEmitter {
|
|
|
13
15
|
abstract close(): Promise<void>;
|
|
14
16
|
abstract send(str: Uint8Array | string, cb?: (err?: Error) => void): boolean;
|
|
15
17
|
}
|
|
16
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AbstractSocketClient = void 0;
|
|
4
|
+
const events_1 = require("events");
|
|
5
|
+
class AbstractSocketClient extends events_1.EventEmitter {
|
|
6
|
+
constructor(url, config) {
|
|
7
|
+
super();
|
|
8
|
+
this.url = url;
|
|
9
|
+
this.config = config;
|
|
10
|
+
this.setMaxListeners(0);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.AbstractSocketClient = AbstractSocketClient;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
|
|
1
|
+
export * from './abstract-socket-client';
|
|
2
|
+
export * from './mobile-socket-client';
|
|
3
|
+
export * from './web-socket-client';
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./abstract-socket-client"), exports);
|
|
18
|
+
__exportStar(require("./mobile-socket-client"), exports);
|
|
19
|
+
__exportStar(require("./web-socket-client"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Socket } from 'net';
|
|
3
|
+
import { AbstractSocketClient } from './abstract-socket-client';
|
|
4
|
+
export declare class MobileSocketClient extends AbstractSocketClient {
|
|
5
|
+
protected socket: Socket | null;
|
|
6
|
+
get isOpen(): boolean;
|
|
7
|
+
get isClosed(): boolean;
|
|
8
|
+
get isClosing(): boolean;
|
|
9
|
+
get isConnecting(): boolean;
|
|
10
|
+
connect(): Promise<void>;
|
|
11
|
+
close(): Promise<void>;
|
|
12
|
+
send(str: string | Uint8Array, cb?: (err?: Error) => void): boolean;
|
|
13
|
+
}
|