Move SsoSession from package context to components

This commit is contained in:
Him188 2021-07-28 10:53:03 +08:00
parent 4f1a22cd20
commit 0e45deef68
6 changed files with 22 additions and 37 deletions

View File

@ -19,8 +19,8 @@ import kotlinx.io.core.toByteArray
import net.mamoe.mirai.data.OnlineStatus
import net.mamoe.mirai.internal.BotAccount
import net.mamoe.mirai.internal.QQAndroidBot
import net.mamoe.mirai.internal.network.components.SsoSession
import net.mamoe.mirai.internal.network.context.AccountSecrets
import net.mamoe.mirai.internal.network.context.SsoSession
import net.mamoe.mirai.internal.network.protocol.SyncingCacheList
import net.mamoe.mirai.internal.network.protocol.data.jce.FileStoragePushFSSvcList
import net.mamoe.mirai.internal.network.protocol.packet.Tlv

View File

@ -14,7 +14,6 @@ import net.mamoe.mirai.internal.QQAndroidBot
import net.mamoe.mirai.internal.network.QQAndroidClient
import net.mamoe.mirai.internal.network.component.ComponentKey
import net.mamoe.mirai.internal.network.components.PacketCodec.Companion.PacketLogger
import net.mamoe.mirai.internal.network.context.SsoSession
import net.mamoe.mirai.internal.network.protocol.packet.*
import net.mamoe.mirai.internal.utils.crypto.TEA
import net.mamoe.mirai.internal.utils.crypto.adjustToPublicKey

View File

@ -12,10 +12,10 @@ package net.mamoe.mirai.internal.network.components
import net.mamoe.mirai.internal.QQAndroidBot
import net.mamoe.mirai.internal.network.Packet
import net.mamoe.mirai.internal.network.QQAndroidClient
import net.mamoe.mirai.internal.network.WLoginSigInfo
import net.mamoe.mirai.internal.network.component.ComponentKey
import net.mamoe.mirai.internal.network.context.AccountSecretsImpl
import net.mamoe.mirai.internal.network.context.SsoProcessorContext
import net.mamoe.mirai.internal.network.context.SsoSession
import net.mamoe.mirai.internal.network.handler.NetworkHandler
import net.mamoe.mirai.internal.network.impl.netty.NettyNetworkHandler
import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacketWithRespType
@ -56,6 +56,24 @@ internal interface SsoProcessor {
companion object : ComponentKey<SsoProcessor>
}
/**
* Contains secrets for encryption and decryption during a session created by [SsoProcessor] and [PacketCodec].
*
* @see AccountSecrets
*/
internal interface SsoSession {
var outgoingPacketSessionId: ByteArray
/**
* always 0 for now.
*/
var loginState: Int
// also present in AccountSecrets
var wLoginSigInfo: WLoginSigInfo
val randomKey: ByteArray
}
/**
* Strategy that performs the process of single sing-on (SSO). (login)
*

View File

@ -1,32 +0,0 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
*/
package net.mamoe.mirai.internal.network.context
import net.mamoe.mirai.internal.network.WLoginSigInfo
import net.mamoe.mirai.internal.network.components.PacketCodec
import net.mamoe.mirai.internal.network.components.SsoProcessor
/**
* Contains secrets for encryption and decryption during a session created by [SsoProcessor] and [PacketCodec].
*
* @see AccountSecrets
*/
internal interface SsoSession {
var outgoingPacketSessionId: ByteArray
/**
* always 0 for now.
*/
var loginState: Int
// also present in AccountSecrets
var wLoginSigInfo: WLoginSigInfo
val randomKey: ByteArray
}

View File

@ -12,8 +12,8 @@ package net.mamoe.mirai.internal.network.framework.components
import net.mamoe.mirai.internal.QQAndroidBot
import net.mamoe.mirai.internal.network.QQAndroidClient
import net.mamoe.mirai.internal.network.components.SsoProcessor
import net.mamoe.mirai.internal.network.components.SsoSession
import net.mamoe.mirai.internal.network.context.AccountSecretsImpl
import net.mamoe.mirai.internal.network.context.SsoSession
import net.mamoe.mirai.internal.network.context.createDeviceInfo
import net.mamoe.mirai.internal.network.handler.NetworkHandler
import net.mamoe.mirai.internal.network.handler.logger

View File

@ -13,9 +13,9 @@ import net.mamoe.mirai.event.events.BotOnlineEvent
import net.mamoe.mirai.internal.QQAndroidBot
import net.mamoe.mirai.internal.network.QQAndroidClient
import net.mamoe.mirai.internal.network.WLoginSigInfo
import net.mamoe.mirai.internal.network.components.SsoSession
import net.mamoe.mirai.internal.network.context.AccountSecrets
import net.mamoe.mirai.internal.network.context.AccountSecretsImpl
import net.mamoe.mirai.internal.network.context.SsoSession
import net.mamoe.mirai.internal.utils.io.serialization.loadAs
import net.mamoe.mirai.internal.utils.io.serialization.toByteArray
import net.mamoe.mirai.utils.EMPTY_BYTE_ARRAY