From 4b7ba2c0ad42998543b9baf2c9f58a0fe41e8286 Mon Sep 17 00:00:00 2001 From: RendyCraft047 <75566525+RC047@users.noreply.github.com> Date: Fri, 27 Mar 2026 17:36:15 +0700 Subject: [PATCH 1/2] update module store --- src/Client.js | 69 ++++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/src/Client.js b/src/Client.js index ed2392db49..da3eea9890 100644 --- a/src/Client.js +++ b/src/Client.js @@ -12,7 +12,6 @@ const { WAState, MessageTypes, } = require('./util/Constants'); -const { ExposeAuthStore } = require('./util/Injected/AuthStore/AuthStore'); const { LoadUtils } = require('./util/Injected/Utils'); const ChatFactory = require('./factories/ChatFactory'); const ContactFactory = require('./factories/ContactFactory'); @@ -140,8 +139,6 @@ class Client extends EventEmitter { const pairWithPhoneNumber = this.options.pairWithPhoneNumber; const version = await this.getWWebVersion(); - await this.pupPage.evaluate(ExposeAuthStore); - const needAuthentication = await this.pupPage.evaluate(async () => { let state = window.require('WAWebSocketModel').Socket.state; @@ -244,19 +241,21 @@ class Client extends EventEmitter { ); await this.pupPage.evaluate(async () => { - const registrationInfo = - await window.AuthStore.RegistrationUtils.waSignalStore.getRegistrationInfo(); - const noiseKeyPair = - await window.AuthStore.RegistrationUtils.waNoiseInfo.get(); - const staticKeyB64 = window.AuthStore.Base64Tools.encodeB64( - noiseKeyPair.staticKeyPair.pubKey, - ); - const identityKeyB64 = - window.AuthStore.Base64Tools.encodeB64( - registrationInfo.identityKeyPair.pubKey, - ); - const platform = - window.AuthStore.RegistrationUtils.DEVICE_PLATFORM; + const registrationInfo = await window + .require('WAWebSignalStoreApi') + .waSignalStore.getRegistrationInfo(); + const noiseKeyPair = await window + .require('WAWebUserPrefsInfoStore') + .waNoiseInfo.get(); + const staticKeyB64 = window + .require('WABase64') + .encodeB64(noiseKeyPair.staticKeyPair.pubKey); + const identityKeyB64 = window + .require('WABase64') + .encodeB64(registrationInfo.identityKeyPair.pubKey); + const platform = window.require( + 'WAWebCompanionRegClientUtils', + ).DEVICE_PLATFORM; const getQR = (ref) => ref + ',' + @@ -269,10 +268,14 @@ class Client extends EventEmitter { .getADVSecretKey() + ',' + platform; - window.onQRChangedEvent(getQR(window.AuthStore.Conn.ref)); // initial qr - window.AuthStore.Conn.on('change:ref', (_, ref) => { - window.onQRChangedEvent(getQR(ref)); - }); // future QR changes + window.onQRChangedEvent( + getQR(window.require('WAWebConnModel').Conn.ref), + ); // initial qr + window + .require('WAWebConnModel') + .Conn.on('change:ref', (_, ref) => { + window.onQRChangedEvent(getQR(ref)); + }); // future QR changes }); } } @@ -410,7 +413,9 @@ class Client extends EventEmitter { const Cmd = window.require('WAWebCmd').Cmd; Cmd.on('offline_progress_update_from_bridge', () => { window.onOfflineProgressUpdateEvent( - window.AuthStore.OfflineMessageHandler.getOfflineDeliveryProgress(), + window + .require('WAWebOfflineHandler') + .OfflineMessageHandler.getOfflineDeliveryProgress(), ); }); Cmd.on('logout', async () => { @@ -526,19 +531,15 @@ class Client extends EventEmitter { return await this.pupPage.evaluate( async (phoneNumber, showNotification, intervalMs) => { const getCode = async () => { - while (!window.AuthStore.PairingCodeLinkUtils) { - await new Promise((resolve) => - setTimeout(resolve, 250), - ); - } - window.AuthStore.PairingCodeLinkUtils.setPairingType( - 'ALT_DEVICE_LINKING', - ); - await window.AuthStore.PairingCodeLinkUtils.initializeAltDeviceLinking(); - return window.AuthStore.PairingCodeLinkUtils.startAltLinkingFlow( - phoneNumber, - showNotification, - ); + window + .require('WAWebAltDeviceLinkingApi') + .setPairingType('ALT_DEVICE_LINKING'); + await window + .require('WAWebAltDeviceLinkingApi') + .initializeAltDeviceLinking(); + return window + .require('WAWebAltDeviceLinkingApi') + .startAltLinkingFlow(phoneNumber, showNotification); }; if (window.codeInterval) { clearInterval(window.codeInterval); // remove existing interval From b254d973a35bcb8864e77a58721204fc73a2f131 Mon Sep 17 00:00:00 2001 From: RendyCraft047 <75566525+RC047@users.noreply.github.com> Date: Fri, 27 Mar 2026 17:37:39 +0700 Subject: [PATCH 2/2] delete auth stores directory --- src/util/Injected/AuthStore/AuthStore.js | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 src/util/Injected/AuthStore/AuthStore.js diff --git a/src/util/Injected/AuthStore/AuthStore.js b/src/util/Injected/AuthStore/AuthStore.js deleted file mode 100644 index 9c4644d7d9..0000000000 --- a/src/util/Injected/AuthStore/AuthStore.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; - -exports.ExposeAuthStore = () => { - window.AuthStore = {}; - window.AuthStore.AppState = window.require('WAWebSocketModel').Socket; - window.AuthStore.Cmd = window.require('WAWebCmd').Cmd; - window.AuthStore.Conn = window.require('WAWebConnModel').Conn; - window.AuthStore.OfflineMessageHandler = window.require( - 'WAWebOfflineHandler', - ).OfflineMessageHandler; - window.AuthStore.PairingCodeLinkUtils = window.require( - 'WAWebAltDeviceLinkingApi', - ); - window.AuthStore.Base64Tools = window.require('WABase64'); - window.AuthStore.RegistrationUtils = { - ...window.require('WAWebCompanionRegClientUtils'), - ...window.require('WAWebAdvSignatureApi'), - ...window.require('WAWebUserPrefsInfoStore'), - ...window.require('WAWebSignalStoreApi'), - }; -};