diff --git a/mirai-core/src/commonMain/kotlin/network/components/EcdhInitialPublicKeyUpdater.kt b/mirai-core/src/commonMain/kotlin/network/components/EcdhInitialPublicKeyUpdater.kt index ea6c30efa..6696f041e 100644 --- a/mirai-core/src/commonMain/kotlin/network/components/EcdhInitialPublicKeyUpdater.kt +++ b/mirai-core/src/commonMain/kotlin/network/components/EcdhInitialPublicKeyUpdater.kt @@ -123,6 +123,7 @@ internal class EcdhInitialPublicKeyUpdaterImpl( set(EncryptServiceContext.KEY_CHANNEL_PROXY, createChannelProxy(bot)) set(EncryptServiceContext.KEY_DEVICE_INFO, bot.client.device) set(EncryptServiceContext.KEY_BOT_PROTOCOL, bot.configuration.protocol) + set(EncryptServiceContext.KEY_QIMEI36, bot.client.qimei36 ?: "") })) } diff --git a/mirai-core/src/commonMain/kotlin/network/components/SsoProcessor.kt b/mirai-core/src/commonMain/kotlin/network/components/SsoProcessor.kt index 355ffcb24..69964933f 100644 --- a/mirai-core/src/commonMain/kotlin/network/components/SsoProcessor.kt +++ b/mirai-core/src/commonMain/kotlin/network/components/SsoProcessor.kt @@ -213,7 +213,6 @@ internal open class SsoProcessorImpl( components[CacheValidator].validate() components[BdhSessionSyncer].loadServerListFromCache() - components[EcdhInitialPublicKeyUpdater].initializeSsoSecureEcdh() try { ssoContext.bot.requestQimei(qimeiLogger) @@ -221,6 +220,9 @@ internal open class SsoProcessorImpl( qimeiLogger.warning("Cannot get qimei from server.", exception) } + // trpc ecdh service needs qimei to init + components[EcdhInitialPublicKeyUpdater].initializeSsoSecureEcdh() + // try fast login if (client.wLoginSigInfoInitialized) { ssoContext.bot.components[EcdhInitialPublicKeyUpdater].refreshInitialPublicKeyAndApplyEcdh() 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 c86f5db91..01211713c 100644 --- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/OutgoingPacket.kt +++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/OutgoingPacket.kt @@ -325,6 +325,7 @@ internal inline fun BytePacketBuilder.writeSsoPacket( 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_QIMEI36, client.qimei36 ?: "") }), sequenceId, commandName, diff --git a/mirai-core/src/commonMain/kotlin/spi/EncryptService.kt b/mirai-core/src/commonMain/kotlin/spi/EncryptService.kt index e54c65c18..ccbd1c9c0 100644 --- a/mirai-core/src/commonMain/kotlin/spi/EncryptService.kt +++ b/mirai-core/src/commonMain/kotlin/spi/EncryptService.kt @@ -32,6 +32,7 @@ public class EncryptServiceContext @MiraiInternalApi constructor( public val KEY_APP_QUA: TypeKey = TypeKey("KEY_APP_QUA") public val KEY_CHANNEL_PROXY: TypeKey = TypeKey("KEY_CHANNEL_PROXY") public val KEY_DEVICE_INFO: TypeKey = TypeKey("KEY_DEVICE_INFO") + public val KEY_QIMEI36: TypeKey = TypeKey("KEY_QIMEI36") } }