@baileys-md/baileys 11.2.4 → 12.0.0

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 (74) hide show
  1. package/README.md +113 -2
  2. package/WAProto/GenerateStatics.sh +4 -0
  3. package/WAProto/WAProto.proto +4775 -0
  4. package/WAProto/index.js +14270 -302
  5. package/lib/Defaults/index.js +50 -54
  6. package/lib/Defaults/wileys-version.json +3 -0
  7. package/lib/Signal/Group/ciphertext-message.js +15 -0
  8. package/lib/Signal/Group/group-session-builder.js +64 -0
  9. package/lib/Signal/Group/group_cipher.js +96 -0
  10. package/lib/Signal/Group/index.js +57 -0
  11. package/lib/Signal/Group/keyhelper.js +55 -0
  12. package/lib/Signal/Group/queue-job.js +57 -0
  13. package/lib/Signal/Group/sender-chain-key.js +34 -0
  14. package/lib/Signal/Group/sender-key-distribution-message.js +66 -0
  15. package/lib/Signal/Group/sender-key-message.js +69 -0
  16. package/lib/Signal/Group/sender-key-name.js +51 -0
  17. package/lib/Signal/Group/sender-key-record.js +53 -0
  18. package/lib/Signal/Group/sender-key-state.js +99 -0
  19. package/{WASignalGroup/sender_message_key.js → lib/Signal/Group/sender-message-key.js} +6 -16
  20. package/lib/Signal/libsignal.js +33 -20
  21. package/lib/Socket/Client/index.js +2 -3
  22. package/lib/Socket/Client/{web-socket-client.js → websocket.js} +54 -5
  23. package/lib/Socket/chats.js +136 -92
  24. package/lib/Socket/groups.js +16 -11
  25. package/lib/Socket/index.js +2 -2
  26. package/lib/Socket/messages-recv.js +26 -15
  27. package/lib/Socket/messages-send.js +122 -86
  28. package/lib/Socket/newsletter.js +23 -21
  29. package/lib/Socket/socket.js +29 -15
  30. package/lib/Store/make-in-memory-store.js +23 -15
  31. package/lib/Utils/auth-utils.js +0 -7
  32. package/lib/Utils/browser-utils.js +35 -0
  33. package/lib/Utils/chat-utils.js +2 -2
  34. package/lib/Utils/crypto.js +71 -29
  35. package/lib/Utils/decode-wa-message.js +15 -7
  36. package/lib/Utils/event-buffer.js +6 -8
  37. package/lib/Utils/generics.js +38 -16
  38. package/lib/Utils/history.js +1 -1
  39. package/lib/Utils/index.js +3 -1
  40. package/lib/Utils/message-retry-manager.js +128 -0
  41. package/lib/Utils/messages-media.js +212 -57
  42. package/lib/Utils/messages.js +38 -7
  43. package/lib/Utils/noise-handler.js +5 -10
  44. package/lib/Utils/process-message.js +34 -2
  45. package/lib/Utils/signal.js +26 -16
  46. package/lib/Utils/validate-connection.js +88 -66
  47. package/lib/Utils/{baileys-event-stream.js → wileys-event-stream.js} +1 -1
  48. package/lib/WABinary/constants.js +1276 -13
  49. package/lib/WABinary/jid-utils.js +20 -4
  50. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +1 -1
  51. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +3 -3
  52. package/lib/index.js +17 -6
  53. package/package.json +22 -17
  54. package/WASignalGroup/GroupProtocol.js +0 -1697
  55. package/WASignalGroup/ciphertext_message.js +0 -16
  56. package/WASignalGroup/group_cipher.js +0 -120
  57. package/WASignalGroup/group_session_builder.js +0 -46
  58. package/WASignalGroup/index.js +0 -5
  59. package/WASignalGroup/keyhelper.js +0 -21
  60. package/WASignalGroup/protobufs.js +0 -3
  61. package/WASignalGroup/queue_job.js +0 -69
  62. package/WASignalGroup/sender_chain_key.js +0 -50
  63. package/WASignalGroup/sender_key_distribution_message.js +0 -78
  64. package/WASignalGroup/sender_key_message.js +0 -92
  65. package/WASignalGroup/sender_key_name.js +0 -70
  66. package/WASignalGroup/sender_key_record.js +0 -56
  67. package/WASignalGroup/sender_key_state.js +0 -129
  68. package/lib/Defaults/baileys-version.json +0 -3
  69. package/lib/Defaults/phonenumber-mcc.json +0 -223
  70. package/lib/Socket/Client/mobile-socket-client.js +0 -65
  71. package/lib/Socket/registration.js +0 -166
  72. package/lib/Store/make-cache-manager-store.js +0 -83
  73. package/lib/Store/make-mongo-store.js +0 -567
  74. /package/lib/Socket/Client/{abstract-socket-client.js → types.js} +0 -0
@@ -21,8 +21,21 @@ const REAL_MSG_REQ_ME_STUB_TYPES = new Set([
21
21
  /** Cleans a received message to further processing */
22
22
  const cleanMessage = (message, meId) => {
23
23
  // ensure remoteJid and participant doesn't have device or agent in it
24
- message.key.remoteJid = (0, WABinary_1.jidNormalizedUser)(message.key.remoteJid);
25
- message.key.participant = message.key.participant ? (0, WABinary_1.jidNormalizedUser)(message.key.participant) : undefined;
24
+ // normalize JIDs but catch errors to avoid throwing on invalid LIDs/JIDs
25
+ try {
26
+ message.key.remoteJid = (0, WABinary_1.jidNormalizedUser)(message.key.remoteJid);
27
+ }
28
+ catch (_e) {
29
+ // if normalization fails, retain original remoteJid
30
+ }
31
+ if (message.key.participant) {
32
+ try {
33
+ message.key.participant = (0, WABinary_1.jidNormalizedUser)(message.key.participant);
34
+ }
35
+ catch (_e) {
36
+ // ignore if can't normalize participant
37
+ }
38
+ }
26
39
  const content = (0, messages_1.normalizeMessageContent)(message.message);
27
40
  // if the message has a reaction, ensure fromMe & remoteJid are from our perspective
28
41
  if (content === null || content === void 0 ? void 0 : content.reactionMessage) {
@@ -117,6 +130,25 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
117
130
  }
118
131
  }
119
132
  const content = (0, messages_1.normalizeMessageContent)(message.message);
133
+ const senderId = message.key.participant || message.key.remoteJid;
134
+ if ((0, WABinary_1.isLidUser)(senderId)) {
135
+ const jid = (0, WABinary_1.lidToJid)(senderId);
136
+ if (message.key.participant) {
137
+ message.key.participant = jid;
138
+ }
139
+ else {
140
+ message.key.remoteJid = jid;
141
+ }
142
+ }
143
+ const mJids = content && content.contextInfo && content.contextInfo.mentionedJid ? content.contextInfo.mentionedJid : [];
144
+ for (let i = 0; i < mJids.length; i++) {
145
+ if ((0, WABinary_1.isLidUser)(mJids[i])) {
146
+ mJids[i] = (0, WABinary_1.lidToJid)(mJids[i]);
147
+ }
148
+ }
149
+ if (content && content.contextInfo && content.contextInfo.participant && (0, WABinary_1.isLidUser)(content.contextInfo.participant)) {
150
+ content.contextInfo.participant = (0, WABinary_1.lidToJid)(content.contextInfo.participant);
151
+ }
120
152
  // unarchive chat if it's a real message, or someone reacted to our message
121
153
  // and we've the unarchive chats setting on
122
154
  if ((isRealMsg || ((_b = (_a = content === null || content === void 0 ? void 0 : content.reactionMessage) === null || _a === void 0 ? void 0 : _a.key) === null || _b === void 0 ? void 0 : _b.fromMe))
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getNextPreKeysNode = exports.getNextPreKeys = exports.extractDeviceJids = exports.parseAndInjectE2ESessions = exports.xmppPreKey = exports.xmppSignedPreKey = exports.generateOrGetPreKeys = exports.getPreKeys = exports.createSignalIdentity = void 0;
4
+ const lodash_1 = require("lodash");
4
5
  const Defaults_1 = require("../Defaults");
5
6
  const WABinary_1 = require("../WABinary");
6
7
  const crypto_1 = require("./crypto");
@@ -66,22 +67,31 @@ const parseAndInjectE2ESessions = async (node, repository) => {
66
67
  for (const node of nodes) {
67
68
  (0, WABinary_1.assertNodeErrorFree)(node);
68
69
  }
69
- await Promise.all(nodes.map(async (node) => {
70
- const signedKey = (0, WABinary_1.getBinaryNodeChild)(node, 'skey');
71
- const key = (0, WABinary_1.getBinaryNodeChild)(node, 'key');
72
- const identity = (0, WABinary_1.getBinaryNodeChildBuffer)(node, 'identity');
73
- const jid = node.attrs.jid;
74
- const registrationId = (0, WABinary_1.getBinaryNodeChildUInt)(node, 'registration', 4);
75
- await repository.injectE2ESession({
76
- jid,
77
- session: {
78
- registrationId: registrationId,
79
- identityKey: (0, crypto_1.generateSignalPubKey)(identity),
80
- signedPreKey: extractKey(signedKey),
81
- preKey: extractKey(key)
82
- }
83
- });
84
- }));
70
+ // Most of the work in repository.injectE2ESession is CPU intensive, not IO
71
+ // So Promise.all doesn't really help here,
72
+ // but blocks even loop if we're using it inside keys.transaction, and it makes it "sync" actually
73
+ // This way we chunk it in smaller parts and between those parts we can yield to the event loop
74
+ // It's rare case when you need to E2E sessions for so many users, but it's possible
75
+ const chunkSize = 100;
76
+ const chunks = (0, lodash_1.chunk)(nodes, chunkSize);
77
+ for (const nodesChunk of chunks) {
78
+ await Promise.all(nodesChunk.map(async (node) => {
79
+ const signedKey = (0, WABinary_1.getBinaryNodeChild)(node, 'skey');
80
+ const key = (0, WABinary_1.getBinaryNodeChild)(node, 'key');
81
+ const identity = (0, WABinary_1.getBinaryNodeChildBuffer)(node, 'identity');
82
+ const jid = node.attrs.jid;
83
+ const registrationId = (0, WABinary_1.getBinaryNodeChildUInt)(node, 'registration', 4);
84
+ await repository.injectE2ESession({
85
+ jid,
86
+ session: {
87
+ registrationId: registrationId,
88
+ identityKey: (0, crypto_1.generateSignalPubKey)(identity),
89
+ signedPreKey: extractKey(signedKey),
90
+ preKey: extractKey(key)
91
+ }
92
+ });
93
+ }));
94
+ }
85
95
  };
86
96
  exports.parseAndInjectE2ESessions = parseAndInjectE2ESessions;
87
97
  const extractDeviceJids = (result, myJid, excludeZeroDevices) => {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.encodeSignedDeviceIdentity = exports.configureSuccessfulPairing = exports.generateRegistrationNode = exports.generateLoginNode = exports.generateMobileNode = void 0;
3
+ exports.encodeSignedDeviceIdentity = exports.configureSuccessfulPairing = exports.generateRegistrationNode = exports.generateLoginNode = void 0;
4
4
  const boom_1 = require("@hapi/boom");
5
5
  const crypto_1 = require("crypto");
6
6
  const WAProto_1 = require("../../WAProto");
@@ -9,104 +9,103 @@ const WABinary_1 = require("../WABinary");
9
9
  const crypto_2 = require("./crypto");
10
10
  const generics_1 = require("./generics");
11
11
  const signal_1 = require("./signal");
12
+
12
13
  const getUserAgent = (config) => {
13
- var _a, _b;
14
- const osVersion = config.mobile ? '15.3.1' : '0.1';
15
- const version = config.mobile ? [2, 24, 6] : config.version;
16
- const device = config.mobile ? 'iPhone_7' : 'Desktop';
17
- const manufacturer = config.mobile ? 'Apple' : '';
18
- const platform = config.mobile ? WAProto_1.proto.ClientPayload.UserAgent.Platform.IOS : WAProto_1.proto.ClientPayload.UserAgent.Platform.WEB;
19
- const phoneId = config.mobile ? { phoneId: config.auth.creds.phoneId } : {};
20
14
  return {
21
15
  appVersion: {
22
- primary: version[0],
23
- secondary: version[1],
24
- tertiary: version[2],
16
+ primary: config.version[0],
17
+ secondary: config.version[1],
18
+ tertiary: config.version[2],
25
19
  },
26
- platform,
20
+ platform: WAProto_1.proto.ClientPayload.UserAgent.Platform.WEB,
27
21
  releaseChannel: WAProto_1.proto.ClientPayload.UserAgent.ReleaseChannel.RELEASE,
28
- mcc: ((_a = config.auth.creds.registration) === null || _a === void 0 ? void 0 : _a.phoneNumberMobileCountryCode) || '000',
29
- mnc: ((_b = config.auth.creds.registration) === null || _b === void 0 ? void 0 : _b.phoneNumberMobileNetworkCode) || '000',
30
- osVersion: osVersion,
31
- manufacturer,
32
- device,
33
- osBuildNumber: osVersion,
22
+ osVersion: '0.1',
23
+ device: 'Desktop',
24
+ osBuildNumber: '0.1',
34
25
  localeLanguageIso6391: 'en',
35
- localeCountryIso31661Alpha2: config.countryCode,
36
- ...phoneId
26
+ mnc: '000',
27
+ mcc: '000',
28
+ localeCountryIso31661Alpha2: config.countryCode || 'US'
37
29
  };
38
30
  };
31
+
39
32
  const PLATFORM_MAP = {
40
33
  'Mac OS': WAProto_1.proto.ClientPayload.WebInfo.WebSubPlatform.DARWIN,
41
34
  'Windows': WAProto_1.proto.ClientPayload.WebInfo.WebSubPlatform.WIN32
42
35
  };
36
+
43
37
  const getWebInfo = (config) => {
44
38
  let webSubPlatform = WAProto_1.proto.ClientPayload.WebInfo.WebSubPlatform.WEB_BROWSER;
45
- if (config.syncFullHistory && PLATFORM_MAP[config.browser[0]]) {
39
+ if (config.syncFullHistory && PLATFORM_MAP[config.browser[0]] && config.browser[1] === 'Desktop') {
46
40
  webSubPlatform = PLATFORM_MAP[config.browser[0]];
47
41
  }
48
42
  return { webSubPlatform };
49
43
  };
44
+
50
45
  const getClientPayload = (config) => {
51
46
  const payload = {
52
47
  connectType: WAProto_1.proto.ClientPayload.ConnectType.WIFI_UNKNOWN,
53
48
  connectReason: WAProto_1.proto.ClientPayload.ConnectReason.USER_ACTIVATED,
54
49
  userAgent: getUserAgent(config),
55
50
  };
56
- if (!config.mobile) {
57
- payload.webInfo = getWebInfo(config);
58
- }
51
+ payload.webInfo = getWebInfo(config);
59
52
  return payload;
60
53
  };
61
- const generateMobileNode = (config) => {
62
- if (!config.auth.creds) {
63
- throw new boom_1.Boom('No registration data found', { data: config });
64
- }
65
- const payload = {
66
- ...getClientPayload(config),
67
- sessionId: Math.floor(Math.random() * 999999999 + 1),
68
- shortConnect: true,
69
- connectAttemptCount: 0,
70
- device: 0,
71
- dnsSource: {
72
- appCached: false,
73
- dnsMethod: WAProto_1.proto.ClientPayload.DNSSource.DNSResolutionMethod.SYSTEM,
74
- },
75
- passive: false, // XMPP heartbeat setting (false: server actively pings) (true: client actively pings)
76
- pushName: 'test',
77
- username: Number(`${config.auth.creds.registration.phoneNumberCountryCode}${config.auth.creds.registration.phoneNumberNationalNumber}`),
78
- };
79
- return WAProto_1.proto.ClientPayload.fromObject(payload);
80
- };
81
- exports.generateMobileNode = generateMobileNode;
54
+
82
55
  const generateLoginNode = (userJid, config) => {
83
56
  const { user, device } = (0, WABinary_1.jidDecode)(userJid);
84
57
  const payload = {
85
58
  ...getClientPayload(config),
86
- passive: false,
59
+ passive: true,
87
60
  pull: true,
88
61
  username: +user,
89
62
  device: device,
63
+ lidDbMigrated: false
90
64
  };
91
65
  return WAProto_1.proto.ClientPayload.fromObject(payload);
92
66
  };
93
67
  exports.generateLoginNode = generateLoginNode;
68
+
94
69
  const getPlatformType = (platform) => {
95
70
  const platformType = platform.toUpperCase();
96
- return WAProto_1.proto.DeviceProps.PlatformType[platformType] || WAProto_1.proto.DeviceProps.PlatformType.DESKTOP;
71
+ return WAProto_1.proto.DeviceProps.PlatformType[platformType] || WAProto_1.proto.DeviceProps.PlatformType.CHROME;
97
72
  };
73
+
98
74
  const generateRegistrationNode = ({ registrationId, signedPreKey, signedIdentityKey }, config) => {
99
- // the app version needs to be md5 hashed
100
- // and passed in
101
75
  const appVersionBuf = (0, crypto_1.createHash)('md5')
102
- .update(config.version.join('.')) // join as string
76
+ .update(config.version.join('.'))
103
77
  .digest();
78
+
104
79
  const companion = {
105
80
  os: config.browser[0],
106
81
  platformType: getPlatformType(config.browser[1]),
107
82
  requireFullSync: config.syncFullHistory,
83
+ historySyncConfig: {
84
+ storageQuotaMb: 10240,
85
+ inlineInitialPayloadInE2EeMsg: true,
86
+ recentSyncDaysLimit: undefined,
87
+ supportCallLogHistory: false,
88
+ supportBotUserAgentChatHistory: true,
89
+ supportCagReactionsAndPolls: true,
90
+ supportBizHostedMsg: true,
91
+ supportRecentSyncChunkMessageCountTuning: true,
92
+ supportHostedGroupMsg: true,
93
+ supportFbidBotChatHistory: true,
94
+ supportAddOnHistorySyncMigration: undefined,
95
+ supportMessageAssociation: true,
96
+ supportGroupHistory: false,
97
+ onDemandReady: undefined,
98
+ supportGuestChat: undefined
99
+ },
100
+ version: {
101
+ primary: 10,
102
+ secondary: 15,
103
+ tertiary: 7
104
+ }
108
105
  };
106
+
109
107
  const companionProto = WAProto_1.proto.DeviceProps.encode(companion).finish();
108
+
110
109
  const registerPayload = {
111
110
  ...getClientPayload(config),
112
111
  passive: false,
@@ -125,6 +124,7 @@ const generateRegistrationNode = ({ registrationId, signedPreKey, signedIdentity
125
124
  return WAProto_1.proto.ClientPayload.fromObject(registerPayload);
126
125
  };
127
126
  exports.generateRegistrationNode = generateRegistrationNode;
127
+
128
128
  const configureSuccessfulPairing = (stanza, { advSecretKey, signedIdentityKey, signalIdentities }) => {
129
129
  const msgId = stanza.attrs.id;
130
130
  const pairSuccessNode = (0, WABinary_1.getBinaryNodeChild)(stanza, 'pair-success');
@@ -132,30 +132,52 @@ const configureSuccessfulPairing = (stanza, { advSecretKey, signedIdentityKey, s
132
132
  const platformNode = (0, WABinary_1.getBinaryNodeChild)(pairSuccessNode, 'platform');
133
133
  const deviceNode = (0, WABinary_1.getBinaryNodeChild)(pairSuccessNode, 'device');
134
134
  const businessNode = (0, WABinary_1.getBinaryNodeChild)(pairSuccessNode, 'biz');
135
+
135
136
  if (!deviceIdentityNode || !deviceNode) {
136
137
  throw new boom_1.Boom('Missing device-identity or device in pair success node', { data: stanza });
137
138
  }
138
- const bizName = businessNode === null || businessNode === void 0 ? void 0 : businessNode.attrs.name;
139
+
140
+ const bizName = businessNode?.attrs.name;
139
141
  const jid = deviceNode.attrs.jid;
140
- const { details, hmac } = WAProto_1.proto.ADVSignedDeviceIdentityHMAC.decode(deviceIdentityNode.content);
141
- // check HMAC matches
142
- const advSign = (0, crypto_2.hmacSign)(details, Buffer.from(advSecretKey, 'base64'));
142
+ const lid = deviceNode.attrs.lid;
143
+
144
+ const { details, hmac, accountType } = WAProto_1.proto.ADVSignedDeviceIdentityHMAC.decode(deviceIdentityNode.content);
145
+
146
+ let hmacPrefix = Buffer.from([]);
147
+ if (accountType !== undefined && accountType === WAProto_1.proto.ADVEncryptionType.HOSTED) {
148
+ hmacPrefix = Buffer.from([0x06, 0x05]);
149
+ }
150
+
151
+ const advSign = (0, crypto_2.hmacSign)(Buffer.concat([hmacPrefix, details]), Buffer.from(advSecretKey, 'base64'));
143
152
  if (Buffer.compare(hmac, advSign) !== 0) {
144
153
  throw new boom_1.Boom('Invalid account signature');
145
154
  }
155
+
146
156
  const account = WAProto_1.proto.ADVSignedDeviceIdentity.decode(details);
147
157
  const { accountSignatureKey, accountSignature, details: deviceDetails } = account;
148
- // verify the device signature matches
149
- const accountMsg = Buffer.concat([Buffer.from([6, 0]), deviceDetails, signedIdentityKey.public]);
158
+
159
+ const deviceIdentity = WAProto_1.proto.ADVDeviceIdentity.decode(deviceDetails);
160
+
161
+ const accountSignaturePrefix = deviceIdentity.deviceType === WAProto_1.proto.ADVEncryptionType.HOSTED
162
+ ? Buffer.from([0x06, 0x05])
163
+ : Buffer.from([0x06, 0x00]);
164
+ const accountMsg = Buffer.concat([accountSignaturePrefix, deviceDetails, signedIdentityKey.public]);
165
+
150
166
  if (!crypto_2.Curve.verify(accountSignatureKey, accountMsg, accountSignature)) {
151
167
  throw new boom_1.Boom('Failed to verify account signature');
152
168
  }
153
- // sign the details with our identity key
154
- const deviceMsg = Buffer.concat([Buffer.from([6, 1]), deviceDetails, signedIdentityKey.public, accountSignatureKey]);
169
+
170
+ const deviceMsg = Buffer.concat([
171
+ Buffer.from([0x06, 0x01]),
172
+ deviceDetails,
173
+ signedIdentityKey.public,
174
+ accountSignatureKey
175
+ ]);
155
176
  account.deviceSignature = crypto_2.Curve.sign(signedIdentityKey.private, deviceMsg);
177
+
156
178
  const identity = (0, signal_1.createSignalIdentity)(jid, accountSignatureKey);
157
179
  const accountEnc = (0, exports.encodeSignedDeviceIdentity)(account, false);
158
- const deviceIdentity = WAProto_1.proto.ADVDeviceIdentity.decode(account.details);
180
+
159
181
  const reply = {
160
182
  tag: 'iq',
161
183
  attrs: {
@@ -177,31 +199,31 @@ const configureSuccessfulPairing = (stanza, { advSecretKey, signedIdentityKey, s
177
199
  }
178
200
  ]
179
201
  };
202
+
180
203
  const authUpdate = {
181
204
  account,
182
- me: { id: jid, name: bizName },
205
+ me: { id: jid, name: bizName, lid },
183
206
  signalIdentities: [
184
207
  ...(signalIdentities || []),
185
208
  identity
186
209
  ],
187
- platform: platformNode === null || platformNode === void 0 ? void 0 : platformNode.attrs.name
210
+ platform: platformNode?.attrs.name
188
211
  };
212
+
189
213
  return {
190
214
  creds: authUpdate,
191
215
  reply
192
216
  };
193
217
  };
194
218
  exports.configureSuccessfulPairing = configureSuccessfulPairing;
219
+
195
220
  const encodeSignedDeviceIdentity = (account, includeSignatureKey) => {
196
- var _a;
197
221
  account = { ...account };
198
- // set to null if we are not to include the signature key
199
- // or if we are including the signature key but it is empty
200
- if (!includeSignatureKey || !((_a = account.accountSignatureKey) === null || _a === void 0 ? void 0 : _a.length)) {
222
+ if (!includeSignatureKey || !account.accountSignatureKey?.length) {
201
223
  account.accountSignatureKey = null;
202
224
  }
203
225
  return WAProto_1.proto.ADVSignedDeviceIdentity
204
226
  .encode(account)
205
227
  .finish();
206
228
  };
207
- exports.encodeSignedDeviceIdentity = encodeSignedDeviceIdentity;
229
+ exports.encodeSignedDeviceIdentity = encodeSignedDeviceIdentity;
@@ -11,7 +11,7 @@ const readline_1 = require("readline");
11
11
  const generics_1 = require("./generics");
12
12
  const make_mutex_1 = require("./make-mutex");
13
13
  /**
14
- * Captures events from a baileys event emitter & stores them in a file
14
+ * Captures events from a wileys event emitter & stores them in a file
15
15
  * @param ev The event emitter to read events from
16
16
  * @param filename File to save to
17
17
  */