From 90ef83e34556e1a31da619206aa7351bf8c6e959 Mon Sep 17 00:00:00 2001 From: Him188 Date: Sun, 29 Mar 2020 02:46:38 +0800 Subject: [PATCH] Move protocol-specific classes to mirai-core-qqandroid --- .../mamoe/mirai/qqandroid}/utils/cryptor/ECDHAndroid.kt | 2 +- .../kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.kt | 1 - .../net/mamoe/mirai/qqandroid/io/serialization/JceOld.kt | 4 +--- .../mirai/qqandroid/io/serialization/jce/JceInput.kt | 2 +- .../net/mamoe/mirai/qqandroid/io/serialization/utils.kt | 2 +- .../mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt | 4 ++-- .../net/mamoe/mirai/qqandroid/network/QQAndroidClient.kt | 4 ++-- .../mirai/qqandroid/network/highway/HighwayHelper.kt | 2 +- .../qqandroid/network/protocol/packet/EncryptMethod.kt | 8 ++++---- .../network/protocol/packet/OutgoingPacketAndroid.kt | 6 +++--- .../qqandroid/network/protocol/packet/PacketFactory.kt | 8 ++++++-- .../mamoe/mirai/qqandroid/network/protocol/packet/Tlv.kt | 1 + .../network/protocol/packet/chat/receive/OnlinePush.kt | 2 +- .../qqandroid/network/protocol/packet/login/WtLogin.kt | 3 ++- .../net/mamoe/mirai/qqandroid}/utils/cryptor/ECDH.kt | 2 +- .../net/mamoe/mirai/qqandroid}/utils/cryptor/TEA.kt | 2 +- .../kotlin/net/mamoe/mirai/qqandroid}/utils/io/input.kt | 5 ++++- .../kotlin/net/mamoe/mirai/qqandroid}/utils/io/output.kt | 6 +++--- .../kotlin/net/mamoe/mirai/qqandroid}/utils/numbers.kt | 2 +- .../net/mamoe/mirai/qqandroid}/utils/cryptor/ECDHJvm.kt | 8 +++++--- 20 files changed, 41 insertions(+), 33 deletions(-) rename {mirai-core/src/androidMain/kotlin/net/mamoe/mirai => mirai-core-qqandroid/src/androidMain/kotlin/net/mamoe/mirai/qqandroid}/utils/cryptor/ECDHAndroid.kt (98%) rename {mirai-core/src/commonMain/kotlin/net.mamoe.mirai => mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid}/utils/cryptor/ECDH.kt (98%) rename {mirai-core/src/commonMain/kotlin/net.mamoe.mirai => mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid}/utils/cryptor/TEA.kt (99%) rename {mirai-core/src/commonMain/kotlin/net.mamoe.mirai => mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid}/utils/io/input.kt (96%) rename {mirai-core/src/commonMain/kotlin/net.mamoe.mirai => mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid}/utils/io/output.kt (94%) rename {mirai-core/src/commonMain/kotlin/net.mamoe.mirai => mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid}/utils/numbers.kt (96%) rename {mirai-core/src/jvmMain/kotlin/net/mamoe/mirai => mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid}/utils/cryptor/ECDHJvm.kt (93%) diff --git a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/cryptor/ECDHAndroid.kt b/mirai-core-qqandroid/src/androidMain/kotlin/net/mamoe/mirai/qqandroid/utils/cryptor/ECDHAndroid.kt similarity index 98% rename from mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/cryptor/ECDHAndroid.kt rename to mirai-core-qqandroid/src/androidMain/kotlin/net/mamoe/mirai/qqandroid/utils/cryptor/ECDHAndroid.kt index b6b5a6a93..46c00f2ba 100644 --- a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/cryptor/ECDHAndroid.kt +++ b/mirai-core-qqandroid/src/androidMain/kotlin/net/mamoe/mirai/qqandroid/utils/cryptor/ECDHAndroid.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.utils.cryptor +package net.mamoe.mirai.qqandroid.utils.cryptor import android.annotation.SuppressLint import net.mamoe.mirai.utils.MiraiInternalAPI diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.kt index 23c7dc093..53c1e009c 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.kt @@ -408,7 +408,6 @@ internal abstract class QQAndroidBotBase constructor( when (response) { is MultiMsg.ApplyUp.Response.MessageTooLarge -> error("message is too large") - } is MultiMsg.ApplyUp.Response.RequireUpload -> { resId = response.proto.msgResid diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/JceOld.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/JceOld.kt index 1acaa21e2..d3eb05a7b 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/JceOld.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/JceOld.kt @@ -18,10 +18,8 @@ import kotlinx.serialization.builtins.SetSerializer import kotlinx.serialization.internal.* import kotlinx.serialization.modules.EmptyModule import kotlinx.serialization.modules.SerialModule -import kotlinx.serialization.protobuf.ProtoId import net.mamoe.mirai.qqandroid.io.JceStruct import net.mamoe.mirai.qqandroid.io.ProtoBuf -import net.mamoe.mirai.qqandroid.io.serialization.jce.Jce import net.mamoe.mirai.qqandroid.io.serialization.jce.Jce.Companion.BYTE import net.mamoe.mirai.qqandroid.io.serialization.jce.Jce.Companion.DOUBLE import net.mamoe.mirai.qqandroid.io.serialization.jce.Jce.Companion.FLOAT @@ -39,7 +37,7 @@ import net.mamoe.mirai.qqandroid.io.serialization.jce.Jce.Companion.STRUCT_END import net.mamoe.mirai.qqandroid.io.serialization.jce.Jce.Companion.ZERO_TYPE import net.mamoe.mirai.qqandroid.io.serialization.jce.JceHead import net.mamoe.mirai.qqandroid.io.serialization.jce.JceId -import net.mamoe.mirai.utils.io.readString +import net.mamoe.mirai.qqandroid.utils.io.readString import net.mamoe.mirai.utils.io.toReadPacket @PublishedApi diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/jce/JceInput.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/jce/JceInput.kt index 595b41269..fdfb7f2f2 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/jce/JceInput.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/jce/JceInput.kt @@ -11,7 +11,7 @@ package net.mamoe.mirai.qqandroid.io.serialization.jce import kotlinx.io.core.* import net.mamoe.mirai.qqandroid.io.serialization.JceCharset -import net.mamoe.mirai.utils.io.readString +import net.mamoe.mirai.qqandroid.utils.io.readString /** diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/utils.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/utils.kt index 1b72418a1..48c06f82d 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/utils.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/utils.kt @@ -25,7 +25,7 @@ import net.mamoe.mirai.qqandroid.network.protocol.data.jce.RequestPacket import net.mamoe.mirai.utils.MiraiInternalAPI import net.mamoe.mirai.utils.firstValue import net.mamoe.mirai.utils.io.read -import net.mamoe.mirai.utils.io.readPacketExact +import net.mamoe.mirai.qqandroid.utils.io.readPacketExact import net.mamoe.mirai.utils.io.toReadPacket import kotlin.jvm.JvmMultifileClass import kotlin.jvm.JvmName diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt index dda1901bc..7241c58e4 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt @@ -39,8 +39,8 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.login.WtLogin import net.mamoe.mirai.utils.* import net.mamoe.mirai.utils.io.ByteArrayPool import net.mamoe.mirai.utils.io.PlatformSocket -import net.mamoe.mirai.utils.io.readPacketExact -import net.mamoe.mirai.utils.io.useBytes +import net.mamoe.mirai.qqandroid.utils.io.readPacketExact +import net.mamoe.mirai.qqandroid.utils.io.useBytes import kotlin.coroutines.CoroutineContext import kotlin.jvm.Volatile import kotlin.time.ExperimentalTime diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidClient.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidClient.kt index da22f797b..fda220a5c 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidClient.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidClient.kt @@ -22,9 +22,9 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY import net.mamoe.mirai.qqandroid.network.protocol.packet.PacketLogger import net.mamoe.mirai.qqandroid.network.protocol.packet.Tlv import net.mamoe.mirai.qqandroid.utils.NetworkType +import net.mamoe.mirai.qqandroid.utils.cryptor.ECDH import net.mamoe.mirai.utils.* -import net.mamoe.mirai.utils.cryptor.ECDH -import net.mamoe.mirai.utils.cryptor.TEA +import net.mamoe.mirai.qqandroid.utils.cryptor.TEA import net.mamoe.mirai.utils.io.* /* diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/highway/HighwayHelper.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/highway/HighwayHelper.kt index d913d4431..03ab3af1a 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/highway/HighwayHelper.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/highway/HighwayHelper.kt @@ -33,7 +33,7 @@ import net.mamoe.mirai.utils.MiraiInternalAPI import net.mamoe.mirai.utils.copyAndClose import net.mamoe.mirai.utils.io.ByteArrayPool import net.mamoe.mirai.utils.io.PlatformSocket -import net.mamoe.mirai.utils.io.withUse +import net.mamoe.mirai.qqandroid.utils.io.withUse import kotlinx.serialization.InternalSerializationApi @OptIn(MiraiInternalAPI::class, InternalSerializationApi::class) diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/EncryptMethod.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/EncryptMethod.kt index fcafc4cda..f663a0f9a 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/EncryptMethod.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/EncryptMethod.kt @@ -14,10 +14,10 @@ import kotlinx.io.core.ByteReadPacket import kotlinx.io.core.buildPacket import kotlinx.io.core.writeFully import net.mamoe.mirai.qqandroid.network.QQAndroidClient -import net.mamoe.mirai.utils.cryptor.ECDH -import net.mamoe.mirai.utils.cryptor.ECDHKeyPair -import net.mamoe.mirai.utils.io.encryptAndWrite -import net.mamoe.mirai.utils.io.writeShortLVByteArray +import net.mamoe.mirai.qqandroid.utils.cryptor.ECDH +import net.mamoe.mirai.qqandroid.utils.cryptor.ECDHKeyPair +import net.mamoe.mirai.qqandroid.utils.io.encryptAndWrite +import net.mamoe.mirai.qqandroid.utils.io.writeShortLVByteArray @OptIn(ExperimentalUnsignedTypes::class) internal interface EncryptMethod { diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/OutgoingPacketAndroid.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/OutgoingPacketAndroid.kt index ef95247a5..1ae7d3289 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/OutgoingPacketAndroid.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/OutgoingPacketAndroid.kt @@ -16,9 +16,9 @@ import kotlinx.io.core.buildPacket import kotlinx.io.core.writeFully import net.mamoe.mirai.qqandroid.network.QQAndroidClient import net.mamoe.mirai.utils.MiraiInternalAPI -import net.mamoe.mirai.utils.io.encryptAndWrite -import net.mamoe.mirai.utils.io.writeHex -import net.mamoe.mirai.utils.io.writeIntLVPacket +import net.mamoe.mirai.qqandroid.utils.io.encryptAndWrite +import net.mamoe.mirai.qqandroid.utils.io.writeHex +import net.mamoe.mirai.qqandroid.utils.io.writeIntLVPacket internal class OutgoingPacket constructor( name: String?, diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/PacketFactory.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/PacketFactory.kt index 54556697e..4a11f2c1f 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/PacketFactory.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/PacketFactory.kt @@ -27,9 +27,13 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.login.Heartbeat import net.mamoe.mirai.qqandroid.network.protocol.packet.login.StatSvc import net.mamoe.mirai.qqandroid.network.protocol.packet.login.WtLogin import net.mamoe.mirai.qqandroid.network.readUShortLVByteArray +import net.mamoe.mirai.qqandroid.utils.io.readPacketExact +import net.mamoe.mirai.qqandroid.utils.io.readString +import net.mamoe.mirai.qqandroid.utils.io.useBytes +import net.mamoe.mirai.qqandroid.utils.io.withUse import net.mamoe.mirai.utils.* -import net.mamoe.mirai.utils.cryptor.TEA -import net.mamoe.mirai.utils.cryptor.adjustToPublicKey +import net.mamoe.mirai.qqandroid.utils.cryptor.TEA +import net.mamoe.mirai.qqandroid.utils.cryptor.adjustToPublicKey import net.mamoe.mirai.utils.io.* import kotlin.jvm.JvmName diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/Tlv.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/Tlv.kt index 91e6ab2a5..ce54b8901 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/Tlv.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/Tlv.kt @@ -17,6 +17,7 @@ import kotlinx.io.core.toByteArray import kotlinx.io.core.writeFully import net.mamoe.mirai.qqandroid.network.protocol.LoginType import net.mamoe.mirai.qqandroid.utils.NetworkType +import net.mamoe.mirai.qqandroid.utils.io.* import net.mamoe.mirai.utils.MiraiInternalAPI import net.mamoe.mirai.utils.MiraiPlatformUtils import net.mamoe.mirai.utils.currentTimeMillis diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/OnlinePush.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/OnlinePush.kt index d4c61ba14..b11c38266 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/OnlinePush.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/OnlinePush.kt @@ -38,7 +38,7 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.buildResponseUniPacket import net.mamoe.mirai.utils.MiraiInternalAPI import net.mamoe.mirai.utils.debug import net.mamoe.mirai.utils.io.read -import net.mamoe.mirai.utils.io.readString +import net.mamoe.mirai.qqandroid.utils.io.readString import net.mamoe.mirai.utils.io.toUHexString internal class OnlinePush { diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/WtLogin.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/WtLogin.kt index 8df0f0188..c8bc93354 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/WtLogin.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/WtLogin.kt @@ -20,8 +20,9 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.* import net.mamoe.mirai.qqandroid.utils.GuidSource import net.mamoe.mirai.qqandroid.utils.MacOrAndroidIdChangeFlag import net.mamoe.mirai.qqandroid.utils.guidFlag +import net.mamoe.mirai.qqandroid.utils.io.* import net.mamoe.mirai.utils.* -import net.mamoe.mirai.utils.cryptor.TEA +import net.mamoe.mirai.qqandroid.utils.cryptor.TEA import net.mamoe.mirai.utils.io.* internal class WtLogin { diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/cryptor/ECDH.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/cryptor/ECDH.kt similarity index 98% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/cryptor/ECDH.kt rename to mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/cryptor/ECDH.kt index 0b93f83b5..85434c3ab 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/cryptor/ECDH.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/cryptor/ECDH.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.utils.cryptor +package net.mamoe.mirai.qqandroid.utils.cryptor import net.mamoe.mirai.utils.io.chunkedHexToBytes diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/cryptor/TEA.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/cryptor/TEA.kt similarity index 99% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/cryptor/TEA.kt rename to mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/cryptor/TEA.kt index 3e43b3fde..ea889b47c 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/cryptor/TEA.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/cryptor/TEA.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.utils.cryptor +package net.mamoe.mirai.qqandroid.utils.cryptor import kotlinx.io.core.ByteReadPacket import kotlinx.io.pool.useInstance diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/io/input.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/input.kt similarity index 96% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/io/input.kt rename to mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/input.kt index 128fffbd0..4471a7be8 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/io/input.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/input.kt @@ -11,7 +11,7 @@ @file:JvmMultifileClass @file:JvmName("Utils") -package net.mamoe.mirai.utils.io +package net.mamoe.mirai.qqandroid.utils.io import kotlinx.io.OutputStream import kotlinx.io.charsets.Charset @@ -27,6 +27,9 @@ import kotlin.jvm.JvmMultifileClass import kotlin.jvm.JvmName import kotlin.jvm.JvmSynthetic import kotlinx.serialization.InternalSerializationApi +import net.mamoe.mirai.utils.io.ByteArrayPool +import net.mamoe.mirai.utils.io.toReadPacket +import net.mamoe.mirai.utils.io.toUHexString @OptIn(MiraiInternalAPI::class, InternalSerializationApi::class) fun ByteReadPacket.copyTo(outputStream: OutputStream) { diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/io/output.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/output.kt similarity index 94% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/io/output.kt rename to mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/output.kt index 38077fe9e..e6579d96d 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/io/output.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/io/output.kt @@ -11,12 +11,12 @@ @file:JvmMultifileClass @file:JvmName("Utils") -package net.mamoe.mirai.utils.io +package net.mamoe.mirai.qqandroid.utils.io import kotlinx.io.core.* +import net.mamoe.mirai.qqandroid.utils.coerceAtMostOrFail +import net.mamoe.mirai.qqandroid.utils.cryptor.TEA import net.mamoe.mirai.utils.MiraiInternalAPI -import net.mamoe.mirai.utils.coerceAtMostOrFail -import net.mamoe.mirai.utils.cryptor.TEA import kotlin.jvm.JvmMultifileClass import kotlin.jvm.JvmName diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/numbers.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/numbers.kt similarity index 96% rename from mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/numbers.kt rename to mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/numbers.kt index 8ed919284..856584958 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/numbers.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/numbers.kt @@ -10,7 +10,7 @@ @file:JvmMultifileClass @file:JvmName("Utils") -package net.mamoe.mirai.utils +package net.mamoe.mirai.qqandroid.utils import kotlin.jvm.JvmMultifileClass import kotlin.jvm.JvmName diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/cryptor/ECDHJvm.kt b/mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/utils/cryptor/ECDHJvm.kt similarity index 93% rename from mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/cryptor/ECDHJvm.kt rename to mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/utils/cryptor/ECDHJvm.kt index 0cb60c7e9..04f36145f 100644 --- a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/cryptor/ECDHJvm.kt +++ b/mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/utils/cryptor/ECDHJvm.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -package net.mamoe.mirai.utils.cryptor +package net.mamoe.mirai.qqandroid.utils.cryptor import net.mamoe.mirai.utils.MiraiInternalAPI import net.mamoe.mirai.utils.MiraiPlatformUtils @@ -27,11 +27,13 @@ internal actual class ECDHKeyPairImpl( override val privateKey: ECDHPrivateKey get() = delegate.private override val publicKey: ECDHPublicKey get() = delegate.public - override val initialShareKey: ByteArray = ECDH.calculateShareKey(privateKey, initialPublicKey) + override val initialShareKey: ByteArray = + ECDH.calculateShareKey(privateKey, initialPublicKey) } @Suppress("FunctionName") -actual fun ECDH() = ECDH(ECDH.generateKeyPair()) +actual fun ECDH() = + ECDH(ECDH.generateKeyPair()) actual class ECDH actual constructor(actual val keyPair: ECDHKeyPair) { actual companion object {