From ad6d95cee55368efd924352a4a4efbeaa41bcd6b Mon Sep 17 00:00:00 2001
From: Him188 <Him188@mamoe.net>
Date: Sun, 7 Feb 2021 19:00:21 +0800
Subject: [PATCH] Require password length to be at most 16 on BotAccount init.
 #993

---
 mirai-core/src/commonMain/kotlin/BotAccount.kt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mirai-core/src/commonMain/kotlin/BotAccount.kt b/mirai-core/src/commonMain/kotlin/BotAccount.kt
index e2f570d98..589ea0acf 100644
--- a/mirai-core/src/commonMain/kotlin/BotAccount.kt
+++ b/mirai-core/src/commonMain/kotlin/BotAccount.kt
@@ -33,7 +33,9 @@ internal data class BotAccount(
         id,
         passwordPlainText.md5(),
         phoneNumber
-    )
+    ) {
+        require(passwordPlainText.length <= 16) { "Password length must be at most 16." }
+    }
 
     override fun equals(other: Any?): Boolean {
         if (this === other) return true