@hansaka02/baileys 1.0.0 → 7.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +172 -172
  2. package/WAProto/AICommon/AICommon.d.ts +7102 -5380
  3. package/WAProto/AICommon/AICommon.js +13991 -9169
  4. package/WAProto/AICommon/AICommon.proto +110 -3
  5. package/WAProto/CompanionReg/CompanionReg.d.ts +27 -0
  6. package/WAProto/CompanionReg/CompanionReg.js +114 -0
  7. package/WAProto/CompanionReg/CompanionReg.proto +3 -0
  8. package/WAProto/DeviceCapabilities/DeviceCapabilities.d.ts +244 -0
  9. package/WAProto/DeviceCapabilities/DeviceCapabilities.js +652 -0
  10. package/WAProto/DeviceCapabilities/DeviceCapabilities.proto +19 -0
  11. package/WAProto/E2E/E2E.d.ts +7234 -1003
  12. package/WAProto/E2E/E2E.js +77193 -51248
  13. package/WAProto/E2E/E2E.proto +68 -12
  14. package/WAProto/HistorySync/HistorySync.d.ts +1195 -75
  15. package/WAProto/HistorySync/HistorySync.js +3375 -178
  16. package/WAProto/HistorySync/HistorySync.proto +3 -3
  17. package/WAProto/LidMigrationSyncPayload/LidMigrationSyncPayload.d.ts +18 -6
  18. package/WAProto/LidMigrationSyncPayload/LidMigrationSyncPayload.js +98 -49
  19. package/WAProto/LidMigrationSyncPayload/LidMigrationSyncPayload.proto +2 -2
  20. package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.d.ts +7468 -1051
  21. package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.js +75226 -48422
  22. package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.proto +6 -0
  23. package/WAProto/StatusAttributions/StatusAttributions.d.ts +5 -2
  24. package/WAProto/StatusAttributions/StatusAttributions.js +21 -0
  25. package/WAProto/StatusAttributions/StatusAttributions.proto +3 -0
  26. package/WAProto/SyncAction/SyncAction.d.ts +2271 -280
  27. package/WAProto/SyncAction/SyncAction.js +9423 -2023
  28. package/WAProto/SyncAction/SyncAction.proto +208 -15
  29. package/WAProto/Wa6/Wa6.d.ts +20 -1
  30. package/WAProto/Wa6/Wa6.js +83 -0
  31. package/WAProto/Wa6/Wa6.proto +3 -0
  32. package/WAProto/Web/Web.d.ts +8207 -1194
  33. package/WAProto/Web/Web.js +92664 -63403
  34. package/WAProto/Web/Web.proto +31 -13
  35. package/lib/Defaults/baileys-version.json +1 -1
  36. package/lib/Socket/messages-recv.js +9 -1
  37. package/lib/Types/MexUpdates.js +1 -0
  38. package/lib/Utils/crypto.js +1 -1
  39. package/lib/Utils/decode-wa-message.js +14 -16
  40. package/lib/Utils/generics.js +63 -16
  41. package/lib/Utils/messages.js +40 -0
  42. package/lib/Utils/process-message.js +336 -24
  43. package/lib/Utils/validate-connection.js +51 -9
  44. package/package.json +19 -19
@@ -89,7 +89,7 @@ message WallpaperSettings {
89
89
  }
90
90
 
91
91
  message GroupParticipant {
92
- required string userJid = 1;
92
+ optional string userJid = 1;
93
93
  optional Rank rank = 2;
94
94
  optional E2E.MemberLabel memberLabel = 3;
95
95
  enum Rank {
@@ -122,7 +122,7 @@ message PhoneNumberToLIDMapping {
122
122
  }
123
123
 
124
124
  message Conversation {
125
- required string id = 1;
125
+ optional string id = 1;
126
126
  repeated HistorySyncMsg messages = 2;
127
127
  optional string newJid = 3;
128
128
  optional string oldJid = 4;
@@ -184,7 +184,7 @@ message Conversation {
184
184
  }
185
185
 
186
186
  message HistorySync {
187
- required HistorySyncType syncType = 1;
187
+ optional HistorySyncType syncType = 1;
188
188
  repeated Conversation conversations = 2;
189
189
  repeated Web.WebMessageInfo statusV3Messages = 3;
190
190
  optional uint32 chunkOrder = 5;
@@ -26,7 +26,10 @@ export namespace LidMigrationSyncPayload {
26
26
  public pnToLidMappings: LidMigrationSyncPayload.ILIDMigrationMapping[];
27
27
 
28
28
  /** LIDMigrationMappingSyncPayload chatDbMigrationTimestamp. */
29
- public chatDbMigrationTimestamp: (number|Long);
29
+ public chatDbMigrationTimestamp?: (number|Long|null);
30
+
31
+ /** LIDMigrationMappingSyncPayload _chatDbMigrationTimestamp. */
32
+ public _chatDbMigrationTimestamp?: "chatDbMigrationTimestamp";
30
33
 
31
34
  /**
32
35
  * Creates a new LIDMigrationMappingSyncPayload instance using the specified properties.
@@ -110,10 +113,10 @@ export namespace LidMigrationSyncPayload {
110
113
  interface ILIDMigrationMapping {
111
114
 
112
115
  /** LIDMigrationMapping pn */
113
- pn: (number|Long);
116
+ pn?: (number|Long|null);
114
117
 
115
118
  /** LIDMigrationMapping assignedLid */
116
- assignedLid: (number|Long);
119
+ assignedLid?: (number|Long|null);
117
120
 
118
121
  /** LIDMigrationMapping latestLid */
119
122
  latestLid?: (number|Long|null);
@@ -129,13 +132,22 @@ export namespace LidMigrationSyncPayload {
129
132
  constructor(properties?: LidMigrationSyncPayload.ILIDMigrationMapping);
130
133
 
131
134
  /** LIDMigrationMapping pn. */
132
- public pn: (number|Long);
135
+ public pn?: (number|Long|null);
133
136
 
134
137
  /** LIDMigrationMapping assignedLid. */
135
- public assignedLid: (number|Long);
138
+ public assignedLid?: (number|Long|null);
136
139
 
137
140
  /** LIDMigrationMapping latestLid. */
138
- public latestLid: (number|Long);
141
+ public latestLid?: (number|Long|null);
142
+
143
+ /** LIDMigrationMapping _pn. */
144
+ public _pn?: "pn";
145
+
146
+ /** LIDMigrationMapping _assignedLid. */
147
+ public _assignedLid?: "assignedLid";
148
+
149
+ /** LIDMigrationMapping _latestLid. */
150
+ public _latestLid?: "latestLid";
139
151
 
140
152
  /**
141
153
  * Creates a new LIDMigrationMapping instance using the specified properties.
@@ -54,11 +54,25 @@ $root.LidMigrationSyncPayload = (function() {
54
54
 
55
55
  /**
56
56
  * LIDMigrationMappingSyncPayload chatDbMigrationTimestamp.
57
- * @member {number|Long} chatDbMigrationTimestamp
57
+ * @member {number|Long|null|undefined} chatDbMigrationTimestamp
58
58
  * @memberof LidMigrationSyncPayload.LIDMigrationMappingSyncPayload
59
59
  * @instance
60
60
  */
61
- LIDMigrationMappingSyncPayload.prototype.chatDbMigrationTimestamp = $util.Long ? $util.Long.fromBits(0,0,true) : 0;
61
+ LIDMigrationMappingSyncPayload.prototype.chatDbMigrationTimestamp = null;
62
+
63
+ // OneOf field names bound to virtual getters and setters
64
+ var $oneOfFields;
65
+
66
+ /**
67
+ * LIDMigrationMappingSyncPayload _chatDbMigrationTimestamp.
68
+ * @member {"chatDbMigrationTimestamp"|undefined} _chatDbMigrationTimestamp
69
+ * @memberof LidMigrationSyncPayload.LIDMigrationMappingSyncPayload
70
+ * @instance
71
+ */
72
+ Object.defineProperty(LIDMigrationMappingSyncPayload.prototype, "_chatDbMigrationTimestamp", {
73
+ get: $util.oneOfGetter($oneOfFields = ["chatDbMigrationTimestamp"]),
74
+ set: $util.oneOfSetter($oneOfFields)
75
+ });
62
76
 
63
77
  /**
64
78
  * Creates a new LIDMigrationMappingSyncPayload instance using the specified properties.
@@ -170,6 +184,7 @@ $root.LidMigrationSyncPayload = (function() {
170
184
  LIDMigrationMappingSyncPayload.verify = function verify(message) {
171
185
  if (typeof message !== "object" || message === null)
172
186
  return "object expected";
187
+ var properties = {};
173
188
  if (message.pnToLidMappings != null && message.hasOwnProperty("pnToLidMappings")) {
174
189
  if (!Array.isArray(message.pnToLidMappings))
175
190
  return "pnToLidMappings: array expected";
@@ -179,9 +194,11 @@ $root.LidMigrationSyncPayload = (function() {
179
194
  return "pnToLidMappings." + error;
180
195
  }
181
196
  }
182
- if (message.chatDbMigrationTimestamp != null && message.hasOwnProperty("chatDbMigrationTimestamp"))
197
+ if (message.chatDbMigrationTimestamp != null && message.hasOwnProperty("chatDbMigrationTimestamp")) {
198
+ properties._chatDbMigrationTimestamp = 1;
183
199
  if (!$util.isInteger(message.chatDbMigrationTimestamp) && !(message.chatDbMigrationTimestamp && $util.isInteger(message.chatDbMigrationTimestamp.low) && $util.isInteger(message.chatDbMigrationTimestamp.high)))
184
200
  return "chatDbMigrationTimestamp: integer|Long expected";
201
+ }
185
202
  return null;
186
203
  };
187
204
 
@@ -234,22 +251,19 @@ $root.LidMigrationSyncPayload = (function() {
234
251
  var object = {};
235
252
  if (options.arrays || options.defaults)
236
253
  object.pnToLidMappings = [];
237
- if (options.defaults)
238
- if ($util.Long) {
239
- var long = new $util.Long(0, 0, true);
240
- object.chatDbMigrationTimestamp = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
241
- } else
242
- object.chatDbMigrationTimestamp = options.longs === String ? "0" : 0;
243
254
  if (message.pnToLidMappings && message.pnToLidMappings.length) {
244
255
  object.pnToLidMappings = [];
245
256
  for (var j = 0; j < message.pnToLidMappings.length; ++j)
246
257
  object.pnToLidMappings[j] = $root.LidMigrationSyncPayload.LIDMigrationMapping.toObject(message.pnToLidMappings[j], options);
247
258
  }
248
- if (message.chatDbMigrationTimestamp != null && message.hasOwnProperty("chatDbMigrationTimestamp"))
259
+ if (message.chatDbMigrationTimestamp != null && message.hasOwnProperty("chatDbMigrationTimestamp")) {
249
260
  if (typeof message.chatDbMigrationTimestamp === "number")
250
261
  object.chatDbMigrationTimestamp = options.longs === String ? String(message.chatDbMigrationTimestamp) : message.chatDbMigrationTimestamp;
251
262
  else
252
263
  object.chatDbMigrationTimestamp = options.longs === String ? $util.Long.prototype.toString.call(message.chatDbMigrationTimestamp) : options.longs === Number ? new $util.LongBits(message.chatDbMigrationTimestamp.low >>> 0, message.chatDbMigrationTimestamp.high >>> 0).toNumber(true) : message.chatDbMigrationTimestamp;
264
+ if (options.oneofs)
265
+ object._chatDbMigrationTimestamp = "chatDbMigrationTimestamp";
266
+ }
253
267
  return object;
254
268
  };
255
269
 
@@ -288,8 +302,8 @@ $root.LidMigrationSyncPayload = (function() {
288
302
  * Properties of a LIDMigrationMapping.
289
303
  * @memberof LidMigrationSyncPayload
290
304
  * @interface ILIDMigrationMapping
291
- * @property {number|Long} pn LIDMigrationMapping pn
292
- * @property {number|Long} assignedLid LIDMigrationMapping assignedLid
305
+ * @property {number|Long|null} [pn] LIDMigrationMapping pn
306
+ * @property {number|Long|null} [assignedLid] LIDMigrationMapping assignedLid
293
307
  * @property {number|Long|null} [latestLid] LIDMigrationMapping latestLid
294
308
  */
295
309
 
@@ -310,27 +324,63 @@ $root.LidMigrationSyncPayload = (function() {
310
324
 
311
325
  /**
312
326
  * LIDMigrationMapping pn.
313
- * @member {number|Long} pn
327
+ * @member {number|Long|null|undefined} pn
314
328
  * @memberof LidMigrationSyncPayload.LIDMigrationMapping
315
329
  * @instance
316
330
  */
317
- LIDMigrationMapping.prototype.pn = $util.Long ? $util.Long.fromBits(0,0,true) : 0;
331
+ LIDMigrationMapping.prototype.pn = null;
318
332
 
319
333
  /**
320
334
  * LIDMigrationMapping assignedLid.
321
- * @member {number|Long} assignedLid
335
+ * @member {number|Long|null|undefined} assignedLid
322
336
  * @memberof LidMigrationSyncPayload.LIDMigrationMapping
323
337
  * @instance
324
338
  */
325
- LIDMigrationMapping.prototype.assignedLid = $util.Long ? $util.Long.fromBits(0,0,true) : 0;
339
+ LIDMigrationMapping.prototype.assignedLid = null;
326
340
 
327
341
  /**
328
342
  * LIDMigrationMapping latestLid.
329
- * @member {number|Long} latestLid
343
+ * @member {number|Long|null|undefined} latestLid
330
344
  * @memberof LidMigrationSyncPayload.LIDMigrationMapping
331
345
  * @instance
332
346
  */
333
- LIDMigrationMapping.prototype.latestLid = $util.Long ? $util.Long.fromBits(0,0,true) : 0;
347
+ LIDMigrationMapping.prototype.latestLid = null;
348
+
349
+ // OneOf field names bound to virtual getters and setters
350
+ var $oneOfFields;
351
+
352
+ /**
353
+ * LIDMigrationMapping _pn.
354
+ * @member {"pn"|undefined} _pn
355
+ * @memberof LidMigrationSyncPayload.LIDMigrationMapping
356
+ * @instance
357
+ */
358
+ Object.defineProperty(LIDMigrationMapping.prototype, "_pn", {
359
+ get: $util.oneOfGetter($oneOfFields = ["pn"]),
360
+ set: $util.oneOfSetter($oneOfFields)
361
+ });
362
+
363
+ /**
364
+ * LIDMigrationMapping _assignedLid.
365
+ * @member {"assignedLid"|undefined} _assignedLid
366
+ * @memberof LidMigrationSyncPayload.LIDMigrationMapping
367
+ * @instance
368
+ */
369
+ Object.defineProperty(LIDMigrationMapping.prototype, "_assignedLid", {
370
+ get: $util.oneOfGetter($oneOfFields = ["assignedLid"]),
371
+ set: $util.oneOfSetter($oneOfFields)
372
+ });
373
+
374
+ /**
375
+ * LIDMigrationMapping _latestLid.
376
+ * @member {"latestLid"|undefined} _latestLid
377
+ * @memberof LidMigrationSyncPayload.LIDMigrationMapping
378
+ * @instance
379
+ */
380
+ Object.defineProperty(LIDMigrationMapping.prototype, "_latestLid", {
381
+ get: $util.oneOfGetter($oneOfFields = ["latestLid"]),
382
+ set: $util.oneOfSetter($oneOfFields)
383
+ });
334
384
 
335
385
  /**
336
386
  * Creates a new LIDMigrationMapping instance using the specified properties.
@@ -356,8 +406,10 @@ $root.LidMigrationSyncPayload = (function() {
356
406
  LIDMigrationMapping.encode = function encode(message, writer) {
357
407
  if (!writer)
358
408
  writer = $Writer.create();
359
- writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.pn);
360
- writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.assignedLid);
409
+ if (message.pn != null && Object.hasOwnProperty.call(message, "pn"))
410
+ writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.pn);
411
+ if (message.assignedLid != null && Object.hasOwnProperty.call(message, "assignedLid"))
412
+ writer.uint32(/* id 2, wireType 0 =*/16).uint64(message.assignedLid);
361
413
  if (message.latestLid != null && Object.hasOwnProperty.call(message, "latestLid"))
362
414
  writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.latestLid);
363
415
  return writer;
@@ -413,10 +465,6 @@ $root.LidMigrationSyncPayload = (function() {
413
465
  break;
414
466
  }
415
467
  }
416
- if (!message.hasOwnProperty("pn"))
417
- throw $util.ProtocolError("missing required 'pn'", { instance: message });
418
- if (!message.hasOwnProperty("assignedLid"))
419
- throw $util.ProtocolError("missing required 'assignedLid'", { instance: message });
420
468
  return message;
421
469
  };
422
470
 
@@ -447,13 +495,22 @@ $root.LidMigrationSyncPayload = (function() {
447
495
  LIDMigrationMapping.verify = function verify(message) {
448
496
  if (typeof message !== "object" || message === null)
449
497
  return "object expected";
450
- if (!$util.isInteger(message.pn) && !(message.pn && $util.isInteger(message.pn.low) && $util.isInteger(message.pn.high)))
451
- return "pn: integer|Long expected";
452
- if (!$util.isInteger(message.assignedLid) && !(message.assignedLid && $util.isInteger(message.assignedLid.low) && $util.isInteger(message.assignedLid.high)))
453
- return "assignedLid: integer|Long expected";
454
- if (message.latestLid != null && message.hasOwnProperty("latestLid"))
498
+ var properties = {};
499
+ if (message.pn != null && message.hasOwnProperty("pn")) {
500
+ properties._pn = 1;
501
+ if (!$util.isInteger(message.pn) && !(message.pn && $util.isInteger(message.pn.low) && $util.isInteger(message.pn.high)))
502
+ return "pn: integer|Long expected";
503
+ }
504
+ if (message.assignedLid != null && message.hasOwnProperty("assignedLid")) {
505
+ properties._assignedLid = 1;
506
+ if (!$util.isInteger(message.assignedLid) && !(message.assignedLid && $util.isInteger(message.assignedLid.low) && $util.isInteger(message.assignedLid.high)))
507
+ return "assignedLid: integer|Long expected";
508
+ }
509
+ if (message.latestLid != null && message.hasOwnProperty("latestLid")) {
510
+ properties._latestLid = 1;
455
511
  if (!$util.isInteger(message.latestLid) && !(message.latestLid && $util.isInteger(message.latestLid.low) && $util.isInteger(message.latestLid.high)))
456
512
  return "latestLid: integer|Long expected";
513
+ }
457
514
  return null;
458
515
  };
459
516
 
@@ -512,38 +569,30 @@ $root.LidMigrationSyncPayload = (function() {
512
569
  if (!options)
513
570
  options = {};
514
571
  var object = {};
515
- if (options.defaults) {
516
- if ($util.Long) {
517
- var long = new $util.Long(0, 0, true);
518
- object.pn = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
519
- } else
520
- object.pn = options.longs === String ? "0" : 0;
521
- if ($util.Long) {
522
- var long = new $util.Long(0, 0, true);
523
- object.assignedLid = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
524
- } else
525
- object.assignedLid = options.longs === String ? "0" : 0;
526
- if ($util.Long) {
527
- var long = new $util.Long(0, 0, true);
528
- object.latestLid = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
529
- } else
530
- object.latestLid = options.longs === String ? "0" : 0;
531
- }
532
- if (message.pn != null && message.hasOwnProperty("pn"))
572
+ if (message.pn != null && message.hasOwnProperty("pn")) {
533
573
  if (typeof message.pn === "number")
534
574
  object.pn = options.longs === String ? String(message.pn) : message.pn;
535
575
  else
536
576
  object.pn = options.longs === String ? $util.Long.prototype.toString.call(message.pn) : options.longs === Number ? new $util.LongBits(message.pn.low >>> 0, message.pn.high >>> 0).toNumber(true) : message.pn;
537
- if (message.assignedLid != null && message.hasOwnProperty("assignedLid"))
577
+ if (options.oneofs)
578
+ object._pn = "pn";
579
+ }
580
+ if (message.assignedLid != null && message.hasOwnProperty("assignedLid")) {
538
581
  if (typeof message.assignedLid === "number")
539
582
  object.assignedLid = options.longs === String ? String(message.assignedLid) : message.assignedLid;
540
583
  else
541
584
  object.assignedLid = options.longs === String ? $util.Long.prototype.toString.call(message.assignedLid) : options.longs === Number ? new $util.LongBits(message.assignedLid.low >>> 0, message.assignedLid.high >>> 0).toNumber(true) : message.assignedLid;
542
- if (message.latestLid != null && message.hasOwnProperty("latestLid"))
585
+ if (options.oneofs)
586
+ object._assignedLid = "assignedLid";
587
+ }
588
+ if (message.latestLid != null && message.hasOwnProperty("latestLid")) {
543
589
  if (typeof message.latestLid === "number")
544
590
  object.latestLid = options.longs === String ? String(message.latestLid) : message.latestLid;
545
591
  else
546
592
  object.latestLid = options.longs === String ? $util.Long.prototype.toString.call(message.latestLid) : options.longs === Number ? new $util.LongBits(message.latestLid.low >>> 0, message.latestLid.high >>> 0).toNumber(true) : message.latestLid;
593
+ if (options.oneofs)
594
+ object._latestLid = "latestLid";
595
+ }
547
596
  return object;
548
597
  };
549
598
 
@@ -7,7 +7,7 @@ message LIDMigrationMappingSyncPayload {
7
7
  }
8
8
 
9
9
  message LIDMigrationMapping {
10
- required uint64 pn = 1;
11
- required uint64 assignedLid = 2;
10
+ optional uint64 pn = 1;
11
+ optional uint64 assignedLid = 2;
12
12
  optional uint64 latestLid = 3;
13
13
  }