diff --git a/src/Socket/chats.ts b/src/Socket/chats.ts index 286506ddb3d..00f33ebe2fc 100644 --- a/src/Socket/chats.ts +++ b/src/Socket/chats.ts @@ -715,32 +715,6 @@ export const makeChatsSocket = (config: SocketConfig) => { } } - /** sending abt props may fix QR scan fail if server expects */ - const fetchAbt = async() => { - const abtNode = await query({ - tag: 'iq', - attrs: { - to: S_WHATSAPP_NET, - xmlns: 'abt', - type: 'get', - }, - content: [ - { tag: 'props', attrs: { protocol: '1' } } - ] - }) - - const propsNode = getBinaryNodeChild(abtNode, 'props') - - let props: { [_: string]: string } = {} - if(propsNode) { - props = reduceBinaryNodeToDictionary(propsNode, 'prop') - } - - logger.debug('fetched abt') - - return props - } - /** sending non-abt props may fix QR scan fail if server expects */ const fetchProps = async() => { const resultNode = await query({ @@ -751,14 +725,20 @@ export const makeChatsSocket = (config: SocketConfig) => { type: 'get', }, content: [ - { tag: 'props', attrs: {} } + { tag: 'props', attrs: { + protocol: 2, + hash: authState?.creds?.lastPropHash || "" + } } ] }) const propsNode = getBinaryNodeChild(resultNode, 'props') - + + let props: { [_: string]: string } = {} if(propsNode) { + authState?.creds?.lastPropHash = propsNode?.attrs?.hash + ev.emit('creds.update', authState.creds) props = reduceBinaryNodeToDictionary(propsNode, 'prop') } @@ -841,7 +821,6 @@ export const makeChatsSocket = (config: SocketConfig) => { * */ const executeInitQueries = async() => { await Promise.all([ - fetchAbt(), fetchProps(), fetchBlocklist(), fetchPrivacySettings(), diff --git a/src/Types/Auth.ts b/src/Types/Auth.ts index 2b853a2fe8b..a353521ef22 100644 --- a/src/Types/Auth.ts +++ b/src/Types/Auth.ts @@ -68,6 +68,7 @@ export type AuthenticationCreds = SignalCreds & { backupToken: Buffer registration: RegistrationOptions pairingCode: string | undefined + lastPropHash: string | undefined } export type SignalDataTypeMap = { diff --git a/src/Utils/auth-utils.ts b/src/Utils/auth-utils.ts index 4424e9eaeb9..cc8f5e4e57a 100644 --- a/src/Utils/auth-utils.ts +++ b/src/Utils/auth-utils.ts @@ -216,5 +216,6 @@ export const initAuthCreds = (): AuthenticationCreds => { backupToken: randomBytes(20), registration: {} as never, pairingCode: undefined, + lastPropHash: undefined, } } \ No newline at end of file