@queenanya/baileys 8.3.1 → 8.3.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.
Files changed (91) hide show
  1. package/lib/Defaults/index.d.ts +0 -231
  2. package/lib/Defaults/index.js +1 -17
  3. package/lib/Signal/Group/ciphertext-message.d.ts +9 -0
  4. package/lib/Signal/Group/ciphertext-message.js +15 -0
  5. package/lib/Signal/Group/group-session-builder.d.ts +14 -0
  6. package/lib/Signal/Group/group-session-builder.js +64 -0
  7. package/lib/Signal/Group/group_cipher.d.ts +17 -0
  8. package/lib/Signal/Group/group_cipher.js +96 -0
  9. package/lib/Signal/Group/index.d.ts +11 -0
  10. package/lib/Signal/Group/index.js +57 -0
  11. package/lib/Signal/Group/keyhelper.d.ts +10 -0
  12. package/lib/Signal/Group/keyhelper.js +55 -0
  13. package/lib/Signal/Group/queue-job.d.ts +1 -0
  14. package/lib/Signal/Group/queue-job.js +57 -0
  15. package/lib/Signal/Group/sender-chain-key.d.ts +13 -0
  16. package/lib/Signal/Group/sender-chain-key.js +34 -0
  17. package/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -0
  18. package/lib/Signal/Group/sender-key-distribution-message.js +66 -0
  19. package/lib/Signal/Group/sender-key-message.d.ts +18 -0
  20. package/lib/Signal/Group/sender-key-message.js +69 -0
  21. package/lib/Signal/Group/sender-key-name.d.ts +17 -0
  22. package/lib/Signal/Group/sender-key-name.js +51 -0
  23. package/lib/Signal/Group/sender-key-record.d.ts +30 -0
  24. package/lib/Signal/Group/sender-key-record.js +53 -0
  25. package/lib/Signal/Group/sender-key-state.d.ts +38 -0
  26. package/lib/Signal/Group/sender-key-state.js +99 -0
  27. package/lib/Signal/Group/sender-message-key.d.ts +11 -0
  28. package/{WASignalGroup/sender_message_key.js → lib/Signal/Group/sender-message-key.js} +6 -16
  29. package/lib/Signal/libsignal.js +33 -20
  30. package/lib/Socket/Client/index.d.ts +2 -3
  31. package/lib/Socket/Client/index.js +2 -3
  32. package/lib/Socket/Client/{abstract-socket-client.d.ts → types.d.ts} +1 -0
  33. package/lib/Socket/Client/{web-socket-client.d.ts → websocket.d.ts} +2 -1
  34. package/lib/Socket/Client/{web-socket-client.js → websocket.js} +12 -2
  35. package/lib/Socket/business.d.ts +3 -3
  36. package/lib/Socket/chat-set.d.ts +3 -0
  37. package/lib/Socket/chat-set.js +63 -0
  38. package/lib/Socket/chats.d.ts +1 -1
  39. package/lib/Socket/chats.js +11 -8
  40. package/lib/Socket/groups.d.ts +1 -1
  41. package/lib/Socket/index.d.ts +3 -5
  42. package/lib/Socket/index.js +2 -2
  43. package/lib/Socket/messages-recv.d.ts +3 -3
  44. package/lib/Socket/messages-recv.js +16 -8
  45. package/lib/Socket/messages-send.d.ts +2 -2
  46. package/lib/Socket/messages-send.js +75 -9
  47. package/lib/Socket/newsletter.d.ts +1 -1
  48. package/lib/Socket/socket.d.ts +2 -1
  49. package/lib/Socket/socket.js +71 -14
  50. package/lib/Socket/usync.d.ts +1 -1
  51. package/lib/Store/make-in-memory-store.js +8 -10
  52. package/lib/Types/Auth.d.ts +0 -6
  53. package/lib/Types/Message.d.ts +16 -3
  54. package/lib/Types/Socket.d.ts +3 -3
  55. package/lib/Utils/auth-utils.js +0 -7
  56. package/lib/Utils/event-buffer.js +4 -6
  57. package/lib/Utils/index.d.ts +1 -0
  58. package/lib/Utils/index.js +1 -0
  59. package/lib/Utils/messages-media.js +11 -10
  60. package/lib/Utils/messages.js +10 -2
  61. package/lib/Utils/midea-msg.d.ts +14 -0
  62. package/lib/Utils/midea-msg.js +72 -0
  63. package/lib/Utils/noise-handler.d.ts +1 -2
  64. package/lib/Utils/noise-handler.js +5 -10
  65. package/lib/Utils/use-single-file-auth-state.d.ts +5 -0
  66. package/lib/Utils/use-single-file-auth-state.js +66 -0
  67. package/lib/Utils/validate-connection.d.ts +0 -1
  68. package/lib/Utils/validate-connection.js +10 -44
  69. package/lib/WABinary/jid-utils.d.ts +1 -1
  70. package/lib/WABinary/jid-utils.js +1 -1
  71. package/package.json +2 -1
  72. package/WASignalGroup/GroupProtocol.js +0 -1697
  73. package/WASignalGroup/ciphertext_message.js +0 -16
  74. package/WASignalGroup/group_cipher.js +0 -120
  75. package/WASignalGroup/group_session_builder.js +0 -46
  76. package/WASignalGroup/index.js +0 -5
  77. package/WASignalGroup/keyhelper.js +0 -21
  78. package/WASignalGroup/protobufs.js +0 -3
  79. package/WASignalGroup/queue_job.js +0 -69
  80. package/WASignalGroup/sender_chain_key.js +0 -50
  81. package/WASignalGroup/sender_key_distribution_message.js +0 -78
  82. package/WASignalGroup/sender_key_message.js +0 -92
  83. package/WASignalGroup/sender_key_name.js +0 -70
  84. package/WASignalGroup/sender_key_record.js +0 -56
  85. package/WASignalGroup/sender_key_state.js +0 -129
  86. package/lib/Defaults/phonenumber-mcc.json +0 -223
  87. package/lib/Socket/Client/mobile-socket-client.d.ts +0 -12
  88. package/lib/Socket/Client/mobile-socket-client.js +0 -65
  89. package/lib/Socket/registration.d.ts +0 -266
  90. package/lib/Socket/registration.js +0 -166
  91. /package/lib/Socket/Client/{abstract-socket-client.js → types.js} +0 -0
@@ -1,129 +0,0 @@
1
- const SenderChainKey = require('./sender_chain_key');
2
- const SenderMessageKey = require('./sender_message_key');
3
-
4
- const protobufs = require('./protobufs');
5
-
6
- class SenderKeyState {
7
- MAX_MESSAGE_KEYS = 2000;
8
-
9
- constructor(
10
- id = null,
11
- iteration = null,
12
- chainKey = null,
13
- signatureKeyPair = null,
14
- signatureKeyPublic = null,
15
- signatureKeyPrivate = null,
16
- senderKeyStateStructure = null
17
- ) {
18
- if (senderKeyStateStructure) {
19
- this.senderKeyStateStructure = senderKeyStateStructure;
20
- } else {
21
- if (signatureKeyPair) {
22
- signatureKeyPublic = signatureKeyPair.public;
23
- signatureKeyPrivate = signatureKeyPair.private;
24
- }
25
-
26
- chainKey = typeof chainKey === 'string' ? Buffer.from(chainKey, 'base64') : chainKey;
27
- this.senderKeyStateStructure = protobufs.SenderKeyStateStructure.create();
28
- const senderChainKeyStructure = protobufs.SenderChainKey.create();
29
- senderChainKeyStructure.iteration = iteration;
30
- senderChainKeyStructure.seed = chainKey;
31
- this.senderKeyStateStructure.senderChainKey = senderChainKeyStructure;
32
-
33
- const signingKeyStructure = protobufs.SenderSigningKey.create();
34
- signingKeyStructure.public =
35
- typeof signatureKeyPublic === 'string' ?
36
- Buffer.from(signatureKeyPublic, 'base64') :
37
- signatureKeyPublic;
38
- if (signatureKeyPrivate) {
39
- signingKeyStructure.private =
40
- typeof signatureKeyPrivate === 'string' ?
41
- Buffer.from(signatureKeyPrivate, 'base64') :
42
- signatureKeyPrivate;
43
- }
44
- this.senderKeyStateStructure.senderKeyId = id;
45
- this.senderChainKey = senderChainKeyStructure;
46
- this.senderKeyStateStructure.senderSigningKey = signingKeyStructure;
47
- }
48
- this.senderKeyStateStructure.senderMessageKeys =
49
- this.senderKeyStateStructure.senderMessageKeys || [];
50
- }
51
-
52
- SenderKeyState(senderKeyStateStructure) {
53
- this.senderKeyStateStructure = senderKeyStateStructure;
54
- }
55
-
56
- getKeyId() {
57
- return this.senderKeyStateStructure.senderKeyId;
58
- }
59
-
60
- getSenderChainKey() {
61
- return new SenderChainKey(
62
- this.senderKeyStateStructure.senderChainKey.iteration,
63
- this.senderKeyStateStructure.senderChainKey.seed
64
- );
65
- }
66
-
67
- setSenderChainKey(chainKey) {
68
- const senderChainKeyStructure = protobufs.SenderChainKey.create({
69
- iteration: chainKey.getIteration(),
70
- seed: chainKey.getSeed(),
71
- });
72
- this.senderKeyStateStructure.senderChainKey = senderChainKeyStructure;
73
- }
74
-
75
- getSigningKeyPublic() {
76
- return typeof this.senderKeyStateStructure.senderSigningKey.public === 'string' ?
77
- Buffer.from(this.senderKeyStateStructure.senderSigningKey.public, 'base64') :
78
- this.senderKeyStateStructure.senderSigningKey.public;
79
- }
80
-
81
- getSigningKeyPrivate() {
82
- return typeof this.senderKeyStateStructure.senderSigningKey.private === 'string' ?
83
- Buffer.from(this.senderKeyStateStructure.senderSigningKey.private, 'base64') :
84
- this.senderKeyStateStructure.senderSigningKey.private;
85
- }
86
-
87
- hasSenderMessageKey(iteration) {
88
- const list = this.senderKeyStateStructure.senderMessageKeys;
89
- for (let o = 0; o < list.length; o++) {
90
- const senderMessageKey = list[o];
91
- if (senderMessageKey.iteration === iteration) return true;
92
- }
93
- return false;
94
- }
95
-
96
- addSenderMessageKey(senderMessageKey) {
97
- const senderMessageKeyStructure = protobufs.SenderKeyStateStructure.create({
98
- iteration: senderMessageKey.getIteration(),
99
- seed: senderMessageKey.getSeed(),
100
- });
101
- this.senderKeyStateStructure.senderMessageKeys.push(senderMessageKeyStructure);
102
-
103
- if (this.senderKeyStateStructure.senderMessageKeys.length > this.MAX_MESSAGE_KEYS) {
104
- this.senderKeyStateStructure.senderMessageKeys.shift();
105
- }
106
- }
107
-
108
- removeSenderMessageKey(iteration) {
109
- let result = null;
110
-
111
- this.senderKeyStateStructure.senderMessageKeys = this.senderKeyStateStructure.senderMessageKeys.filter(
112
- senderMessageKey => {
113
- if (senderMessageKey.iteration === iteration) result = senderMessageKey;
114
- return senderMessageKey.iteration !== iteration;
115
- }
116
- );
117
-
118
- if (result != null) {
119
- return new SenderMessageKey(result.iteration, result.seed);
120
- }
121
- return null;
122
- }
123
-
124
- getStructure() {
125
- return this.senderKeyStateStructure;
126
- }
127
- }
128
-
129
- module.exports = SenderKeyState;
@@ -1,223 +0,0 @@
1
- {
2
- "93": 412,
3
- "355": 276,
4
- "213": 603,
5
- "1-684": 544,
6
- "376": 213,
7
- "244": 631,
8
- "1-264": 365,
9
- "1-268": 344,
10
- "54": 722,
11
- "374": 283,
12
- "297": 363,
13
- "61": 505,
14
- "43": 232,
15
- "994": 400,
16
- "1-242": 364,
17
- "973": 426,
18
- "880": 470,
19
- "1-246": 342,
20
- "375": 257,
21
- "32": 206,
22
- "501": 702,
23
- "229": 616,
24
- "1-441": 350,
25
- "975": 402,
26
- "591": 736,
27
- "387": 218,
28
- "267": 652,
29
- "55": 724,
30
- "1-284": 348,
31
- "673": 528,
32
- "359": 284,
33
- "226": 613,
34
- "257": 642,
35
- "855": 456,
36
- "237": 624,
37
- "238": 625,
38
- "1-345": 346,
39
- "236": 623,
40
- "235": 622,
41
- "56": 730,
42
- "86": 454,
43
- "57": 732,
44
- "269": 654,
45
- "682": 548,
46
- "506": 712,
47
- "385": 219,
48
- "53": 368,
49
- "357": 280,
50
- "420": 230,
51
- "243": 630,
52
- "45": 238,
53
- "253": 638,
54
- "1-767": 366,
55
- "1-809": 370,
56
- "1-849": 370,
57
- "1-829": 370,
58
- "593": 740,
59
- "20": 602,
60
- "503": 706,
61
- "240": 627,
62
- "291": 657,
63
- "372": 248,
64
- "251": 636,
65
- "500": 750,
66
- "298": 288,
67
- "679": 542,
68
- "358": 244,
69
- "33": 208,
70
- "689": 547,
71
- "241": 628,
72
- "220": 607,
73
- "995": 282,
74
- "49": 262,
75
- "233": 620,
76
- "350": 266,
77
- "30": 202,
78
- "299": 290,
79
- "1-473": 352,
80
- "1-671": 535,
81
- "502": 704,
82
- "224": 537,
83
- "592": 738,
84
- "509": 372,
85
- "504": 708,
86
- "852": 454,
87
- "36": 216,
88
- "354": 274,
89
- "91": 404,
90
- "62": 510,
91
- "98": 432,
92
- "964": 418,
93
- "353": 234,
94
- "972": 425,
95
- "39": 222,
96
- "225": 612,
97
- "1-876": 338,
98
- "81": 440,
99
- "962": 416,
100
- "254": 639,
101
- "686": 545,
102
- "383": 221,
103
- "965": 419,
104
- "371": 247,
105
- "961": 415,
106
- "266": 651,
107
- "231": 618,
108
- "218": 606,
109
- "423": 295,
110
- "370": 246,
111
- "352": 270,
112
- "389": 294,
113
- "261": 646,
114
- "265": 650,
115
- "60": 502,
116
- "960": 472,
117
- "223": 610,
118
- "356": 278,
119
- "692": 551,
120
- "222": 609,
121
- "230": 617,
122
- "52": 334,
123
- "691": 550,
124
- "373": 259,
125
- "377": 212,
126
- "976": 428,
127
- "382": 297,
128
- "1-664": 354,
129
- "212": 604,
130
- "258": 643,
131
- "95": 414,
132
- "264": 649,
133
- "674": 536,
134
- "977": 429,
135
- "31": 204,
136
- "687": 546,
137
- "64": 530,
138
- "505": 710,
139
- "227": 614,
140
- "234": 621,
141
- "683": 555,
142
- "1-670": 534,
143
- "47": 242,
144
- "968": 226,
145
- "92": 410,
146
- "680": 552,
147
- "970": 423,
148
- "507": 714,
149
- "675": 537,
150
- "595": 744,
151
- "51": 716,
152
- "63": 515,
153
- "48": 260,
154
- "351": 268,
155
- "1-787, 1-939": 330,
156
- "974": 427,
157
- "242": 630,
158
- "40": 226,
159
- "7": 250,
160
- "250": 635,
161
- "290": 658,
162
- "1-869": 356,
163
- "1-758": 358,
164
- "508": 308,
165
- "1-784": 360,
166
- "685": 544,
167
- "378": 292,
168
- "239": 626,
169
- "966": 420,
170
- "221": 608,
171
- "381": 220,
172
- "248": 633,
173
- "232": 619,
174
- "65": 525,
175
- "386": 293,
176
- "677": 540,
177
- "27": 655,
178
- "211": 659,
179
- "34": 214,
180
- "94": 413,
181
- "249": 634,
182
- "597": 746,
183
- "268": 653,
184
- "46": 240,
185
- "41": 228,
186
- "963": 417,
187
- "886": 466,
188
- "992": 436,
189
- "255": 640,
190
- "66": 520,
191
- "228": 615,
192
- "690": 554,
193
- "676": 539,
194
- "1-868": 374,
195
- "216": 605,
196
- "90": 286,
197
- "993": 438,
198
- "1-649": 376,
199
- "688": 553,
200
- "1-340": 332,
201
- "256": 641,
202
- "380": 255,
203
- "971": 424,
204
- "44": 234,
205
- "1": 310,
206
- "598": 748,
207
- "998": 434,
208
- "678": 541,
209
- "379": 225,
210
- "58": 734,
211
- "681": 543,
212
- "967": 421,
213
- "260": 645,
214
- "263": 648,
215
- "670": 514,
216
- "245": 632,
217
- "856": 457,
218
- "599": 362,
219
- "850": 467,
220
- "262": 647,
221
- "82": 450,
222
- "84": 452
223
- }
@@ -1,12 +0,0 @@
1
- import { Socket } from 'net';
2
- import { AbstractSocketClient } from './abstract-socket-client';
3
- export declare class MobileSocketClient extends AbstractSocketClient {
4
- protected socket: Socket | null;
5
- get isOpen(): boolean;
6
- get isClosed(): boolean;
7
- get isClosing(): boolean;
8
- get isConnecting(): boolean;
9
- connect(): Promise<void>;
10
- close(): Promise<void>;
11
- send(str: string | Uint8Array, cb?: (err?: Error) => void): boolean;
12
- }
@@ -1,65 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MobileSocketClient = void 0;
4
- const net_1 = require("net");
5
- const abstract_socket_client_1 = require("./abstract-socket-client");
6
- class MobileSocketClient extends abstract_socket_client_1.AbstractSocketClient {
7
- constructor() {
8
- super(...arguments);
9
- this.socket = null;
10
- }
11
- get isOpen() {
12
- var _a;
13
- return ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === 'open';
14
- }
15
- get isClosed() {
16
- var _a;
17
- return this.socket === null || ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === 'closed';
18
- }
19
- get isClosing() {
20
- var _a;
21
- return this.socket === null || ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === 'closed';
22
- }
23
- get isConnecting() {
24
- var _a;
25
- return ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === 'opening';
26
- }
27
- async connect() {
28
- var _a;
29
- if (this.socket) {
30
- return;
31
- }
32
- if (this.config.agent) {
33
- throw new Error('There are not support for proxy agent for mobile connection');
34
- }
35
- else {
36
- this.socket = (0, net_1.connect)({
37
- host: this.url.hostname,
38
- port: Number(this.url.port) || 443
39
- });
40
- }
41
- this.socket.setMaxListeners(0);
42
- const events = ['close', 'connect', 'data', 'drain', 'end', 'error', 'lookup', 'ready', 'timeout'];
43
- for (const event of events) {
44
- (_a = this.socket) === null || _a === void 0 ? void 0 : _a.on(event, (...args) => this.emit(event, ...args));
45
- }
46
- this.socket.on('data', (...args) => this.emit('message', ...args));
47
- this.socket.on('ready', (...args) => this.emit('open', ...args));
48
- }
49
- async close() {
50
- if (!this.socket) {
51
- return;
52
- }
53
- return new Promise(resolve => {
54
- this.socket.end(resolve);
55
- this.socket = null;
56
- });
57
- }
58
- send(str, cb) {
59
- if (this.socket === null) {
60
- return false;
61
- }
62
- return this.socket.write(str, undefined, cb);
63
- }
64
- }
65
- exports.MobileSocketClient = MobileSocketClient;