diff --git a/src/Defaults/index.ts b/src/Defaults/index.ts index adccb124..91c88bc5 100644 --- a/src/Defaults/index.ts +++ b/src/Defaults/index.ts @@ -70,7 +70,7 @@ export const DEFAULT_CONNECTION_CONFIG: SocketConfig = { patch: false, snapshot: false }, - countryCode: 'US', + countryCode: 'GB', getMessage: async () => undefined, cachedGroupMetadata: async () => undefined, makeSignalRepository: makeLibSignalRepository diff --git a/src/Socket/messages-recv.ts b/src/Socket/messages-recv.ts index e6d8b4b6..942961c7 100644 --- a/src/Socket/messages-recv.ts +++ b/src/Socket/messages-recv.ts @@ -6,7 +6,6 @@ import { proto } from '../../WAProto/index.js' import { DEFAULT_CACHE_TTLS, KEY_BUNDLE_TYPE, MIN_PREKEY_COUNT } from '../Defaults' import type { GroupParticipant, - LIDMapping, MessageReceiptType, MessageRelayOptions, MessageUserReceipt, diff --git a/src/Socket/socket.ts b/src/Socket/socket.ts index 0cdc2648..4b2dc1dc 100644 --- a/src/Socket/socket.ts +++ b/src/Socket/socket.ts @@ -45,6 +45,7 @@ import { jidEncode, S_WHATSAPP_NET } from '../WABinary' +import { BinaryInfo } from '../WAM/BinaryInfo.js' import { USyncQuery, USyncUser } from '../WAUSync/' import { WebSocketClient } from './Client' @@ -70,6 +71,8 @@ export const makeSocket = (config: SocketConfig) => { makeSignalRepository } = config + const publicWAMBuffer = new BinaryInfo() + const uqTagId = generateMdTagPrefix() const generateMessageTag = () => `${uqTagId}${epoch++}` @@ -1000,6 +1003,7 @@ export const makeSocket = (config: SocketConfig) => { uploadPreKeys, uploadPreKeysToServerIfRequired, requestPairingCode, + wamBuffer: publicWAMBuffer, /** Waits for the connection to WA to reach a state */ waitForConnectionUpdate: bindWaitForConnectionUpdate(ev), sendWAMBuffer, diff --git a/src/Utils/validate-connection.ts b/src/Utils/validate-connection.ts index ea4aacd8..51149fb4 100644 --- a/src/Utils/validate-connection.ts +++ b/src/Utils/validate-connection.ts @@ -62,10 +62,12 @@ export const generateLoginNode = (userJid: string, config: SocketConfig): proto. const { user, device } = jidDecode(userJid)! const payload: proto.IClientPayload = { ...getClientPayload(config), - passive: false, + passive: true, pull: true, username: +user, - device: device + device: device, + // TODO: investigate (hard set as false atm) + lidDbMigrated: false } return proto.ClientPayload.fromObject(payload) } @@ -74,7 +76,7 @@ const getPlatformType = (platform: string): proto.DeviceProps.PlatformType => { const platformType = platform.toUpperCase() return ( proto.DeviceProps.PlatformType[platformType as keyof typeof proto.DeviceProps.PlatformType] || - proto.DeviceProps.PlatformType.DESKTOP + proto.DeviceProps.PlatformType.CHROME ) } @@ -91,14 +93,31 @@ export const generateRegistrationNode = ( const companion: proto.IDeviceProps = { os: config.browser[0], platformType: getPlatformType(config.browser[1]), - requireFullSync: config.syncFullHistory + requireFullSync: config.syncFullHistory, + historySyncConfig: { + storageQuotaMb: 569150, + inlineInitialPayloadInE2EeMsg: true, + supportCallLogHistory: false, + supportBotUserAgentChatHistory: true, + supportCagReactionsAndPolls: true, + supportBizHostedMsg: true, + supportRecentSyncChunkMessageCountTuning: true, + supportHostedGroupMsg: true, + supportFbidBotChatHistory: true, + supportMessageAssociation: true + }, + version: { + primary: 10, + secondary: 15, + tertiary: 7 + } } const companionProto = proto.DeviceProps.encode(companion).finish() const registerPayload: proto.IClientPayload = { ...getClientPayload(config), - passive: false, + passive: true, pull: false, devicePairingData: { buildHash: appVersionBuf,