@nexustechpro/baileys 2.0.2 → 2.0.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.
Files changed (108) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +924 -1299
  3. package/WAProto/index.js +22 -18
  4. package/lib/Defaults/baileys-version.json +6 -2
  5. package/lib/Defaults/index.js +173 -172
  6. package/lib/Signal/libsignal.js +395 -292
  7. package/lib/Signal/lid-mapping.js +264 -171
  8. package/lib/Socket/Client/index.js +2 -2
  9. package/lib/Socket/Client/types.js +10 -10
  10. package/lib/Socket/Client/websocket.js +45 -310
  11. package/lib/Socket/business.js +375 -375
  12. package/lib/Socket/chats.js +916 -963
  13. package/lib/Socket/communities.js +430 -430
  14. package/lib/Socket/groups.js +342 -342
  15. package/lib/Socket/index.js +21 -22
  16. package/lib/Socket/messages-recv.js +963 -743
  17. package/lib/Socket/messages-send.js +273 -321
  18. package/lib/Socket/mex.js +50 -50
  19. package/lib/Socket/newsletter.js +148 -148
  20. package/lib/Socket/nexus-handler.js +296 -247
  21. package/lib/Socket/registration.js +50 -33
  22. package/lib/Socket/socket.js +872 -1201
  23. package/lib/Store/index.js +5 -5
  24. package/lib/Store/make-cache-manager-store.js +81 -81
  25. package/lib/Store/make-in-memory-store.js +416 -416
  26. package/lib/Store/make-ordered-dictionary.js +81 -81
  27. package/lib/Store/object-repository.js +30 -30
  28. package/lib/Types/Auth.js +1 -1
  29. package/lib/Types/Bussines.js +1 -1
  30. package/lib/Types/Call.js +1 -1
  31. package/lib/Types/Chat.js +7 -7
  32. package/lib/Types/Contact.js +1 -1
  33. package/lib/Types/Events.js +1 -1
  34. package/lib/Types/GroupMetadata.js +1 -1
  35. package/lib/Types/Label.js +24 -24
  36. package/lib/Types/LabelAssociation.js +6 -6
  37. package/lib/Types/Message.js +10 -10
  38. package/lib/Types/Newsletter.js +37 -29
  39. package/lib/Types/Product.js +1 -1
  40. package/lib/Types/Signal.js +1 -1
  41. package/lib/Types/Socket.js +2 -2
  42. package/lib/Types/State.js +55 -12
  43. package/lib/Types/USync.js +1 -1
  44. package/lib/Types/index.js +25 -25
  45. package/lib/Utils/auth-utils.js +264 -256
  46. package/lib/Utils/baileys-event-stream.js +55 -55
  47. package/lib/Utils/browser-utils.js +27 -27
  48. package/lib/Utils/business.js +228 -230
  49. package/lib/Utils/chat-utils.js +726 -764
  50. package/lib/Utils/companion-reg-client-utils.js +34 -0
  51. package/lib/Utils/crypto.js +109 -135
  52. package/lib/Utils/decode-wa-message.js +342 -314
  53. package/lib/Utils/event-buffer.js +547 -547
  54. package/lib/Utils/generics.js +295 -297
  55. package/lib/Utils/history.js +91 -83
  56. package/lib/Utils/index.js +25 -20
  57. package/lib/Utils/key-store.js +17 -0
  58. package/lib/Utils/link-preview.js +107 -98
  59. package/lib/Utils/logger.js +2 -2
  60. package/lib/Utils/lt-hash.js +47 -47
  61. package/lib/Utils/make-mutex.js +39 -39
  62. package/lib/Utils/message-retry-manager.js +148 -148
  63. package/lib/Utils/messages-media.js +579 -535
  64. package/lib/Utils/messages.js +821 -706
  65. package/lib/Utils/noise-handler.js +255 -255
  66. package/lib/Utils/pre-key-manager.js +105 -105
  67. package/lib/Utils/process-message.js +430 -412
  68. package/lib/Utils/reporting-utils.js +155 -0
  69. package/lib/Utils/signal.js +191 -159
  70. package/lib/Utils/sync-action-utils.js +33 -0
  71. package/lib/Utils/tc-token-utils.js +162 -0
  72. package/lib/Utils/use-multi-file-auth-state.js +120 -120
  73. package/lib/Utils/validate-connection.js +194 -194
  74. package/lib/WABinary/constants.js +1306 -1300
  75. package/lib/WABinary/decode.js +237 -237
  76. package/lib/WABinary/encode.js +232 -232
  77. package/lib/WABinary/generic-utils.js +252 -211
  78. package/lib/WABinary/index.js +6 -5
  79. package/lib/WABinary/jid-utils.js +279 -95
  80. package/lib/WABinary/types.js +1 -1
  81. package/lib/WAM/BinaryInfo.js +9 -9
  82. package/lib/WAM/constants.js +22852 -22852
  83. package/lib/WAM/encode.js +149 -149
  84. package/lib/WAM/index.js +3 -3
  85. package/lib/WAUSync/Protocols/USyncContactProtocol.js +28 -28
  86. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +53 -53
  87. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +26 -26
  88. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +37 -37
  89. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +50 -50
  90. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +28 -28
  91. package/lib/WAUSync/Protocols/index.js +4 -4
  92. package/lib/WAUSync/USyncQuery.js +93 -93
  93. package/lib/WAUSync/USyncUser.js +22 -22
  94. package/lib/WAUSync/index.js +3 -3
  95. package/lib/index.js +65 -66
  96. package/package.json +172 -143
  97. package/lib/Signal/Group/ciphertext-message.js +0 -12
  98. package/lib/Signal/Group/group-session-builder.js +0 -30
  99. package/lib/Signal/Group/group_cipher.js +0 -100
  100. package/lib/Signal/Group/index.js +0 -12
  101. package/lib/Signal/Group/keyhelper.js +0 -18
  102. package/lib/Signal/Group/sender-chain-key.js +0 -26
  103. package/lib/Signal/Group/sender-key-distribution-message.js +0 -63
  104. package/lib/Signal/Group/sender-key-message.js +0 -66
  105. package/lib/Signal/Group/sender-key-name.js +0 -48
  106. package/lib/Signal/Group/sender-key-record.js +0 -41
  107. package/lib/Signal/Group/sender-key-state.js +0 -84
  108. package/lib/Signal/Group/sender-message-key.js +0 -26
@@ -1,195 +1,195 @@
1
- import { Boom } from '@hapi/boom';
2
- import { createHash } from 'crypto';
3
- import { proto } from '../../WAProto/index.js';
4
- import { KEY_BUNDLE_TYPE, WA_ADV_ACCOUNT_SIG_PREFIX, WA_ADV_DEVICE_SIG_PREFIX, WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX } from '../Defaults/index.js';
5
- import { getBinaryNodeChild, jidDecode, S_WHATSAPP_NET } from '../WABinary/index.js';
6
- import { Curve, hmacSign } from './crypto.js';
7
- import { encodeBigEndian } from './generics.js';
8
- import { createSignalIdentity } from './signal.js';
9
- const getUserAgent = (config) => {
10
- return {
11
- appVersion: {
12
- primary: config.version[0],
13
- secondary: config.version[1],
14
- tertiary: config.version[2]
15
- },
16
- platform: proto.ClientPayload.UserAgent.Platform.WEB,
17
- releaseChannel: proto.ClientPayload.UserAgent.ReleaseChannel.RELEASE,
18
- osVersion: '0.1',
19
- device: 'Desktop',
20
- osBuildNumber: '0.1',
21
- localeLanguageIso6391: 'en',
22
- mnc: '000',
23
- mcc: '000',
24
- localeCountryIso31661Alpha2: config.countryCode
25
- };
26
- };
27
- const PLATFORM_MAP = {
28
- 'Mac OS': proto.ClientPayload.WebInfo.WebSubPlatform.DARWIN,
29
- Windows: proto.ClientPayload.WebInfo.WebSubPlatform.WIN32
30
- };
31
- const getWebInfo = (config) => {
32
- let webSubPlatform = proto.ClientPayload.WebInfo.WebSubPlatform.WEB_BROWSER;
33
- if (config.syncFullHistory &&
34
- PLATFORM_MAP[config.browser[0]] &&
35
- config.browser[1] === 'Desktop') {
36
- webSubPlatform = PLATFORM_MAP[config.browser[0]];
37
- }
38
- return { webSubPlatform };
39
- };
40
- const getClientPayload = (config) => {
41
- const payload = {
42
- connectType: proto.ClientPayload.ConnectType.WIFI_UNKNOWN,
43
- connectReason: proto.ClientPayload.ConnectReason.USER_ACTIVATED,
44
- userAgent: getUserAgent(config)
45
- };
46
- payload.webInfo = getWebInfo(config);
47
- return payload;
48
- };
49
- export const generateLoginNode = (userJid, config) => {
50
- const { user, device } = jidDecode(userJid);
51
- const payload = {
52
- ...getClientPayload(config),
53
- passive: true,
54
- pull: true,
55
- username: +user,
56
- device: device,
57
- // TODO: investigate (hard set as false atm)
58
- lidDbMigrated: false
59
- };
60
- return proto.ClientPayload.fromObject(payload);
61
- };
62
- const getPlatformType = (platform) => {
63
- const platformType = platform.toUpperCase();
64
- return (proto.DeviceProps.PlatformType[platformType] ||
65
- proto.DeviceProps.PlatformType.CHROME);
66
- };
67
- export const generateRegistrationNode = ({ registrationId, signedPreKey, signedIdentityKey }, config) => {
68
- // the app version needs to be md5 hashed
69
- // and passed in
70
- const appVersionBuf = createHash('md5')
71
- .update(config.version.join('.')) // join as string
72
- .digest();
73
- const companion = {
74
- os: config.browser[0],
75
- platformType: getPlatformType(config.browser[1]),
76
- requireFullSync: config.syncFullHistory,
77
- historySyncConfig: {
78
- storageQuotaMb: 569150,
79
- inlineInitialPayloadInE2EeMsg: true,
80
- supportCallLogHistory: false,
81
- supportBotUserAgentChatHistory: true,
82
- supportCagReactionsAndPolls: true,
83
- supportBizHostedMsg: true,
84
- supportRecentSyncChunkMessageCountTuning: true,
85
- supportHostedGroupMsg: true,
86
- supportFbidBotChatHistory: true,
87
- supportMessageAssociation: true
88
- },
89
- version: {
90
- primary: 10,
91
- secondary: 15,
92
- tertiary: 7
93
- }
94
- };
95
- const companionProto = proto.DeviceProps.encode(companion).finish();
96
- const registerPayload = {
97
- ...getClientPayload(config),
98
- passive: false,
99
- pull: false,
100
- devicePairingData: {
101
- buildHash: appVersionBuf,
102
- deviceProps: companionProto,
103
- eRegid: encodeBigEndian(registrationId),
104
- eKeytype: KEY_BUNDLE_TYPE,
105
- eIdent: signedIdentityKey.public,
106
- eSkeyId: encodeBigEndian(signedPreKey.keyId, 3),
107
- eSkeyVal: signedPreKey.keyPair.public,
108
- eSkeySig: signedPreKey.signature
109
- }
110
- };
111
- return proto.ClientPayload.fromObject(registerPayload);
112
- };
113
- export const configureSuccessfulPairing = (stanza, { advSecretKey, signedIdentityKey, signalIdentities }) => {
114
- const msgId = stanza.attrs.id;
115
- const pairSuccessNode = getBinaryNodeChild(stanza, 'pair-success');
116
- const deviceIdentityNode = getBinaryNodeChild(pairSuccessNode, 'device-identity');
117
- const platformNode = getBinaryNodeChild(pairSuccessNode, 'platform');
118
- const deviceNode = getBinaryNodeChild(pairSuccessNode, 'device');
119
- const businessNode = getBinaryNodeChild(pairSuccessNode, 'biz');
120
- if (!deviceIdentityNode || !deviceNode) {
121
- throw new Boom('Missing device-identity or device in pair success node', { data: stanza });
122
- }
123
- const bizName = businessNode?.attrs.name;
124
- const jid = deviceNode.attrs.jid;
125
- const lid = deviceNode.attrs.lid;
126
- const { details, hmac, accountType } = proto.ADVSignedDeviceIdentityHMAC.decode(deviceIdentityNode.content);
127
- let hmacPrefix = Buffer.from([]);
128
- if (accountType !== undefined && accountType === proto.ADVEncryptionType.HOSTED) {
129
- hmacPrefix = WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX;
130
- }
131
- const advSign = hmacSign(Buffer.concat([hmacPrefix, details]), Buffer.from(advSecretKey, 'base64'));
132
- if (Buffer.compare(hmac, advSign) !== 0) {
133
- throw new Boom('Invalid account signature');
134
- }
135
- const account = proto.ADVSignedDeviceIdentity.decode(details);
136
- const { accountSignatureKey, accountSignature, details: deviceDetails } = account;
137
- const deviceIdentity = proto.ADVDeviceIdentity.decode(deviceDetails);
138
- const accountSignaturePrefix = deviceIdentity.deviceType === proto.ADVEncryptionType.HOSTED
139
- ? WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX
140
- : WA_ADV_ACCOUNT_SIG_PREFIX;
141
- const accountMsg = Buffer.concat([accountSignaturePrefix, deviceDetails, signedIdentityKey.public]);
142
- if (!Curve.verify(accountSignatureKey, accountMsg, accountSignature)) {
143
- throw new Boom('Failed to verify account signature');
144
- }
145
- const deviceMsg = Buffer.concat([
146
- WA_ADV_DEVICE_SIG_PREFIX,
147
- deviceDetails,
148
- signedIdentityKey.public,
149
- accountSignatureKey
150
- ]);
151
- account.deviceSignature = Curve.sign(signedIdentityKey.private, deviceMsg);
152
- const identity = createSignalIdentity(lid, accountSignatureKey);
153
- const accountEnc = encodeSignedDeviceIdentity(account, false);
154
- const reply = {
155
- tag: 'iq',
156
- attrs: {
157
- to: S_WHATSAPP_NET,
158
- type: 'result',
159
- id: msgId
160
- },
161
- content: [
162
- {
163
- tag: 'pair-device-sign',
164
- attrs: {},
165
- content: [
166
- {
167
- tag: 'device-identity',
168
- attrs: { 'key-index': deviceIdentity.keyIndex.toString() },
169
- content: accountEnc
170
- }
171
- ]
172
- }
173
- ]
174
- };
175
- const authUpdate = {
176
- account,
177
- me: { id: jid, name: bizName, lid },
178
- signalIdentities: [...(signalIdentities || []), identity],
179
- platform: platformNode?.attrs.name
180
- };
181
- return {
182
- creds: authUpdate,
183
- reply
184
- };
185
- };
186
- export const encodeSignedDeviceIdentity = (account, includeSignatureKey) => {
187
- account = { ...account };
188
- // set to null if we are not to include the signature key
189
- // or if we are including the signature key but it is empty
190
- if (!includeSignatureKey || !account.accountSignatureKey?.length) {
191
- account.accountSignatureKey = null;
192
- }
193
- return proto.ADVSignedDeviceIdentity.encode(account).finish();
194
- };
1
+ import { Boom } from '@hapi/boom';
2
+ import { createHash } from 'crypto';
3
+ import { proto } from '../../WAProto/index.js';
4
+ import { KEY_BUNDLE_TYPE, WA_ADV_ACCOUNT_SIG_PREFIX, WA_ADV_DEVICE_SIG_PREFIX, WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX } from '../Defaults/index.js';
5
+ import { getBinaryNodeChild, jidDecode, S_WHATSAPP_NET } from '../WABinary/index.js';
6
+ import { Curve, hmacSign } from './crypto.js';
7
+ import { encodeBigEndian } from './generics.js';
8
+ import { createSignalIdentity } from './signal.js';
9
+ const getUserAgent = (config) => {
10
+ return {
11
+ appVersion: {
12
+ primary: config.version[0],
13
+ secondary: config.version[1],
14
+ tertiary: config.version[2]
15
+ },
16
+ platform: proto.ClientPayload.UserAgent.Platform.WEB,
17
+ releaseChannel: proto.ClientPayload.UserAgent.ReleaseChannel.RELEASE,
18
+ osVersion: '0.1',
19
+ device: 'Desktop',
20
+ osBuildNumber: '0.1',
21
+ localeLanguageIso6391: 'en',
22
+ mnc: '000',
23
+ mcc: '000',
24
+ localeCountryIso31661Alpha2: config.countryCode
25
+ };
26
+ };
27
+ const PLATFORM_MAP = {
28
+ 'Mac OS': proto.ClientPayload.WebInfo.WebSubPlatform.DARWIN,
29
+ Windows: proto.ClientPayload.WebInfo.WebSubPlatform.WIN32
30
+ };
31
+ const getWebInfo = (config) => {
32
+ let webSubPlatform = proto.ClientPayload.WebInfo.WebSubPlatform.WEB_BROWSER;
33
+ if (config.syncFullHistory &&
34
+ PLATFORM_MAP[config.browser[0]] &&
35
+ config.browser[1] === 'Desktop') {
36
+ webSubPlatform = PLATFORM_MAP[config.browser[0]];
37
+ }
38
+ return { webSubPlatform };
39
+ };
40
+ const getClientPayload = (config) => {
41
+ const payload = {
42
+ connectType: proto.ClientPayload.ConnectType.WIFI_UNKNOWN,
43
+ connectReason: proto.ClientPayload.ConnectReason.USER_ACTIVATED,
44
+ userAgent: getUserAgent(config)
45
+ };
46
+ payload.webInfo = getWebInfo(config);
47
+ return payload;
48
+ };
49
+ export const generateLoginNode = (userJid, config) => {
50
+ const { user, device } = jidDecode(userJid);
51
+ const payload = {
52
+ ...getClientPayload(config),
53
+ passive: true,
54
+ pull: true,
55
+ username: +user,
56
+ device: device,
57
+ // TODO: investigate (hard set as false atm)
58
+ lidDbMigrated: false
59
+ };
60
+ return proto.ClientPayload.fromObject(payload);
61
+ };
62
+ const getPlatformType = (platform) => {
63
+ const platformType = platform.toUpperCase();
64
+ return (proto.DeviceProps.PlatformType[platformType] ||
65
+ proto.DeviceProps.PlatformType.CHROME);
66
+ };
67
+ export const generateRegistrationNode = ({ registrationId, signedPreKey, signedIdentityKey }, config) => {
68
+ // the app version needs to be md5 hashed
69
+ // and passed in
70
+ const appVersionBuf = createHash('md5')
71
+ .update(config.version.join('.')) // join as string
72
+ .digest();
73
+ const companion = {
74
+ os: config.browser[0],
75
+ platformType: getPlatformType(config.browser[1]),
76
+ requireFullSync: config.syncFullHistory,
77
+ historySyncConfig: {
78
+ storageQuotaMb: 569150,
79
+ inlineInitialPayloadInE2EeMsg: true,
80
+ supportCallLogHistory: false,
81
+ supportBotUserAgentChatHistory: true,
82
+ supportCagReactionsAndPolls: true,
83
+ supportBizHostedMsg: true,
84
+ supportRecentSyncChunkMessageCountTuning: true,
85
+ supportHostedGroupMsg: true,
86
+ supportFbidBotChatHistory: true,
87
+ supportMessageAssociation: true
88
+ },
89
+ version: {
90
+ primary: 10,
91
+ secondary: 15,
92
+ tertiary: 7
93
+ }
94
+ };
95
+ const companionProto = proto.DeviceProps.encode(companion).finish();
96
+ const registerPayload = {
97
+ ...getClientPayload(config),
98
+ passive: false,
99
+ pull: false,
100
+ devicePairingData: {
101
+ buildHash: appVersionBuf,
102
+ deviceProps: companionProto,
103
+ eRegid: encodeBigEndian(registrationId),
104
+ eKeytype: KEY_BUNDLE_TYPE,
105
+ eIdent: signedIdentityKey.public,
106
+ eSkeyId: encodeBigEndian(signedPreKey.keyId, 3),
107
+ eSkeyVal: signedPreKey.keyPair.public,
108
+ eSkeySig: signedPreKey.signature
109
+ }
110
+ };
111
+ return proto.ClientPayload.fromObject(registerPayload);
112
+ };
113
+ export const configureSuccessfulPairing = (stanza, { advSecretKey, signedIdentityKey, signalIdentities }) => {
114
+ const msgId = stanza.attrs.id;
115
+ const pairSuccessNode = getBinaryNodeChild(stanza, 'pair-success');
116
+ const deviceIdentityNode = getBinaryNodeChild(pairSuccessNode, 'device-identity');
117
+ const platformNode = getBinaryNodeChild(pairSuccessNode, 'platform');
118
+ const deviceNode = getBinaryNodeChild(pairSuccessNode, 'device');
119
+ const businessNode = getBinaryNodeChild(pairSuccessNode, 'biz');
120
+ if (!deviceIdentityNode || !deviceNode) {
121
+ throw new Boom('Missing device-identity or device in pair success node', { data: stanza });
122
+ }
123
+ const bizName = businessNode?.attrs.name;
124
+ const jid = deviceNode.attrs.jid;
125
+ const lid = deviceNode.attrs.lid;
126
+ const { details, hmac, accountType } = proto.ADVSignedDeviceIdentityHMAC.decode(deviceIdentityNode.content);
127
+ let hmacPrefix = Buffer.from([]);
128
+ if (accountType !== undefined && accountType === proto.ADVEncryptionType.HOSTED) {
129
+ hmacPrefix = WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX;
130
+ }
131
+ const advSign = hmacSign(Buffer.concat([hmacPrefix, details]), Buffer.from(advSecretKey, 'base64'));
132
+ if (Buffer.compare(hmac, advSign) !== 0) {
133
+ throw new Boom('Invalid account signature');
134
+ }
135
+ const account = proto.ADVSignedDeviceIdentity.decode(details);
136
+ const { accountSignatureKey, accountSignature, details: deviceDetails } = account;
137
+ const deviceIdentity = proto.ADVDeviceIdentity.decode(deviceDetails);
138
+ const accountSignaturePrefix = deviceIdentity.deviceType === proto.ADVEncryptionType.HOSTED
139
+ ? WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX
140
+ : WA_ADV_ACCOUNT_SIG_PREFIX;
141
+ const accountMsg = Buffer.concat([accountSignaturePrefix, deviceDetails, signedIdentityKey.public]);
142
+ if (!Curve.verify(accountSignatureKey, accountMsg, accountSignature)) {
143
+ throw new Boom('Failed to verify account signature');
144
+ }
145
+ const deviceMsg = Buffer.concat([
146
+ WA_ADV_DEVICE_SIG_PREFIX,
147
+ deviceDetails,
148
+ signedIdentityKey.public,
149
+ accountSignatureKey
150
+ ]);
151
+ account.deviceSignature = Curve.sign(signedIdentityKey.private, deviceMsg);
152
+ const identity = createSignalIdentity(lid, accountSignatureKey);
153
+ const accountEnc = encodeSignedDeviceIdentity(account, false);
154
+ const reply = {
155
+ tag: 'iq',
156
+ attrs: {
157
+ to: S_WHATSAPP_NET,
158
+ type: 'result',
159
+ id: msgId
160
+ },
161
+ content: [
162
+ {
163
+ tag: 'pair-device-sign',
164
+ attrs: {},
165
+ content: [
166
+ {
167
+ tag: 'device-identity',
168
+ attrs: { 'key-index': deviceIdentity.keyIndex.toString() },
169
+ content: accountEnc
170
+ }
171
+ ]
172
+ }
173
+ ]
174
+ };
175
+ const authUpdate = {
176
+ account,
177
+ me: { id: jid, name: bizName, lid },
178
+ signalIdentities: [...(signalIdentities || []), identity],
179
+ platform: platformNode?.attrs.name
180
+ };
181
+ return {
182
+ creds: authUpdate,
183
+ reply
184
+ };
185
+ };
186
+ export const encodeSignedDeviceIdentity = (account, includeSignatureKey) => {
187
+ account = { ...account };
188
+ // set to null if we are not to include the signature key
189
+ // or if we are including the signature key but it is empty
190
+ if (!includeSignatureKey || !account.accountSignatureKey?.length) {
191
+ account.accountSignatureKey = null;
192
+ }
193
+ return proto.ADVSignedDeviceIdentity.encode(account).finish();
194
+ };
195
195
  //# sourceMappingURL=validate-connection.js.map