Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] update login protocol #2613

Merged
merged 62 commits into from
May 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
81e9fea
[core] update protocol
Apr 8, 2023
d1846b4
[core] fix t106 decryption key
Apr 9, 2023
cdf88c7
[core] handle t543
Apr 9, 2023
3818438
[core] revert t106
Apr 9, 2023
d0ef92d
[core] revert native test pow data
Apr 9, 2023
ac7407e
[core] split build version and apk version name
Apr 9, 2023
7987473
[core] pass time to t1 instead of time diff
Apr 10, 2023
d52ddea
[core] remove unused t106 writer & rename param ip to ipv4 of t1 and …
Apr 10, 2023
39f13bc
[core] implement qimei for t545
Apr 10, 2023
434db6e
[core] fix base64 decode for android in rsa
Apr 11, 2023
e2440f3
[core] fix unix timestamp parsing on native and add more tests
Apr 11, 2023
61b7006
[api] DeviceInfo move `androidId` to main constructor and adjust test.
Apr 11, 2023
db8bbab
[api] do not request qimei when protocol is neither ANDROID_PHONE no…
Apr 11, 2023
ef2e980
[api] implement aes crypto for native target
Apr 11, 2023
388165e
[api] rsa crypto for multi-platform
Apr 13, 2023
b5fd8ac
[api] crypto test
Apr 13, 2023
2fd3e25
[api] move freePointer util
Apr 13, 2023
db7e931
[api] openssl api compatibility
Apr 13, 2023
a6b4fee
[core] add explicit `androidId` param
Apr 13, 2023
3cd9c0e
[core] remove unused `tlvCount`
Apr 13, 2023
153082f
[core] optimize crypto
Apr 13, 2023
a1d4dd7
[core] move Qimei to network package
Apr 13, 2023
79d34d7
[core] move appId to protocol
Apr 13, 2023
184932a
[core] lazily initialize qimeiLogger
Apr 13, 2023
e8f709c
[core] write byte array to BIO mem
Apr 13, 2023
54976ed
[core] move qimei to client, add direct serializer for DeviceInfo
Apr 14, 2023
0e368b3
[core] optimize DeviceInfoDelegateSerializer
Apr 14, 2023
1088054
[core] real user-agent when requesting qimei
Apr 14, 2023
804677f
[core] use `DeviceInfo.version.release`
Apr 15, 2023
ae06319
[core] remove unused wtlogin packet
Apr 15, 2023
749b8d8
[core] do what constructor serializer should do
Apr 15, 2023
de3c6ab
[core] fix endless cache validation caused by not upgrading device in…
Apr 15, 2023
6c5d2b8
[core] request qimei before fast-login
Apr 15, 2023
d0bfbbf
[core] tlv order
Apr 15, 2023
e81873b
[core] remove wrong tests and print more detail when deserialize failed.
Apr 15, 2023
dda3e89
[core] device info upgrade for native
Apr 15, 2023
b2fe32b
[core] request qimei after validating cache
Apr 15, 2023
96c53e4
Merge remote-tracking branch 'mamoe/dev' into dev
Apr 16, 2023
d0ad083
[core] DeviceInfo compatibility
Apr 16, 2023
5a3f459
[core] DeviceInfo test name
Apr 16, 2023
909767d
[core] compatibility serializer
Apr 16, 2023
ea7040f
Merge remote-tracking branch 'mamoe/dev' into protocol
May 4, 2023
128858e
[core] disable rsa crypto test on android unit test
May 5, 2023
209dfac
[core] move rsa impl to jvmBase
May 6, 2023
632e654
action
May 6, 2023
f862578
Merge branch 'dev' into dev
StageGuard May 6, 2023
0a43f8b
import
May 6, 2023
09f3250
api dump
May 6, 2023
436ff0f
api dump
May 6, 2023
5471a28
Merge branch 'dev' into dev
StageGuard May 6, 2023
c926c4d
revert wrong api dumps
May 7, 2023
1a163aa
[core] Deprecate DeviceInfo constructor and serializer, provide `seri…
Him188 May 8, 2023
86298a0
rerun ci
Him188 May 8, 2023
f090916
optimize
May 7, 2023
9cd9ef5
use serializer directly
May 8, 2023
6fc32ea
optimize test
May 8, 2023
4ee05ff
revert
May 8, 2023
c275dd1
[core] CacheValidator use `DeviceInfo.serializeToString()` instead of…
May 10, 2023
832267f
Remove `println` in `DeviceInfoManager`
Him188 May 20, 2023
89c3d1a
Add legacy deserialize overload for ABI compatibility
Him188 May 20, 2023
60a8537
Remove uncompleted docs for DeviceInfo
Him188 May 20, 2023
271a5e0
Suppress DeviceInfo deprecation warnings for internal usages
Him188 May 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[core] move Qimei to network package
  • Loading branch information
StageGuard committed Apr 13, 2023
commit a1d4dd735c3cb3a36b62c6edb6e01d13dd028597
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import net.mamoe.mirai.internal.network.protocol.packet.login.UrlDeviceVerificat
import net.mamoe.mirai.internal.network.protocol.packet.login.WtLogin.Login.LoginPacketResponse
import net.mamoe.mirai.internal.network.protocol.packet.login.WtLogin.Login.LoginPacketResponse.Captcha
import net.mamoe.mirai.internal.network.protocol.packet.login.wtlogin.*
import net.mamoe.mirai.internal.utils.requestQimei
import net.mamoe.mirai.internal.network.qimei.requestQimei
import net.mamoe.mirai.internal.utils.subLogger
import net.mamoe.mirai.network.LoginFailedException
import net.mamoe.mirai.network.RetryLaterException
Expand All @@ -54,7 +54,7 @@ internal interface SsoProcessor {
fun casFirstLoginResult(
expect: FirstLoginResult?,
update: FirstLoginResult?
): Boolean // enable compiler optimization/
): Boolean // enable compiler optimization

fun setFirstLoginResult(value: FirstLoginResult?)

Expand Down Expand Up @@ -145,6 +145,8 @@ internal class SsoProcessorImpl(
ssoContext.bot.components[BotClientHolder].client = value
}

private val qimeiLogger = ssoContext.bot.network.logger.subLogger("QimeiApi")

override val ssoSession: SsoSession get() = client
private val components get() = ssoContext.bot.components

Expand Down Expand Up @@ -178,7 +180,6 @@ internal class SsoProcessorImpl(
}

// try to get qimei before login
val qimeiLogger = ssoContext.bot.network.logger.subLogger("QimeiApi")
try {
ssoContext.bot.requestQimei(qimeiLogger)
} catch (exception: Throwable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* https://github.com/mamoe/mirai/blob/dev/LICENSE
*/

package net.mamoe.mirai.internal.utils
package net.mamoe.mirai.internal.network.qimei

import io.ktor.client.plugins.*
import io.ktor.client.request.*
Expand Down Expand Up @@ -144,7 +144,7 @@ internal suspend fun QQAndroidBot.requestQimei(logger: MiraiLogger) {
val nonce = getRandomString(16)
val timestamp = currentTimeSeconds() * 1000

val encodedAESKey = rsaEncryptWithX509PubKey(aesKey, rsaPubKey.encodeToByteArray(), timestamp).encodeBase64()
val encodedAESKey = rsaEncryptWithX509PubKey(aesKey, rsaPubKey, timestamp).encodeBase64()
val encodedPayloadParam = aesEncrypt(payloadParam, aesKey, aesKey).encodeBase64()

val payload = Json.encodeToString(
Expand Down