From 8af6c3fcf615f4afdadf57ca510baeae487a4c43 Mon Sep 17 00:00:00 2001
From: sandtechnology <a1294790523@hotmail.com>
Date: Thu, 29 Jun 2023 13:55:37 +0800
Subject: [PATCH] Remove unused EncryptServiceContext value and pass QUA All
 final value only need to passed to initialize method

---
 .../components/EcdhInitialPublicKeyUpdater.kt      |  1 +
 .../network/protocol/packet/OutgoingPacket.kt      | 14 ++------------
 2 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/mirai-core/src/commonMain/kotlin/network/components/EcdhInitialPublicKeyUpdater.kt b/mirai-core/src/commonMain/kotlin/network/components/EcdhInitialPublicKeyUpdater.kt
index 3983bf001..1f28d4792 100644
--- a/mirai-core/src/commonMain/kotlin/network/components/EcdhInitialPublicKeyUpdater.kt
+++ b/mirai-core/src/commonMain/kotlin/network/components/EcdhInitialPublicKeyUpdater.kt
@@ -125,6 +125,7 @@ internal class EcdhInitialPublicKeyUpdaterImpl(
             set(EncryptServiceContext.KEY_DEVICE_INFO, bot.client.device)
             set(EncryptServiceContext.KEY_BOT_PROTOCOL, bot.configuration.protocol)
             set(EncryptServiceContext.KEY_QIMEI36, bot.client.qimei36 ?: "")
+            set(EncryptServiceContext.KEY_APP_QUA, "V1_AND_SQ_8.9.58_4106_YYB_D") // 8.9.58
             set(EncryptServiceContext.KEY_BOT_WORKING_DIR, bot.configuration.workingDirPath)
             set(EncryptServiceContext.KEY_BOT_CACHING_DIR, bot.configuration.actualCacheDir().absolutePath)
         }))
diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/OutgoingPacket.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/OutgoingPacket.kt
index 2f6b353ab..92da7ea5e 100644
--- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/OutgoingPacket.kt
+++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/OutgoingPacket.kt
@@ -137,12 +137,7 @@ internal fun <R : Packet?> buildRawUniPacket(
             val signDataPacket = if (encryptWorker != null) {
 
                 val signResult = encryptWorker.qSecurityGetSign(
-                    EncryptServiceContext(client.uin, buildTypeSafeMap {
-                        set(EncryptServiceContext.KEY_APP_QUA, "V1_AND_SQ_8.9.58_4106_YYB_D") // 8.9.58
-                        set(EncryptServiceContext.KEY_CHANNEL_PROXY, createChannelProxy(client.bot))
-                        set(EncryptServiceContext.KEY_DEVICE_INFO, client.device)
-                        set(EncryptServiceContext.KEY_QIMEI36, client.qimei36 ?: "")
-                    }),
+                    EncryptServiceContext(client.uin),
                     sequenceId,
                     commandName,
                     bodyBytes
@@ -376,12 +371,7 @@ internal fun BytePacketBuilder.writeSsoPacket(
     val reserveField = if (encryptWorker != null) {
 
         val signResult = encryptWorker.qSecurityGetSign(
-            EncryptServiceContext(client.uin, buildTypeSafeMap {
-                set(EncryptServiceContext.KEY_APP_QUA, "V1_AND_SQ_8.9.58_4106_YYB_D") // 8.9.58
-                set(EncryptServiceContext.KEY_CHANNEL_PROXY, createChannelProxy(client.bot))
-                set(EncryptServiceContext.KEY_DEVICE_INFO, client.device)
-                set(EncryptServiceContext.KEY_QIMEI36, client.qimei36 ?: "")
-            }),
+            EncryptServiceContext(client.uin),
             sequenceId,
             commandName,
             bodyBytes