cuki-bailx 1.2.5 → 1.2.6
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 +21 -0
- package/WAProto/GenerateStatics.sh +4 -0
- package/WAProto/WAProto.proto +4775 -0
- package/WAProto/index.js +56886 -17506
- package/engine-requirements.js +1 -1
- package/lib/Defaults/index.js +98 -108
- package/lib/Defaults/vyzen-baileysx-version.json +3 -0
- package/lib/Signal/libsignal.js +2 -0
- package/lib/Socket/Client/index.js +2 -3
- package/lib/Socket/Client/{web-socket-client.js → websocket.js} +54 -5
- package/lib/Socket/chats.js +224 -173
- package/lib/Socket/groups.js +20 -5
- package/lib/Socket/index.js +2 -2
- package/lib/Socket/messages-recv.js +10 -66
- package/lib/Socket/messages-send.js +379 -312
- package/lib/Socket/newsletter.js +54 -40
- package/lib/Socket/socket.js +58 -32
- package/lib/Store/index.js +1 -3
- package/lib/Store/make-in-memory-store.js +27 -15
- package/lib/Store/make-ordered-dictionary.js +2 -2
- package/lib/Types/Label.js +1 -1
- package/lib/Types/LabelAssociation.js +1 -1
- package/lib/Types/Message.js +0 -2
- package/lib/Types/Newsletter.js +3 -17
- package/lib/Types/index.js +2 -2
- package/lib/Utils/auth-utils.js +6 -13
- package/lib/Utils/baileys-event-stream.js +1 -1
- package/lib/Utils/browser-utils.js +35 -0
- package/lib/Utils/business.js +2 -2
- package/lib/Utils/chat-utils.js +36 -35
- package/lib/Utils/crypto.js +71 -29
- package/lib/Utils/decode-wa-message.js +65 -56
- package/lib/Utils/event-buffer.js +13 -9
- package/lib/Utils/generics.js +107 -29
- package/lib/Utils/history.js +4 -6
- package/lib/Utils/index.js +2 -0
- package/lib/Utils/link-preview.js +34 -1
- package/lib/Utils/lt-hash.js +6 -6
- package/lib/Utils/message-retry-manager.js +128 -0
- package/lib/Utils/messages-media.js +263 -115
- package/lib/Utils/messages.js +500 -93
- package/lib/Utils/noise-handler.js +18 -23
- package/lib/Utils/process-message.js +108 -25
- package/lib/Utils/signal.js +37 -35
- package/lib/Utils/use-multi-file-auth-state.js +51 -6
- package/lib/Utils/validate-connection.js +90 -66
- package/lib/WABinary/constants.js +1276 -13
- package/lib/WABinary/decode.js +26 -13
- package/lib/WABinary/encode.js +39 -17
- package/lib/WABinary/generic-utils.js +2 -85
- package/lib/WABinary/jid-utils.js +28 -5
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +1 -1
- package/lib/index.js +18 -5
- package/package.json +109 -104
- package/lib/Defaults/baileys-version.json +0 -3
- package/lib/Defaults/index.d.ts +0 -53
- package/lib/Defaults/phonenumber-mcc.json +0 -223
- package/lib/Signal/Group/ciphertext-message.d.ts +0 -9
- package/lib/Signal/Group/group-session-builder.d.ts +0 -14
- package/lib/Signal/Group/group_cipher.d.ts +0 -17
- package/lib/Signal/Group/index.d.ts +0 -11
- package/lib/Signal/Group/keyhelper.d.ts +0 -10
- package/lib/Signal/Group/queue-job.d.ts +0 -1
- package/lib/Signal/Group/sender-chain-key.d.ts +0 -13
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -16
- package/lib/Signal/Group/sender-key-message.d.ts +0 -18
- package/lib/Signal/Group/sender-key-name.d.ts +0 -17
- package/lib/Signal/Group/sender-key-record.d.ts +0 -30
- package/lib/Signal/Group/sender-key-state.d.ts +0 -38
- package/lib/Signal/Group/sender-message-key.d.ts +0 -11
- package/lib/Signal/libsignal.d.ts +0 -3
- package/lib/Socket/Client/abstract-socket-client.d.ts +0 -17
- package/lib/Socket/Client/index.d.ts +0 -3
- package/lib/Socket/Client/mobile-socket-client.d.ts +0 -13
- package/lib/Socket/Client/mobile-socket-client.js +0 -65
- package/lib/Socket/Client/web-socket-client.d.ts +0 -12
- package/lib/Socket/business.d.ts +0 -171
- package/lib/Socket/chats.d.ts +0 -80
- package/lib/Socket/dugong.d.ts +0 -219
- package/lib/Socket/dugong.js +0 -441
- package/lib/Socket/groups.d.ts +0 -115
- package/lib/Socket/index.d.ts +0 -173
- package/lib/Socket/messages-recv.d.ts +0 -161
- package/lib/Socket/messages-send.d.ts +0 -149
- package/lib/Socket/newsletter.d.ts +0 -134
- package/lib/Socket/registration.d.ts +0 -267
- package/lib/Socket/registration.js +0 -166
- package/lib/Socket/socket.d.ts +0 -43
- package/lib/Socket/socket.js.bak +0 -630
- package/lib/Socket/usync.d.ts +0 -36
- package/lib/Store/index.d.ts +0 -3
- package/lib/Store/make-cache-manager-store.d.ts +0 -13
- package/lib/Store/make-cache-manager-store.js +0 -83
- package/lib/Store/make-in-memory-store.d.ts +0 -118
- package/lib/Store/make-ordered-dictionary.d.ts +0 -13
- package/lib/Store/object-repository.d.ts +0 -10
- package/lib/Types/Auth.d.ts +0 -110
- package/lib/Types/Call.d.ts +0 -13
- package/lib/Types/Chat.d.ts +0 -102
- package/lib/Types/Contact.d.ts +0 -19
- package/lib/Types/Events.d.ts +0 -157
- package/lib/Types/GroupMetadata.d.ts +0 -55
- package/lib/Types/Label.d.ts +0 -35
- package/lib/Types/LabelAssociation.d.ts +0 -29
- package/lib/Types/Message.d.ts +0 -273
- package/lib/Types/Newsletter.d.ts +0 -92
- package/lib/Types/Product.d.ts +0 -78
- package/lib/Types/Signal.d.ts +0 -57
- package/lib/Types/Socket.d.ts +0 -111
- package/lib/Types/State.d.ts +0 -27
- package/lib/Types/USync.d.ts +0 -25
- package/lib/Types/index.d.ts +0 -57
- package/lib/Utils/auth-utils.d.ts +0 -18
- package/lib/Utils/baileys-event-stream.d.ts +0 -16
- package/lib/Utils/business.d.ts +0 -22
- package/lib/Utils/chat-utils.d.ts +0 -71
- package/lib/Utils/crypto.d.ts +0 -41
- package/lib/Utils/decode-wa-message.d.ts +0 -19
- package/lib/Utils/event-buffer.d.ts +0 -35
- package/lib/Utils/generics.d.ts +0 -92
- package/lib/Utils/history.d.ts +0 -15
- package/lib/Utils/index.d.ts +0 -17
- package/lib/Utils/link-preview.d.ts +0 -21
- package/lib/Utils/logger.d.ts +0 -4
- package/lib/Utils/lt-hash.d.ts +0 -12
- package/lib/Utils/make-mutex.d.ts +0 -7
- package/lib/Utils/messages-media.d.ts +0 -116
- package/lib/Utils/messages.d.ts +0 -77
- package/lib/Utils/noise-handler.d.ts +0 -21
- package/lib/Utils/process-message.d.ts +0 -41
- package/lib/Utils/signal.d.ts +0 -32
- package/lib/Utils/use-multi-file-auth-state.d.ts +0 -13
- package/lib/Utils/validate-connection.d.ts +0 -11
- package/lib/WABinary/constants.d.ts +0 -27
- package/lib/WABinary/decode.d.ts +0 -7
- package/lib/WABinary/encode.d.ts +0 -3
- package/lib/WABinary/generic-utils.d.ts +0 -16
- package/lib/WABinary/index.d.ts +0 -5
- package/lib/WABinary/jid-utils.d.ts +0 -31
- package/lib/WABinary/types.d.ts +0 -18
- package/lib/WAM/BinaryInfo.d.ts +0 -17
- package/lib/WAM/constants.d.ts +0 -38
- package/lib/WAM/encode.d.ts +0 -3
- package/lib/WAM/index.d.ts +0 -3
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -9
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -22
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -12
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -12
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +0 -25
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +0 -8
- package/lib/WAUSync/Protocols/index.d.ts +0 -4
- package/lib/WAUSync/USyncQuery.d.ts +0 -28
- package/lib/WAUSync/USyncUser.d.ts +0 -12
- package/lib/WAUSync/index.d.ts +0 -3
- package/lib/index.d.ts +0 -12
- package/lib/index.js.bak +0 -48
- /package/lib/Socket/Client/{abstract-socket-client.js → types.js} +0 -0
package/lib/Defaults/index.d.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import { proto } from '../../WAProto';
|
|
4
|
-
import type { MediaType, SocketConfig } from '../Types';
|
|
5
|
-
export declare const UNAUTHORIZED_CODES: number[];
|
|
6
|
-
export declare const DEFAULT_ORIGIN = "https://web.whatsapp.com";
|
|
7
|
-
export declare const DEF_CALLBACK_PREFIX = "CB:";
|
|
8
|
-
export declare const DEF_TAG_PREFIX = "TAG:";
|
|
9
|
-
export declare const PHONE_CONNECTION_CB = "CB:Pong";
|
|
10
|
-
export declare const WA_DEFAULT_EPHEMERAL: number;
|
|
11
|
-
export declare const NOISE_MODE = "Noise_XX_25519_AESGCM_SHA256\0\0\0\0";
|
|
12
|
-
export declare const DICT_VERSION = 2;
|
|
13
|
-
export declare const KEY_BUNDLE_TYPE: Buffer;
|
|
14
|
-
export declare const NOISE_WA_HEADER: Buffer;
|
|
15
|
-
/** from: https://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url */
|
|
16
|
-
export declare const URL_REGEX: RegExp;
|
|
17
|
-
export declare const WA_CERT_DETAILS: {
|
|
18
|
-
SERIAL: number;
|
|
19
|
-
};
|
|
20
|
-
export declare const PROCESSABLE_HISTORY_TYPES: proto.Message.HistorySyncNotification.HistorySyncType[];
|
|
21
|
-
export declare const DEFAULT_CONNECTION_CONFIG: SocketConfig;
|
|
22
|
-
export declare const MEDIA_PATH_MAP: {
|
|
23
|
-
[T in MediaType]?: string;
|
|
24
|
-
};
|
|
25
|
-
export declare const MEDIA_HKDF_KEY_MAPPING: {
|
|
26
|
-
audio: string;
|
|
27
|
-
document: string;
|
|
28
|
-
gif: string;
|
|
29
|
-
image: string;
|
|
30
|
-
ppic: string;
|
|
31
|
-
product: string;
|
|
32
|
-
ptt: string;
|
|
33
|
-
sticker: string;
|
|
34
|
-
video: string;
|
|
35
|
-
'thumbnail-document': string;
|
|
36
|
-
'thumbnail-image': string;
|
|
37
|
-
'thumbnail-video': string;
|
|
38
|
-
'thumbnail-link': string;
|
|
39
|
-
'md-msg-hist': string;
|
|
40
|
-
'md-app-state': string;
|
|
41
|
-
'product-catalog-image': string;
|
|
42
|
-
'payment-bg-image': string;
|
|
43
|
-
ptv: string;
|
|
44
|
-
};
|
|
45
|
-
export declare const MEDIA_KEYS: ("ppic" | "product" | "image" | "video" | "sticker" | "audio" | "gif" | "ptt" | "thumbnail-document" | "thumbnail-image" | "thumbnail-link" | "thumbnail-video" | "md-app-state" | "md-msg-hist" | "document" | "product-catalog-image" | "payment-bg-image" | "ptv")[];
|
|
46
|
-
export declare const MIN_PREKEY_COUNT = 5;
|
|
47
|
-
export declare const INITIAL_PREKEY_COUNT = 30;
|
|
48
|
-
export declare const DEFAULT_CACHE_TTLS: {
|
|
49
|
-
SIGNAL_STORE: number;
|
|
50
|
-
MSG_RETRY: number;
|
|
51
|
-
CALL_OFFER: number;
|
|
52
|
-
USER_DEVICES: number;
|
|
53
|
-
};
|
|
@@ -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,9 +0,0 @@
|
|
|
1
|
-
export declare class CiphertextMessage {
|
|
2
|
-
readonly UNSUPPORTED_VERSION: number;
|
|
3
|
-
readonly CURRENT_VERSION: number;
|
|
4
|
-
readonly WHISPER_TYPE: number;
|
|
5
|
-
readonly PREKEY_TYPE: number;
|
|
6
|
-
readonly SENDERKEY_TYPE: number;
|
|
7
|
-
readonly SENDERKEY_DISTRIBUTION_TYPE: number;
|
|
8
|
-
readonly ENCRYPTED_MESSAGE_OVERHEAD: number;
|
|
9
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { SenderKeyDistributionMessage } from './sender-key-distribution-message';
|
|
2
|
-
import { SenderKeyName } from './sender-key-name';
|
|
3
|
-
import { SenderKeyRecord } from './sender-key-record';
|
|
4
|
-
interface SenderKeyStore {
|
|
5
|
-
loadSenderKey(senderKeyName: SenderKeyName): Promise<SenderKeyRecord>;
|
|
6
|
-
storeSenderKey(senderKeyName: SenderKeyName, record: SenderKeyRecord): Promise<void>;
|
|
7
|
-
}
|
|
8
|
-
export declare class GroupSessionBuilder {
|
|
9
|
-
private readonly senderKeyStore;
|
|
10
|
-
constructor(senderKeyStore: SenderKeyStore);
|
|
11
|
-
process(senderKeyName: SenderKeyName, senderKeyDistributionMessage: SenderKeyDistributionMessage): Promise<void>;
|
|
12
|
-
create(senderKeyName: SenderKeyName): Promise<SenderKeyDistributionMessage>;
|
|
13
|
-
}
|
|
14
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { SenderKeyName } from './sender-key-name';
|
|
2
|
-
import { SenderKeyRecord } from './sender-key-record';
|
|
3
|
-
export interface SenderKeyStore {
|
|
4
|
-
loadSenderKey(senderKeyName: SenderKeyName): Promise<SenderKeyRecord>;
|
|
5
|
-
storeSenderKey(senderKeyName: SenderKeyName, record: SenderKeyRecord): Promise<void>;
|
|
6
|
-
}
|
|
7
|
-
export declare class GroupCipher {
|
|
8
|
-
private readonly senderKeyStore;
|
|
9
|
-
private readonly senderKeyName;
|
|
10
|
-
constructor(senderKeyStore: SenderKeyStore, senderKeyName: SenderKeyName);
|
|
11
|
-
private queueJob;
|
|
12
|
-
encrypt(paddedPlaintext: Uint8Array | string): Promise<Uint8Array>;
|
|
13
|
-
decrypt(senderKeyMessageBytes: Uint8Array): Promise<Uint8Array>;
|
|
14
|
-
private getSenderKey;
|
|
15
|
-
private getPlainText;
|
|
16
|
-
private getCipherText;
|
|
17
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export { GroupSessionBuilder } from './group-session-builder';
|
|
2
|
-
export { SenderKeyDistributionMessage } from './sender-key-distribution-message';
|
|
3
|
-
export { SenderKeyRecord } from './sender-key-record';
|
|
4
|
-
export { SenderKeyName } from './sender-key-name';
|
|
5
|
-
export { GroupCipher } from './group_cipher';
|
|
6
|
-
export { SenderKeyState } from './sender-key-state';
|
|
7
|
-
export { SenderKeyMessage } from './sender-key-message';
|
|
8
|
-
export { SenderMessageKey } from './sender-message-key';
|
|
9
|
-
export { SenderChainKey } from './sender-chain-key';
|
|
10
|
-
export { CiphertextMessage } from './ciphertext-message';
|
|
11
|
-
export * as keyhelper from './keyhelper';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { generateKeyPair } from 'libsignal/src/curve';
|
|
2
|
-
type KeyPairType = ReturnType<typeof generateKeyPair>;
|
|
3
|
-
export declare function generateSenderKey(): Buffer;
|
|
4
|
-
export declare function generateSenderKeyId(): number;
|
|
5
|
-
export interface SigningKeyPair {
|
|
6
|
-
public: Buffer;
|
|
7
|
-
private: Buffer;
|
|
8
|
-
}
|
|
9
|
-
export declare function generateSenderSigningKey(key?: KeyPairType): SigningKeyPair;
|
|
10
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function queueJob<T>(bucket: string | number, awaitable: () => Promise<T>): Promise<T>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { SenderMessageKey } from './sender-message-key';
|
|
2
|
-
export declare class SenderChainKey {
|
|
3
|
-
private readonly MESSAGE_KEY_SEED;
|
|
4
|
-
private readonly CHAIN_KEY_SEED;
|
|
5
|
-
private readonly iteration;
|
|
6
|
-
private readonly chainKey;
|
|
7
|
-
constructor(iteration: number, chainKey: any);
|
|
8
|
-
getIteration(): number;
|
|
9
|
-
getSenderMessageKey(): SenderMessageKey;
|
|
10
|
-
getNext(): SenderChainKey;
|
|
11
|
-
getSeed(): Uint8Array;
|
|
12
|
-
private getDerivative;
|
|
13
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { CiphertextMessage } from './ciphertext-message';
|
|
2
|
-
export declare class SenderKeyDistributionMessage extends CiphertextMessage {
|
|
3
|
-
private readonly id;
|
|
4
|
-
private readonly iteration;
|
|
5
|
-
private readonly chainKey;
|
|
6
|
-
private readonly signatureKey;
|
|
7
|
-
private readonly serialized;
|
|
8
|
-
constructor(id?: number | null, iteration?: number | null, chainKey?: Uint8Array | null, signatureKey?: Uint8Array | null, serialized?: Uint8Array | null);
|
|
9
|
-
private intsToByteHighAndLow;
|
|
10
|
-
serialize(): Uint8Array;
|
|
11
|
-
getType(): number;
|
|
12
|
-
getIteration(): number;
|
|
13
|
-
getChainKey(): Uint8Array;
|
|
14
|
-
getSignatureKey(): Uint8Array;
|
|
15
|
-
getId(): number;
|
|
16
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { CiphertextMessage } from './ciphertext-message';
|
|
2
|
-
export declare class SenderKeyMessage extends CiphertextMessage {
|
|
3
|
-
private readonly SIGNATURE_LENGTH;
|
|
4
|
-
private readonly messageVersion;
|
|
5
|
-
private readonly keyId;
|
|
6
|
-
private readonly iteration;
|
|
7
|
-
private readonly ciphertext;
|
|
8
|
-
private readonly signature;
|
|
9
|
-
private readonly serialized;
|
|
10
|
-
constructor(keyId?: number | null, iteration?: number | null, ciphertext?: Uint8Array | null, signatureKey?: Uint8Array | null, serialized?: Uint8Array | null);
|
|
11
|
-
getKeyId(): number;
|
|
12
|
-
getIteration(): number;
|
|
13
|
-
getCipherText(): Uint8Array;
|
|
14
|
-
verifySignature(signatureKey: Uint8Array): void;
|
|
15
|
-
private getSignature;
|
|
16
|
-
serialize(): Uint8Array;
|
|
17
|
-
getType(): number;
|
|
18
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
interface Sender {
|
|
2
|
-
id: string;
|
|
3
|
-
deviceId: number;
|
|
4
|
-
toString(): string;
|
|
5
|
-
}
|
|
6
|
-
export declare class SenderKeyName {
|
|
7
|
-
private readonly groupId;
|
|
8
|
-
private readonly sender;
|
|
9
|
-
constructor(groupId: string, sender: Sender);
|
|
10
|
-
getGroupId(): string;
|
|
11
|
-
getSender(): Sender;
|
|
12
|
-
serialize(): string;
|
|
13
|
-
toString(): string;
|
|
14
|
-
equals(other: SenderKeyName | null): boolean;
|
|
15
|
-
hashCode(): number;
|
|
16
|
-
}
|
|
17
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { SenderKeyState } from './sender-key-state';
|
|
2
|
-
export interface SenderKeyStateStructure {
|
|
3
|
-
senderKeyId: number;
|
|
4
|
-
senderChainKey: {
|
|
5
|
-
iteration: number;
|
|
6
|
-
seed: Uint8Array;
|
|
7
|
-
};
|
|
8
|
-
senderSigningKey: {
|
|
9
|
-
public: Uint8Array;
|
|
10
|
-
private?: Uint8Array;
|
|
11
|
-
};
|
|
12
|
-
senderMessageKeys: Array<{
|
|
13
|
-
iteration: number;
|
|
14
|
-
seed: Uint8Array;
|
|
15
|
-
}>;
|
|
16
|
-
}
|
|
17
|
-
export declare class SenderKeyRecord {
|
|
18
|
-
private readonly MAX_STATES;
|
|
19
|
-
private readonly senderKeyStates;
|
|
20
|
-
constructor(serialized?: SenderKeyStateStructure[]);
|
|
21
|
-
isEmpty(): boolean;
|
|
22
|
-
getSenderKeyState(keyId?: number): SenderKeyState | undefined;
|
|
23
|
-
addSenderKeyState(id: number, iteration: number, chainKey: Uint8Array, signatureKey: Uint8Array): void;
|
|
24
|
-
setSenderKeyState(id: number, iteration: number, chainKey: Uint8Array, keyPair: {
|
|
25
|
-
public: Uint8Array;
|
|
26
|
-
private: Uint8Array;
|
|
27
|
-
}): void;
|
|
28
|
-
serialize(): SenderKeyStateStructure[];
|
|
29
|
-
static deserialize(data: Uint8Array | string | SenderKeyStateStructure[]): SenderKeyRecord;
|
|
30
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,11 +0,0 @@
|
|
|
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,17 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import { EventEmitter } from 'events';
|
|
4
|
-
import { URL } from 'url';
|
|
5
|
-
import { SocketConfig } from '../../Types';
|
|
6
|
-
export declare abstract class AbstractSocketClient extends EventEmitter {
|
|
7
|
-
url: URL;
|
|
8
|
-
config: SocketConfig;
|
|
9
|
-
abstract get isOpen(): boolean;
|
|
10
|
-
abstract get isClosed(): boolean;
|
|
11
|
-
abstract get isClosing(): boolean;
|
|
12
|
-
abstract get isConnecting(): boolean;
|
|
13
|
-
constructor(url: URL, config: SocketConfig);
|
|
14
|
-
abstract connect(): Promise<void>;
|
|
15
|
-
abstract close(): Promise<void>;
|
|
16
|
-
abstract send(str: Uint8Array | string, cb?: (err?: Error) => void): boolean;
|
|
17
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -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;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import WebSocket from 'ws';
|
|
2
|
-
import { AbstractSocketClient } from './abstract-socket-client';
|
|
3
|
-
export declare class WebSocketClient extends AbstractSocketClient {
|
|
4
|
-
protected socket: WebSocket | 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
|
-
}
|